io_proxy/socks/v5/mod.rs
1//! SOCKS version 5 ([RFC 1928]) with username/password authentication
2//! ([RFC 1929]).
3//!
4//! [`connect`] is the client `CONNECT` handshake coroutine; [`address`],
5//! [`auth`] and [`message`] hold the wire types it exchanges.
6//!
7//! [RFC 1928]: https://www.rfc-editor.org/rfc/rfc1928
8//! [RFC 1929]: https://www.rfc-editor.org/rfc/rfc1929
9
10pub mod address;
11pub mod auth;
12pub mod connect;
13pub mod message;
14
15/// Protocol version byte (`0x05`) prefixing the greeting, request and
16/// reply.
17pub(crate) const VERSION: u8 = 0x05;
18/// Version byte (`0x01`) of the RFC 1929 auth sub-negotiation — distinct
19/// from [`VERSION`], and the classic source of interop bugs.
20pub(crate) const AUTH_VERSION: u8 = 0x01;
21/// Reserved byte, must be `0x00`.
22pub(crate) const RSV: u8 = 0x00;
23
24/// `CONNECT` command.
25pub(crate) const CMD_CONNECT: u8 = 0x01;
26
27/// No-authentication method.
28pub(crate) const METHOD_NO_AUTH: u8 = 0x00;
29/// Username/password authentication method (RFC 1929).
30pub(crate) const METHOD_USER_PASS: u8 = 0x02;
31/// Sentinel the server returns when it accepts none of the offered
32/// methods.
33pub(crate) const METHOD_NO_ACCEPTABLE: u8 = 0xFF;
34
35/// IPv4 address type.
36pub(crate) const ATYP_IPV4: u8 = 0x01;
37/// Domain-name address type.
38pub(crate) const ATYP_DOMAIN: u8 = 0x03;
39/// IPv6 address type.
40pub(crate) const ATYP_IPV6: u8 = 0x04;