Open swanwish opened 7 years ago
Shadowsocks works very good on Mac, but it not work on terminal, the following command works for terminal.
Add following file .terminalproxy
.terminalproxy
#proxy ss='127.0.0.1:1087' # No Proxy function noproxy { unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY all_proxy ALL_PROXY ftp_proxy FTP_PROXY dns_proxy DNS_PROXY JAVA_OPTS GRADLE_OPTS MAVEN_OPTS echo "clear proxy done" } function setproxy { if [ $# -eq 0 ] then inArg=$ss else inArg=$1 fi HOST=$(echo $inArg |cut -d: -f1) PORT=$(echo $inArg |cut -d: -f2) http_proxy=http://$HOST:$PORT HTTP_PROXY=$http_proxy all_proxy=$http_proxy ALL_PROXY=$http_proxy ftp_proxy=$http_proxy FTP_PROXY=$http_proxy dns_proxy=$http_proxy DNS_PROXY=$http_proxy https_proxy=$http_proxy HTTPS_PROXY=$https_proxy JAVA_OPTS="-Dhttp.proxyHost=$HOST -Dhttp.proxyPort=$PORT -Dhttps.proxyHost=$HOST -Dhttps.proxyPort=$PORT" GRADLE_OPTS="-Dgradle.user.home=$HOME/.gradle" MAVEN_OPTS=$JAVA_OPTS no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com,.coding.net,192.168.99.100,.ruby-china.org" echo "current proxy is ${http_proxy}" export no_proxy http_proxy HTTP_PROXY https_proxy HTTPS_PROXY all_proxy ALL_PROXY ftp_proxy FTP_PROXY dns_proxy DNS_PROXY JAVA_OPTS GRADLE_OPTS MAVEN_OPTS } # setproxy
After add the file, then on the terminal, load the file with following command:
source .terminalproxy # Enable proxy with following command setproxy # Clear proxy setting noproxy
Change to socks5 protocol
Change http_proxy from http to socks5
http
socks5
# http_proxy=http://$HOST:$PORT http_proxy=socks5://$HOST:$PORT
Shadowsocks works very good on Mac, but it not work on terminal, the following command works for terminal.
Add following file
.terminalproxy
After add the file, then on the terminal, load the file with following command: