Enum NetworkGuardError
pub enum NetworkGuardError {
InvalidHost(String),
InvalidPort,
NoAddresses {
host: String,
port: u16,
},
PortMismatch {
expected: u16,
address: SocketAddr,
},
LiteralMismatch {
literal: IpAddr,
address: SocketAddr,
},
CloudMetadata {
host: String,
reason: String,
},
PrivateHostDenied(String),
PrivateHostResolvedPublic(String),
PrivateNetworkDenied {
host: String,
reason: String,
},
MixedAddressClasses,
}Expand description
Why a host or its resolved address set is unsafe to dial.
This is the typed sibling of the validators’ anyhow errors, for callers
that must branch on the reason rather than only report it.
Variants§
InvalidHost(String)
The host is empty, malformed, or not a canonical DNS name/IP literal.
InvalidPort
Port zero is never a valid outbound destination.
NoAddresses
DNS returned no addresses.
PortMismatch
A resolver returned an address for a different port.
LiteralMismatch
A literal IP resolved to a different IP.
CloudMetadata
The answer set reaches a cloud metadata endpoint, directly or through a configured NAT64 prefix. Never allowed, whatever the private opt-in.
PrivateHostDenied(String)
A syntactically local hostname was not explicitly authorized.
PrivateHostResolvedPublic(String)
A local hostname unexpectedly resolved only to public addresses.
PrivateNetworkDenied
The answer set contains a non-globally-routable address and private access was not authorized for this host.
MixedAddressClasses
DNS returned both globally routable and private/local addresses.
Trait Implementations§
Source§impl Clone for NetworkGuardError
impl Clone for NetworkGuardError
Source§fn clone(&self) -> NetworkGuardError
fn clone(&self) -> NetworkGuardError
1.0.0 (const: unstable) · §fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NetworkGuardError
impl Debug for NetworkGuardError
Source§impl Display for NetworkGuardError
impl Display for NetworkGuardError
impl Eq for NetworkGuardError
Source§impl Error for NetworkGuardError
impl Error for NetworkGuardError
1.30.0 · §fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · §fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for NetworkGuardError
impl PartialEq for NetworkGuardError
Source§fn eq(&self, other: &NetworkGuardError) -> bool
fn eq(&self, other: &NetworkGuardError) -> bool
self and other values to be equal, and is used by ==.