pub struct AuthGuardConfig {
pub max_failures_account: u32,
pub account_window_secs: u64,
pub base_lockout_secs: u64,
pub max_failures_ip: u32,
pub ip_window_secs: u64,
pub ip_base_lockout_secs: u64,
pub backoff_multiplier: f64,
pub max_lockout_secs: u64,
}Expand description
Tunable thresholds for the auth-guard’s lockout policy.
Defaults are tuned for an SMTP/IMAP submission server:
- 5 failures per (IP, username) in a 15-minute window → 30-minute lockout
- 20 failures per IP (any user) in a 60-minute window → 1-hour lockout
- Exponential backoff with multiplier 2.0, capped at 24 hours
Fields§
§max_failures_account: u32Failures within account_window_secs to trigger an account-level
lockout. Counts per (IP, username) pair.
account_window_secs: u64Sliding-window length for counting account-level failures.
base_lockout_secs: u64First-lockout duration for account-level breaches. Subsequent
lockouts grow by backoff_multiplier ^ consecutive_lockouts.
max_failures_ip: u32Failures within ip_window_secs (any user) to trigger an
IP-level lockout.
ip_window_secs: u64Sliding-window length for counting IP-level failures.
ip_base_lockout_secs: u64First-lockout duration for IP-level breaches.
backoff_multiplier: f64Exponential-backoff multiplier applied to repeat offenders. 2.0 → each subsequent lockout doubles the previous duration.
max_lockout_secs: u64Hard ceiling on lockout duration regardless of backoff.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AuthGuardConfig
impl RefUnwindSafe for AuthGuardConfig
impl Send for AuthGuardConfig
impl Sync for AuthGuardConfig
impl Unpin for AuthGuardConfig
impl UnsafeUnpin for AuthGuardConfig
impl UnwindSafe for AuthGuardConfig
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