pub struct SecurityFeatures(/* private fields */);Expand description
The 24 STUN Security Feature bits of a nonce cookie.
The three bytes are one 24-bit number in network order, and the features are numbered
from its least significant end: RFC 8489 section 18.1 as corrected by its verified erratum
6290 (“Bit 0 is the rightmost bit”). The nonce of the RFC’s own test vector (appendix
B.1), obMatJos2AAAC..., is 0x000002: bit 1, username anonymity, and the vector duly
carries USERHASH.
Implementations§
Source§impl SecurityFeatures
impl SecurityFeatures
Sourcepub const PASSWORD_ALGORITHMS: Self
pub const PASSWORD_ALGORITHMS: Self
Bit 0, “Password algorithms”: the server sends PASSWORD-ALGORITHMS.
Sourcepub const USERNAME_ANONYMITY: Self
pub const USERNAME_ANONYMITY: Self
Bit 1, “Username anonymity”: the client sends USERHASH in place of USERNAME.
Sourcepub fn from_nonce(nonce: &str) -> Option<Self>
pub fn from_nonce(nonce: &str) -> Option<Self>
The features of the cookie nonce starts with, or None when it does not start with a
nonce cookie (a server that predates RFC 8489).
Sourcepub const fn password_algorithms(self) -> bool
pub const fn password_algorithms(self) -> bool
Whether the “Password algorithms” bit is set.
Sourcepub const fn username_anonymity(self) -> bool
pub const fn username_anonymity(self) -> bool
Whether the “Username anonymity” bit is set.
Sourcepub const fn bits(self) -> u32
pub const fn bits(self) -> u32
The 24 bits as a number: feature bit N of the registry is 1 << N.
The nonce cookie for these features: what a server puts ahead of its own nonce value.