pub enum StunError {
Truncated,
BadMagicCookie,
TransactionIdMismatch,
NoMappedAddress,
UnexpectedType(u16),
Io(String),
Timeout,
}Expand description
Errors decoding a STUN message or performing a Binding transaction (SPEC.md §2.8).
Exhaustive and NOT #[non_exhaustive]: dig-nat re-exports this type and some of its consumers
match on it exhaustively, so adding a variant is a breaking change tracked by SemVer rather than
absorbed silently.
Variants§
Truncated
The datagram was shorter than a valid STUN message / attribute.
BadMagicCookie
The magic cookie did not match — not a STUN (RFC 5389) message.
TransactionIdMismatch
The transaction id in the response did not match the request (possible spoof / stale reply).
NoMappedAddress
The message parsed but carried no usable mapped address: either no (XOR-)MAPPED-ADDRESS
attribute at all, OR (for crate::query_reflexive_address only) a parsed address that
failed the reflexive-usability guard (SPEC.md §5 — e.g. loopback, link-local, multicast, a
documentation range, or port == 0).
UnexpectedType(u16)
The message type was not the one the caller expected (a Binding success response when parsing a response; a Binding request when parsing a request), or an attribute’s address family byte was neither IPv4 nor IPv6.
Io(String)
Underlying socket I/O error (stringified so StunError stays Clone/Eq).
Timeout
The transaction did not complete within the deadline.
Trait Implementations§
impl Eq for StunError
Source§impl Error for StunError
impl Error for StunError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()