Last active
November 19, 2022 08:07
-
-
Save jokereven/db1674b5d43a0679488c2866fbd73635 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/sh | |
host_ip=$(cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }') | |
port=7890 | |
PROXY_SOCK5="socks5://${host_ip}:${port}" | |
set_all_proxy(){ | |
export all_proxy="${PROXY_SOCK5}" | |
} | |
unset_proxy(){ | |
unset all_proxy | |
} | |
test_setting(){ | |
echo "all_proxy:" ${all_proxy} | |
} | |
if [ "$1" = "set" ] | |
then | |
set_all_proxy | |
elif [ "$1" = "unset" ] | |
then | |
unset_proxy | |
elif [ "$1" = "test" ] | |
then | |
test_setting | |
else | |
echo "Unsupported arguments." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment