Created
December 7, 2022 03:40
-
-
Save hugefiver/7b5c312ff9599ae88e14ecbaaef2aa63 to your computer and use it in GitHub Desktop.
set proxy in wsl2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set_proxy() { | |
export hostip=$(cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }') | |
local proxy_url="http://${hostip}:7890" | |
export https_proxy="$proxy_url" | |
export http_proxy="$proxy_url" | |
export all_proxy="$proxy_url" | |
} | |
unset_proxy() { | |
export https_proxy="" http_proxy="" all_proxy="" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment