Skip to main content

eggress_protocol_shadowsocks/
error.rs

1/// Error types for Shadowsocks protocol operations.
2#[derive(Debug, thiserror::Error)]
3pub enum ShadowsocksError {
4    #[error("IO error: {0}")]
5    Io(#[from] std::io::Error),
6
7    #[error("unsupported method: {0}")]
8    UnsupportedMethod(String),
9
10    #[error("legacy stream cipher '{0}' is not supported; use an AEAD method (aes-128-gcm, aes-256-gcm, chacha20-ietf-poly1305)")]
11    LegacyMethodUnsupported(String),
12
13    #[deprecated(
14        note = "use the feature-gated SSR compatibility path or a structured runtime diagnostic"
15    )]
16    #[error("ShadowsocksR (SSR) compatibility is unavailable in this build")]
17    SsrUnsupported,
18
19    #[error("decryption failed: {0}")]
20    DecryptionFailed(String),
21
22    #[error("encryption failed: {0}")]
23    EncryptionFailed(String),
24
25    #[error("invalid address: {0}")]
26    InvalidAddress(String),
27
28    #[error("frame too large")]
29    FrameTooLarge,
30
31    #[error("invalid key length")]
32    InvalidKeyLength,
33
34    #[error("invalid legacy Shadowsocks OTA HMAC")]
35    InvalidOtaHmac,
36
37    #[error("password too long")]
38    PasswordTooLong,
39
40    #[error("{0}")]
41    Other(String),
42}