apt-get install python-pip
pip install shadowsocks
sudo ssserver -p 443 -k password -m aes-256-cfb --user nobody -d start- Install Shadowsocks Client, e.g. run
brew cask install shadowsocksxin Mac OSX. - SwitchSharp
Only config
SOCKS Hostto127.0.0.1:1080and selectSOCKS v5
# `-N`: do not execute commands
# `-D`: bind 1080 port and forward 1080 port to 22 port
# `-i`: use pre-shared key `hello.pem`
# `-p`: specify port used to connect to remote server
ssh -ND 1080 -i ~/.ssh/hello.pem <username>@<your-remote-server-ip> -p 22- Install
proxychains-ngby runningbrew install proxychains-ng. - Config
/usr/local/Cellar/proxychains-ng/4.7/etc/proxychains.conf, modify the following parameters.
[ProxyList]
socks5 127.0.0.1 1080
- Add
proxychains4to the front of every command, e.g.proxychains4 curl ipecho.net/plain
Also works for Application like
Google ChromewhileSafaridoes not work, tryproxychains4 /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome. But this might slow down Chrome.
You can also use dsocks for mac(which does not work for me), tsocks for linux.
Add this script to ~/.bash_profile.
export http_proxy=socks5://127.0.0.1:1080
export https_proxy=socks5://127.0.0.1:1080Add the following line to ~/.curlrc. Since homebrew use curl to download the package, this will also enable homebrew to use SOCKS5.
socks5 = "socks5://127.0.0.1:1080"
There are no environment variables for SOCKS5 proxy servers in unix, so in order to use SOCKS5 in other utilities, check the man pages for existing tools to see if they have a configuration option for a SOCKS5 proxy and whether they have a configuration file that the configuration can be added to.
- For
https://andhttp://(e.g.http://github.com,https://github.com), run the following script.
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'- For
git://(e.g.git://github.com), rungit config --global core.gitproxy 'socks5://127.0.0.1:1080' - For ssh(e.g.
[email protected],ssh://[email protected]), addProxyCommand nc -x localhost:1080 %h %pto~/.ssh/configfile.
git config --globalis stored in~/.gitconfigwhile local config settings is in./.git/config. To remove a configuration, e.g. rungit config --global --unset core.gitproxy.
- how to set socks5 proxy in the terminal by askubuntu
- OS X Terminal Ignoring SOCKS Proxy Setup
- Git proxy through SOCKS 5 by cms-sw
- git proxy on segmentfault
curl --socks5-hostname 127.0.0.1:1080 http://wtfismyip.com/json
There's an issue where recent versions of Homebrew run
curlwith the--disableflag which prevents the.curlrcconfig file from loading. The configuration file alone wouldn't be sufficient. I still need to check if Homebrew code also strips environment variables before runningcurl. FYI.近期Homebrew版本有用
--disable来避免curl使用.curlrc配置文件的问题。只更改配置文件是不够的。我还没查Homebrew代码在调用curl之前是否会去掉环境变量。请知悉。