Expand description
SOCKS5 (RFC 1928) shared primitives + the UDP-ASSOCIATE client.
The greeting and the ATYP address codec are the single source of truth for
the SOCKS5 address wire format, shared by the CONNECT tunnel client
(connect_via_socks5), the UDP-ASSOCIATE client (Socks5UdpAssociation),
and (cross-crate) the downstream aroxy Shadowsocks / Trojan target encoders —
all of which use the same ATYP | ADDR | PORT layout. The latter lets arcbox
(and aroxy) route guest UDP through an upstream SOCKS5 proxy.
Structs§
- Socks5
UdpAssociation - A SOCKS5 UDP association (RFC 1928 §7).
Functions§
- connect_
via_ socks5 - Establishes a TCP tunnel via a SOCKS5 proxy (RFC 1928 CONNECT, no-auth subset).
- decode_
addr - Decodes a SOCKS5 address from the front of
buf, returning(host, port, bytes_consumed), orNoneif truncated / bad ATYP / non-UTF8 domain. - encode_
addr - Appends a SOCKS5 address (
ATYP | ADDR | PORT) toout. IP-literal hosts use ATYP v4/v6; everything else is sent as a domain name (ATYP 0x03) so the proxy resolves it — avoiding fake-IP leaks. - read_
addr - Reads a SOCKS5 address (
ATYP | ADDR | PORT) from any async stream. Domains are decoded strictly (non-UTF8 is an error, matchingdecode_addr).