pub struct PinTracker { /* private fields */ }Expand description
Thread-safe PIN attempt tracker with lockout capability.
Implementations§
Source§impl PinTracker
impl PinTracker
pub fn new() -> Self
Sourcepub async fn check_pin(
&self,
configured_pin: Option<&str>,
provided_pin: Option<&str>,
remote_ip: IpAddr,
) -> Result<(), StatusCode>
pub async fn check_pin( &self, configured_pin: Option<&str>, provided_pin: Option<&str>, remote_ip: IpAddr, ) -> Result<(), StatusCode>
Validates the provided query PIN against the server’s configured PIN.
- If no PIN is configured on the server, Ok(()) is returned immediately.
- If too many failed attempts have occurred from this IP, returns Err(429).
- If the provided PIN matches, resets attempt counter and returns Ok(()).
- If PIN is missing or invalid, increments attempt counter and returns Err(401).
Trait Implementations§
Source§impl Debug for PinTracker
impl Debug for PinTracker
Auto Trait Implementations§
impl !Freeze for PinTracker
impl !RefUnwindSafe for PinTracker
impl !UnwindSafe for PinTracker
impl Send for PinTracker
impl Sync for PinTracker
impl Unpin for PinTracker
impl UnsafeUnpin for PinTracker
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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