tokio_socks/
error.rs

1/// Error type of `tokio-socks`
2#[derive(thiserror::Error, Debug)]
3pub enum Error {
4    /// Failure caused by an IO error.
5    #[error("{0}")]
6    Io(#[from] std::io::Error),
7    /// Failure when parsing a `String`.
8    #[error("{0}")]
9    ParseError(#[from] std::string::ParseError),
10    /// Failure due to invalid target address. It contains the detailed error
11    /// message.
12    #[error("Target address is invalid: {0}")]
13    InvalidTargetAddress(&'static str),
14    /// Proxy server unreachable.
15    #[error("Proxy server unreachable")]
16    ProxyServerUnreachable,
17    /// Proxy server returns an invalid version number.
18    #[error("Invalid response version")]
19    InvalidResponseVersion,
20    /// No acceptable auth methods
21    #[error("No acceptable auth methods")]
22    NoAcceptableAuthMethods,
23    /// Unknown auth method
24    #[error("Unknown auth method")]
25    UnknownAuthMethod,
26    /// General SOCKS server failure
27    #[error("General SOCKS server failure")]
28    GeneralSocksServerFailure,
29    /// Connection not allowed by ruleset
30    #[error("Connection not allowed by ruleset")]
31    ConnectionNotAllowedByRuleset,
32    /// Network unreachable
33    #[error("Network unreachable")]
34    NetworkUnreachable,
35    /// Host unreachable
36    #[error("Host unreachable")]
37    HostUnreachable,
38    /// Connection refused
39    #[error("Connection refused")]
40    ConnectionRefused,
41    /// TTL expired
42    #[error("TTL expired")]
43    TtlExpired,
44    /// Command not supported
45    #[error("Command not supported")]
46    CommandNotSupported,
47    /// Address type not supported
48    #[error("Address type not supported")]
49    AddressTypeNotSupported,
50    /// Unknown error
51    #[error("Unknown error")]
52    UnknownError,
53    /// Invalid reserved byte
54    #[error("Invalid reserved byte")]
55    InvalidReservedByte,
56    /// Unknown address type
57    #[error("Unknown address type")]
58    UnknownAddressType,
59    /// Invalid authentication values. It contains the detailed error message.
60    #[error("Invalid auth values: {0}")]
61    InvalidAuthValues(&'static str),
62    /// Password auth failure
63    #[error("Password auth failure, code: {0}")]
64    PasswordAuthFailure(u8),
65
66    #[error("Authorization required")]
67    AuthorizationRequired,
68
69    #[error("Request rejected because SOCKS server cannot connect to identd on the client")]
70    IdentdAuthFailure,
71
72    #[error("Request rejected because the client program and identd report different user-ids")]
73    InvalidUserIdAuthFailure,
74}
75
76///// Result type of `tokio-socks`
77// pub type Result<T> = std::result::Result<T, Error>;