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("invalid address: {0}")]
23    InvalidAddress(String),
24
25    #[error("frame too large")]
26    FrameTooLarge,
27
28    #[error("invalid key length")]
29    InvalidKeyLength,
30
31    #[error("invalid legacy Shadowsocks OTA HMAC")]
32    InvalidOtaHmac,
33
34    #[error("password too long")]
35    PasswordTooLong,
36
37    #[error("{0}")]
38    Other(String),
39}