pub struct AuthThrottle { /* private fields */ }Expand description
Fixed-window failed-auth limiter per client IP (#54/#57).
Implementations§
Source§impl AuthThrottle
impl AuthThrottle
Sourcepub fn is_blocked(&self, ip: IpAddr) -> bool
pub fn is_blocked(&self, ip: IpAddr) -> bool
True when ip has exhausted its failure budget for the current window
(the caller responds 429 without evaluating credentials).
Sourcepub fn record_failure(&self, ip: IpAddr) -> u32
pub fn record_failure(&self, ip: IpAddr) -> u32
Records a failed attempt; returns the failure count in the window.
Sourcepub fn record_success(&self, ip: IpAddr)
pub fn record_success(&self, ip: IpAddr)
Clears the window after a successful authentication.
Trait Implementations§
Source§impl Debug for AuthThrottle
impl Debug for AuthThrottle
Source§impl Default for AuthThrottle
impl Default for AuthThrottle
Source§fn default() -> AuthThrottle
fn default() -> AuthThrottle
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for AuthThrottle
impl RefUnwindSafe for AuthThrottle
impl Send for AuthThrottle
impl Sync for AuthThrottle
impl Unpin for AuthThrottle
impl UnsafeUnpin for AuthThrottle
impl UnwindSafe for AuthThrottle
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more