First head Socks5

June 28, 2023
Socks5 Proxy

Socks5 Proxy

What is Socks protocol?

SOCKS is an Internet protocol that exchanges network packets between a client and server through a proxy server.

What is Socks5 protocol?

SOCKS5 optionally 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.

How to use Socks5?

Setup a Socks5 server

I created an Ubuntu 22.04 VM on AWS EC2 and used the docker to speed up the setup.

Socks server docker image

Run commands below to start a Socks server:

sudo docker run -d --name socks5 -p 1080:1080 -e PROXY_USER=<PROXY_USER> -e PROXY_PASSWORD=<PROXY_PASSWORD> serjs/go-socks5-proxy

Notes: make sure the firewall is enable to the port you specific.

Test Socks5 with curl

On the client side, run commands below:

curl --socks5 <Socks Server IP>:1080 https://ifconfig.me/ip -U <PROXY_USER>:<PROXY_PASSWORD>

Notes: The websites to test your public IP:

Test Socks5 with client

I’ve written a simple client for Socks5 client. Here is the demo.