pub struct RateLimiterConfig {
pub max_rate: f64,
pub burst_size: usize,
pub enable_per_peer_limits: bool,
pub max_per_peer_rate: f64,
pub enable_adaptive: bool,
pub adaptive_factor: f64,
pub min_rate: f64,
pub max_adaptive_rate: f64,
pub enable_queuing: bool,
pub max_queue_size: usize,
pub peer_window: Duration,
}Expand description
Configuration for the connection rate limiter
Fields§
§max_rate: f64Maximum connection rate (connections per second)
burst_size: usizeMaximum burst size (tokens)
enable_per_peer_limits: boolEnable per-peer rate limiting
max_per_peer_rate: f64Maximum connections per peer per second
enable_adaptive: boolEnable adaptive rate limiting
adaptive_factor: f64Adjustment factor for adaptive limiting (0.0 to 1.0)
min_rate: f64Minimum rate (connections per second) when adapting
max_adaptive_rate: f64Maximum rate (connections per second) when adapting
enable_queuing: boolEnable connection queuing when rate limited
max_queue_size: usizeMaximum queue size for pending connections
peer_window: DurationTime window for per-peer tracking
Implementations§
Source§impl RateLimiterConfig
impl RateLimiterConfig
Sourcepub fn conservative() -> Self
pub fn conservative() -> Self
Configuration for aggressive rate limiting (low rates)
Sourcepub fn permissive() -> Self
pub fn permissive() -> Self
Configuration for permissive rate limiting (high rates)
Trait Implementations§
Source§impl Clone for RateLimiterConfig
impl Clone for RateLimiterConfig
Source§fn clone(&self) -> RateLimiterConfig
fn clone(&self) -> RateLimiterConfig
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 moreSource§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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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