Skip to main content

Crate socker

Crate socker 

Source
Expand description

§A sans-IO SOCKS protocol implementation

This crate implements the SOCKS protocol family in a completely runtime-independent, sans-IO fashion: every message is a plain data type that knows how to encode itself into a contiguous byte buffer and how to decode itself from one, and nothing more. There is no state machine, no socket type, and no async runtime dependency - the crate is usable from any executor, operating system abstraction, or even no runtime at all.

The following protocols are covered:

  • SOCKS4 and SOCKS4a (including the 4a remote-DNS domain extension),
  • SOCKS5 (RFC 1928), including the UDP ASSOCIATE command and the UDP datagram header,
  • the SOCKS5h addressing mode, i.e. sending unresolved domain names so that DNS resolution is performed by the server (see socks5::Address),
  • the username/password sub-negotiation from RFC 1929.

Protocol numbers (authentication methods, commands, reply codes, address types) are represented with the caret crate: every value defined by the specifications is available as a named constant, while any unassigned or reserved raw value remains constructible, encodable, and decodable, as the specifications permit such values on the wire.

Runtime wrappers implementing clients and servers on top of this core are provided by the sibling crates socker-tokio and socker-compio.

Modules§

socks4
Sans-IO implementation of SOCKS4 and SOCKS4a.
socks5
Sans-IO implementation of SOCKS5 (RFC 1928).

Enums§

DecodeError
An error produced while decoding a message from bytes.
DecodeStatus
The result of attempting to decode a message from a byte slice.
EncodeError
An error produced while encoding a message into bytes.

Traits§

Message
The sans-IO contract shared by every protocol message in this crate.