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