s5x-0.1.1 is not a library.
s5x — SOCKS5 Proxy Tools
Linux only (other OS not tested)
The project contains the following crates:
- s5x — SOCKS5 proxy server
- s5t — SOCKS5 client with tun2socks support
- s5l — common library used by both
s5x — SOCKS5 Proxy Server
Installation
Option 1: Cargo
Requires:
- Rust
- build-essential (Debian/Ubuntu:
sudo apt install build-essential)
Option 2: Prebuilt binary (no dependencies)
Download latest binary s5x from Releases
Usage
Note: If using prebuilt binary, replace
s5xwith./s5x
Options
| Option | Description | Default |
|---|---|---|
--host |
bind address | 127.0.0.1 |
--port |
port to listen on | 1080 |
--auth |
username:password authentication | None |
--xor |
XOR key for obfuscation (hex) | None |
Note:
--xorobfuscation only works when both client and server use the same key. Client must bes5t
Examples
Note: Use
socks5h://for DNS resolving on the proxy side,socks5://for client-side DNS
s5t — SOCKS5 Client
Currently supports two modes:
- socks5 — One-time SOCKS5 request (HTTP/HTTPS)
- tun2socks — creates a TUN interface and forwards all traffic through a SOCKS5 proxy
Installation
Option 1: Cargo
Option 2: Prebuilt binary
Download latest binary s5t from Releases
Usage
-
socks5 Mode (One-time request)
# HTTP GET request
# HTTPS POST with JSON data
# With authentication
# With custom headers
# With custom method
-
tun2socks Mode
# Basic usage (replace with your actual server)
# With authentication and XOR obfuscation
Note: If using prebuilt binary, replace
s5twith./s5t
Options
| Option | Description | Mode support |
|---|---|---|
--mode |
tun2socks or socks5 |
both |
--server |
SOCKS5 server address (host:port) | both |
--auth |
username:password authentication | both |
--xor |
XOR key for obfuscation (hex) | both |
--address |
TUN interface IP | tun2socks |
--target |
target URL | socks5 |
--method |
HTTP method (GET, POST, etc.) | socks5 |
--data |
request body data | socks5 |
--headers |
custom HTTP headers | socks5 |
tun2socks: How It Works
- Creates a TUN interface with the specified IP
- Sets up routing rules to forward all traffic through the TUN
- Intercepts DNS requests and returns fake IPs
- Forwards all TCP traffic through the SOCKS5 proxy
- Cleanup is automatic on exit (Ctrl+C)
Note: client requires
sudoto create the TUN interface and modify routing tables
Example: Full Setup
# Terminal 1 (on the server): start the proxy server
# Terminal 2 (on the client): start the client (requires sudo)
# Replace 127.0.0.1:1080 with your actual server
# Terminal 3: test