Menu

1 / 5

socks5-proxy: a SOCKS5 server on Tokio you can read in one sitting

DEV Community: rust·Abdeldjalil Chougui·12 days ago
#hJmle1j3
#devtorust#devto#dev#client#proxy
Long article (1293 words) — no AI summary yet.
Reading 0:00
15s threshold

SOCKS5 is everywhere and almost invisible. ssh -D speaks it. Browsers have a settings field for it. curl has a -x socks5h:// option. It is the protocol that lets a program say "open a connection to this host for me" to another machine, without either side caring what travels inside.

For something so widely used, few developers have looked at what happens on the wire. The protocol is defined in two short documents, RFC 1928 and RFC 1929, and a complete server is small. socks5-proxy is my implementation in Rust on Tokio: CONNECT and UDP ASSOCIATE with IPv4, IPv6 and domain-name targets, username/password authentication, first-match allow/deny rules on destinations, handshake, connect and idle timeouts, and per-connection statistics.

The README names two audiences: people learning how a SOCKS proxy works on the wire, since it is short enough to read in one sitting, and anyone who wants a small, auditable proxy for local use. This post covers what I built and what it teaches.

What I built

The byte formats.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.