pub struct RateLimiterConfig {
pub behind_proxy: bool,
pub per_second: u64,
pub burst_size: u32,
}
Expand description
Configurations for rate limitng.
Fields§
§behind_proxy: bool
Enable rate limit based on headers commonly used by reverse proxies.
Uses headers commonly used by reverse proxies to extract the original IP address, falling back to the connection’s peer IP address. https://docs.rs/tower_governor/latest/tower_governor/key_extractor/struct.SmartIpKeyExtractor.html
per_second: u64
Set the interval after which one element of the quota is replenished in seconds.
The interval must not be zero.
burst_size: u32
Set quota size that defines how many requests can occur before the governor middleware starts blocking requests from an IP address and clients have to wait until the elements of the quota are replenished.
The burst_size must not be zero.
Trait Implementations§
Source§impl Debug for RateLimiterConfig
impl Debug for RateLimiterConfig
Source§impl Default for RateLimiterConfig
impl Default for RateLimiterConfig
Source§impl<'de> Deserialize<'de> for RateLimiterConfig
impl<'de> Deserialize<'de> for RateLimiterConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RateLimiterConfig
impl RefUnwindSafe for RateLimiterConfig
impl Send for RateLimiterConfig
impl Sync for RateLimiterConfig
impl Unpin for RateLimiterConfig
impl UnwindSafe for RateLimiterConfig
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