SOCKS5
A PHP SOCKS5 proxy built on Localzet Server.
Installation
Section titled “Installation”git clone https://github.com/localzet/SOCKS5.gitcd SOCKS5composer installRunning
Section titled “Running”Set SOCKS5_USERNAME and SOCKS5_PASSWORD in the process environment, then run php start.php start. Stop with php start.php stop. Startup rejects missing credentials.
| Variable | Value |
|---|---|
| SOCKS5_BIND | IPv4 listener; defaults to 127.0.0.1 |
| SOCKS5_PORT | Port 1–65535; defaults to 1080 |
| SOCKS5_USERNAME / SOCKS5_PASSWORD | Nonempty strings of at most 255 bytes |
| SOCKS5_ALLOW_NO_AUTH | 1 permits anonymous access on loopback only |
| SOCKS5_PID_FILE / SOCKS5_LOG_FILE | PID and log paths |
Protocol
Section titled “Protocol”TCP CONNECT supports IPv4 destinations and DNS names. Handshake buffering handles fragmented TCP data and retains early relay payloads. The buffer is bounded to 64 KiB and establishment to 10 seconds. Outbound connection errors return a SOCKS failure; successful replies contain the actual outgoing socket address and port.
BIND and IPv6 destinations are rejected. UDP ASSOCIATE is disabled in configuration. DNS lookup blocks the worker, so account for resolver latency under load.
SOCKS username/password authentication is plaintext. Use a trusted network or encrypted tunnel and restrict ingress/destinations. Original MIT notices.
Requirements
Section titled “Requirements”- php: ^8.2
- localzet/server: ^4.1
Source · AGPL-3.0