Struct tower_governor::governor::GovernorConfig
source · pub struct GovernorConfig<K: KeyExtractor, M: RateLimitingMiddleware<QuantaInstant>> { /* private fields */ }
Expand description
Configuration for the Governor middleware.
Implementations§
source§impl<K: KeyExtractor, M: RateLimitingMiddleware<QuantaInstant>> GovernorConfig<K, M>
impl<K: KeyExtractor, M: RateLimitingMiddleware<QuantaInstant>> GovernorConfig<K, M>
pub fn limiter(&self) -> &SharedRateLimiter<K::Key, M>
source§impl<M: RateLimitingMiddleware<QuantaInstant>> GovernorConfig<PeerIpKeyExtractor, M>
impl<M: RateLimitingMiddleware<QuantaInstant>> GovernorConfig<PeerIpKeyExtractor, M>
sourcepub fn secure() -> Self
pub fn secure() -> Self
A default configuration for security related services. Allows bursts with up to two requests and replenishes one element after four seconds, based on peer IP.
This prevents brute-forcing passwords or security tokens yet allows to quickly retype a wrong password once before the quota is exceeded.
Trait Implementations§
source§impl<K: Clone + KeyExtractor, M: Clone + RateLimitingMiddleware<QuantaInstant>> Clone for GovernorConfig<K, M>
impl<K: Clone + KeyExtractor, M: Clone + RateLimitingMiddleware<QuantaInstant>> Clone for GovernorConfig<K, M>
source§fn clone(&self) -> GovernorConfig<K, M>
fn clone(&self) -> GovernorConfig<K, M>
Returns a copy 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<K: Debug + KeyExtractor, M: Debug + RateLimitingMiddleware<QuantaInstant>> Debug for GovernorConfig<K, M>
impl<K: Debug + KeyExtractor, M: Debug + RateLimitingMiddleware<QuantaInstant>> Debug for GovernorConfig<K, M>
Auto Trait Implementations§
impl<K, M> Freeze for GovernorConfig<K, M>where
K: Freeze,
impl<K, M> !RefUnwindSafe for GovernorConfig<K, M>
impl<K, M> Send for GovernorConfig<K, M>
impl<K, M> Sync for GovernorConfig<K, M>
impl<K, M> Unpin for GovernorConfig<K, M>where
K: Unpin,
impl<K, M> !UnwindSafe for GovernorConfig<K, M>
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