pub struct IpRateLimitConfig { /* private fields */ }Expand description
State for from_fn_with_state(config, ip_rate_limit). Clones share the same quota buckets.
Implementations§
Source§impl IpRateLimitConfig
impl IpRateLimitConfig
Sourcepub fn new<F>(
enabled: bool,
seconds_per_request: NonZeroU64,
burst_size: NonZeroU32,
trusted_proxies: &[String],
rejection: F,
) -> Self
pub fn new<F>( enabled: bool, seconds_per_request: NonZeroU64, burst_size: NonZeroU32, trusted_proxies: &[String], rejection: F, ) -> Self
Builds a shared IP limiter; the product supplies its 429 envelope and Retry-After policy.
Sourcepub fn peer_resolver<P>(self, peer: P) -> Self
pub fn peer_resolver<P>(self, peer: P) -> Self
Overrides direct-peer extraction for an alternate trusted transport extension. This resolver must never infer a peer from unverified request headers.
Sourcepub fn retain_recent(&self)
pub fn retain_recent(&self)
Removes expired buckets. Products may invoke this from their maintenance runtime.
Trait Implementations§
Source§impl Clone for IpRateLimitConfig
impl Clone for IpRateLimitConfig
Source§fn clone(&self) -> IpRateLimitConfig
fn clone(&self) -> IpRateLimitConfig
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 moreAuto Trait Implementations§
impl Freeze for IpRateLimitConfig
impl !RefUnwindSafe for IpRateLimitConfig
impl Send for IpRateLimitConfig
impl Sync for IpRateLimitConfig
impl Unpin for IpRateLimitConfig
impl UnsafeUnpin for IpRateLimitConfig
impl !UnwindSafe for IpRateLimitConfig
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