pub struct NonceWindow { /* private fields */ }Available on crate feature
transport only.Expand description
Anti-replay window using a bitfield.
Tracks received nonces to detect and reject replayed frames. Uses a sliding window of 2048+ bits as recommended by the spec.
Implementations§
Source§impl NonceWindow
impl NonceWindow
Sourcepub const WINDOW_SIZE: usize = 2_048usize
pub const WINDOW_SIZE: usize = 2_048usize
Window size in bits.
Sourcepub fn check_and_mark(&mut self, nonce: u64) -> bool
pub fn check_and_mark(&mut self, nonce: u64) -> bool
Check if a nonce is valid (not replayed) and mark it as seen.
Returns true if the nonce is valid and should be accepted,
false if it’s a replay or too old.
Trait Implementations§
Source§impl Clone for NonceWindow
impl Clone for NonceWindow
Source§fn clone(&self) -> NonceWindow
fn clone(&self) -> NonceWindow
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NonceWindow
impl Debug for NonceWindow
Auto Trait Implementations§
impl Freeze for NonceWindow
impl RefUnwindSafe for NonceWindow
impl Send for NonceWindow
impl Sync for NonceWindow
impl Unpin for NonceWindow
impl UnwindSafe for NonceWindow
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
Mutably borrows from an owned value. Read more