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
impl StructuralPartialEq for NetworkGuardError
Auto Trait Implementations§
impl Freeze for NetworkGuardError
impl RefUnwindSafe for NetworkGuardError
impl Send for NetworkGuardError
impl Sync for NetworkGuardError
impl Unpin for NetworkGuardError
impl UnsafeUnpin for NetworkGuardError
impl UnwindSafe for NetworkGuardError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.