1use thiserror::Error;
4
5#[derive(Error, Debug)]
7pub enum ProxyError {
8 #[error("Proxy bind failed on {addr}: {source}")]
9 Bind {
10 addr: String,
11 #[source]
12 source: std::io::Error,
13 },
14
15 #[error("Host denied by filter: {host}: {reason}")]
16 HostDenied { host: String, reason: String },
17
18 #[error("Invalid session token")]
19 InvalidToken,
20
21 #[error("Unknown service prefix: {prefix}")]
22 UnknownService { prefix: String },
23
24 #[error("Upstream connection failed to {host}: {reason}")]
25 UpstreamConnect { host: String, reason: String },
26
27 #[error("External proxy error: {0}")]
28 ExternalProxy(String),
29
30 #[error("Credential loading error: {0}")]
31 Credential(String),
32
33 #[error("Configuration error: {0}")]
34 Config(String),
35
36 #[error("HTTP parse error: {0}")]
37 HttpParse(String),
38
39 #[error("Proxy shutdown")]
40 Shutdown,
41
42 #[error("I/O error: {0}")]
43 Io(#[from] std::io::Error),
44}
45
46pub type Result<T> = std::result::Result<T, ProxyError>;