Skip to content

Instantly share code, notes, and snippets.

@jokereven
Last active November 19, 2022 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jokereven/db1674b5d43a0679488c2866fbd73635 to your computer and use it in GitHub Desktop.
Save jokereven/db1674b5d43a0679488c2866fbd73635 to your computer and use it in GitHub Desktop.
#!/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