Skip to main content

lingxia_proxy/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum ProxyError {
5    #[error("I/O error: {0}")]
6    Io(#[from] std::io::Error),
7
8    #[error("SOCKS5 error: {0}")]
9    Socks5(#[from] fast_socks5::SocksError),
10
11    #[error("Invalid CONNECT request: {0}")]
12    BadRequest(String),
13
14    #[error("Upstream connection failed: {0}")]
15    UpstreamConnect(String),
16
17    #[error("Rule-list routing error: {0}")]
18    RuleList(String),
19
20    #[error("Proxy already running")]
21    AlreadyRunning,
22
23    #[cfg(feature = "capture")]
24    #[error("MITM interception failed: {0}")]
25    Mitm(String),
26}