Gist 4698533
✓ Published0🌍 Public
Aalessioalex
Last edited Aug 5, 2011
Created on Feb 2, 2013
This example implements a SOCKS5 proxy server in Node.js, demonstrating the TCP connection flow between a client, proxy, and destination. It shows the handshake, authentication (using USERPASS), and request forwarding stages. The code uses the `net` module’s `createServer` and `createConnection` APIs to handle incoming sockets and outbound TCP links, with buffer manipulation for parsing SOCKS5 headers, address types (IPv4, domain, IPv6), and ports. All connections are accepted, authorized, and relayed, though the `authorize` function always returns true.
AI-generated description