Overview
socks5
Socket Secure (SOCKS) is an Internet protocol that routes network packets between a client and server through a proxy server. SOCKS5 additionally provides authentication so only authorized users may access a server.
Practically, a SOCKS server proxies TCP connections to an arbitrary IP address, and provides a means for UDP packets to be forwarded.SOCKS operates at a lower level than HTTP proxying: SOCKS uses a handshake protocol to inform the proxy software about the connection that the client is trying to make, and then acts as transparently as possible. SOCKS proxies can also forward UDP traffic and work in reverse.
shadowsocks
Shadowsocks is a fast tunnel proxy that can help bypass firewalls.
test environment
Remote VPS OS: Ubuntu-14.04 Server VPS on DigitalOcean
Local Client OS: Ubuntu-14.04 Desktop
Installation
install package
1 2 |
|
remote server
1
|
|
This will run shadowsocks remote server listening at 0.0.0.0:8388
local server
1
|
|
This will run shadowsocks local server listening at 127.0.0.1:1080
Client Configuration
Web Browser
Thanks for proxy setting extension like FoxyProxy in Firefox, SwitchyOmega in Chrome, socks proxy tunnel can be easily configured.
Choose socks v5 protocal at localhost:1080, and get it work.
Curl
1
|
|
Note that we specify protocal as socks5h instead of socks5, which means we use the specified SOCKS5 proxy, and let the proxy resolve the host name, otherwise it may not resolve hostname. And port 1080 is by default.
Nodejs Request
request utility doesn’t support socks proxy by default, so we need socks5-http-client and socks5-https-client to create agent.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
Finally, test it.
1 2 |
|