rusty_socks
A super basic SOCKS5 proxy, written in Rust on tokio.
Published on crates.io as
rsocks— therusty_socksname was already taken by an unrelated crate. The repo, binary, and Docker image stayrusty_socks.
rusty_socks is a small, no-frills SOCKS5 (CONNECT) proxy: point a browser, an ssh ProxyCommand, or anything else SOCKS5-aware at it and it relays TCP to the requested destination. It adds a CIDR allow-list, a reset-on-activity idle timeout, and optional binding to specific network interfaces — and nothing else.
Usage
Run with defaults (listen on 0.0.0.0:1080, accept every client):
Every option is available as a CLI flag or its RS_* environment variable (flags win):
)
)
Configuration
| Flag | Env var | Default | Description |
|---|---|---|---|
--listen-interface |
RS_LISTEN_INTERFACE |
(none → 0.0.0.0) |
Network interface whose IP the proxy listens on. |
--endpoint-interface |
RS_ENDPOINT_INTERFACE |
(none → 0.0.0.0) |
Network interface used for outbound connections to endpoints. |
--port |
RS_PORT |
1080 |
Port to listen on. |
--buffer-size |
RS_BUFFER_SIZE |
2048 |
Per-direction buffer size, in bytes. |
--read-timeout |
RS_READ_TIMEOUT |
60000 |
Idle timeout (ms); the clock resets on every byte, so only genuinely silent connections are reaped. 0 disables it. |
--accept-cidr |
RS_ACCEPT_CIDR |
0.0.0.0/0 |
CIDR of client addresses allowed to connect. |
Logging uses tracing; set RUST_LOG to change the level (e.g. RUST_LOG=rusty_sockslib=debug).
As a browser proxy
Run rusty_socks on a host that can reach where you want to go, then set your browser's SOCKS host to host:1080 (SOCKS v5). All browser TCP traffic is relayed through it — the generic, any-destination case SOCKS5 is built for.
As an ssh hop
Tunnel ssh through a machine that can't (or shouldn't) run sshd, using a SOCKS-aware connector such as ncat:
Host myhost
ProxyCommand ncat --proxy proxy-host:1080 --proxy-type socks5 %h %p
ServerAliveInterval 15
Keep
ServerAliveIntervalcomfortably underread-timeoutso an idle session is kept alive rather than reaped.
Install
Linux:
macOS (Apple Silicon):
Windows:
$ iwr https://github.com/twitchax/rusty_socks/releases/latest/download/rusty_socks_x86_64-pc-windows-gnu.zip -OutFile rusty_socks.zip
$ Expand-Archive rusty_socks.zip -DestinationPath C:\Users\%USERNAME%\AppData\Local\Programs\rusty_socks
Cargo:
Docker
Published as twitchax/rusty_socks. Configure via flags or RS_* env vars:
Testing
License
This project is licensed under the MIT License - see the LICENSE file for details.