# Shadowsocks Proxy ## [Server-side setup](https://github.com/shadowsocks/shadowsocks) ```sh apt-get install python-pip pip install shadowsocks sudo ssserver -p 443 -k password -m aes-256-cfb --user nobody -d start ``` ## Client-side setup * Install Shadowsocks Client, e.g. run `brew cask install shadowsocksx` in Mac OSX. * SwitchSharp > Only config `SOCKS Host` to `127.0.0.1:1080` and select `SOCKS v5` # SOCKS 5 Through SSH Tunnel ```sh # `-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 @ -p 22 ``` ## Reference * [how-do-i-set-up-a-linux-proxy-for-my-mac by askubuntu](http://askubuntu.com/questions/143303/how-do-i-set-up-a-linux-proxy-for-my-mac) # Socks 5 in Terminal # Solution One * Install `proxychains-ng` by running `brew install proxychains-ng`. * Config `/usr/local/Cellar/proxychains-ng/4.7/etc/proxychains.conf`, modify the following parameters. ```config [ProxyList] socks5 127.0.0.1 1080 ``` * Add `proxychains4` to the front of every command, e.g. `proxychains4 curl ipecho.net/plain` ## Solution Two Add this script to `~/.bash_profile`. ```sh export http_proxy=socks5://127.0.0.1:1080 export https_proxy=socks5://127.0.0.1:1080 ``` ## Solution Three--Config `curl` to use SOCKS5 Add the following line to `~/.curlrc` ```config 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. ## Reference * [how to set socks5 proxy in the terminal by askubuntu](http://askubuntu.com/questions/610333/how-to-set-socks5-proxy-in-the-terminal) * [OS X Terminal Ignoring SOCKS Proxy Setup](http://superuser.com/questions/377199/os-x-terminal-ignoring-socks-proxy-setup) * [Git proxy through SOCKS 5](http://cms-sw.github.io/tutorial-proxy.html) > `git config --global ` is stored in `~/.gitconfig` while local config settings is in `./.git/config`. > To remove a configuration, e.g. run `git config --global --unset core.gitproxy`. # Tools ```sh curl --socks5-hostname 127.0.0.1:1080 http://wtfismyip.com/json ```