Skip to main content

Module socks

Module socks 

Source
Expand description

SOCKS5 (RFC 1928) + username/password auth (RFC 1929) transport — the anonymity seam for Tor (SOCKS5h :9050) and I2P (SOCKS :4444). no_std, depends only on crate::platform + crate::error.

Two entry points, one codec: Socks5Client — a non-blocking handshake state machine for every outbound peer; socks_http_get — a blocking HTTP GET through the proxy (domain resolved by the proxy) for trackers.

When a proxy is configured the engine enforces: no inbound, no DHT, no UDP trackers, no port mapping, listen port 0.

Structs§

ProxyConfig
SOCKS5 proxy configuration.
Socks5Client
Non-blocking SOCKS5 handshake state machine.

Enums§

SocksStatus
Outcome of one Socks5Client::pump call.
SocksTarget
Where a SOCKS5 CONNECT should reach.

Functions§

socks_http_get
Perform a blocking HTTP GET to url through the SOCKS5 proxy.
socks_http_get_range
Perform a blocking HTTP GET with a Range: bytes=start-end header through the SOCKS5 proxy. Used by web seeds (BEP-19) so piece data is never fetched from the real IP in proxy mode. The response body must be exactly end - start + 1 bytes, otherwise Err(Protocol).