pub struct MiddlewareRateLimit {
pub average: Option<i64>,
pub burst: Option<i64>,
pub period: Option<IntOrString>,
pub source_criterion: Option<MiddlewareRateLimitSourceCriterion>,
}
Expand description
RateLimit holds the rate limit configuration. This middleware ensures that services will receive a fair amount of requests, and allows one to define what fair is. More info: https://doc.traefik.io/traefik/v3.3/middlewares/http/ratelimit/
Fields§
§average: Option<i64>
Average is the maximum rate, by default in requests/s, allowed for the given source. It defaults to 0, which means no rate limiting. The rate is actually defined by dividing Average by Period. So for a rate below 1req/s, one needs to define a Period larger than a second.
burst: Option<i64>
Burst is the maximum number of requests allowed to arrive in the same arbitrarily small period of time. It defaults to 1.
period: Option<IntOrString>
Period, in combination with Average, defines the actual maximum rate, such as: r = Average / Period. It defaults to a second.
source_criterion: Option<MiddlewareRateLimitSourceCriterion>
SourceCriterion defines what criterion is used to group requests as originating from a common source. If several strategies are defined at the same time, an error will be raised. If none are set, the default is to use the request’s remote address field (as an ipStrategy).
Implementations§
Source§impl MiddlewareRateLimit
impl MiddlewareRateLimit
Sourcepub fn builder() -> MiddlewareRateLimitBuilder<((), (), (), ())>
pub fn builder() -> MiddlewareRateLimitBuilder<((), (), (), ())>
Create a builder for building MiddlewareRateLimit
.
On the builder, call .average(...)
(optional), .burst(...)
(optional), .period(...)
(optional), .source_criterion(...)
(optional) to set the values of the fields.
Finally, call .build()
to create the instance of MiddlewareRateLimit
.
Trait Implementations§
Source§impl Clone for MiddlewareRateLimit
impl Clone for MiddlewareRateLimit
Source§fn clone(&self) -> MiddlewareRateLimit
fn clone(&self) -> MiddlewareRateLimit
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for MiddlewareRateLimit
impl Debug for MiddlewareRateLimit
Source§impl Default for MiddlewareRateLimit
impl Default for MiddlewareRateLimit
Source§fn default() -> MiddlewareRateLimit
fn default() -> MiddlewareRateLimit
Source§impl<'de> Deserialize<'de> for MiddlewareRateLimit
impl<'de> Deserialize<'de> for MiddlewareRateLimit
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>,
Source§impl JsonSchema for MiddlewareRateLimit
impl JsonSchema for MiddlewareRateLimit
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moreSource§impl PartialEq for MiddlewareRateLimit
impl PartialEq for MiddlewareRateLimit
Source§impl Serialize for MiddlewareRateLimit
impl Serialize for MiddlewareRateLimit
impl StructuralPartialEq for MiddlewareRateLimit
Auto Trait Implementations§
impl Freeze for MiddlewareRateLimit
impl RefUnwindSafe for MiddlewareRateLimit
impl Send for MiddlewareRateLimit
impl Sync for MiddlewareRateLimit
impl Unpin for MiddlewareRateLimit
impl UnwindSafe for MiddlewareRateLimit
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
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>
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>
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