#[non_exhaustive]pub struct AuthFailureThrottleConfig {
pub max_failures: u32,
pub window_secs: u64,
pub trusted_proxy_hops: usize,
pub trusted_proxies: Vec<TrustedProxy>,
pub forwarded_header: ForwardedHeader,
pub max_peers: usize,
}Expand description
Configuration for an AuthFailureThrottle.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_failures: u32Failed authentications a peer may have in one window before it is refused for the rest of it. Must be non-zero.
window_secs: u64Window duration in seconds. Must be non-zero.
trusted_proxy_hops: usizeNumber of trusted reverse-proxy hops in front of this server; 0
(the default) ignores x-forwarded-for, which the client controls.
trusted_proxies: Vec<TrustedProxy>The address ranges the trusted proxies connect from. Empty (the
default) believes x-forwarded-for on the hop count alone; with
ranges named, only a connection from one of them is believed, and any
other is counted by its own address. See
RateLimitConfig::trusted_proxies.
forwarded_header: ForwardedHeaderThe header the trusted proxies write the client’s address into. See
RateLimitConfig::forwarded_header.
max_peers: usizeMaximum number of peers tracked at once. Must be non-zero.
Implementations§
Source§impl AuthFailureThrottleConfig
impl AuthFailureThrottleConfig
Sourcepub const fn with_max_failures(self, failures: u32) -> AuthFailureThrottleConfig
pub const fn with_max_failures(self, failures: u32) -> AuthFailureThrottleConfig
Sets the failures allowed per window per peer. Must be non-zero.
Sourcepub const fn with_window_secs(self, secs: u64) -> AuthFailureThrottleConfig
pub const fn with_window_secs(self, secs: u64) -> AuthFailureThrottleConfig
Sets the window duration in seconds. Must be non-zero.
Sourcepub const fn with_trusted_proxy_hops(
self,
hops: usize,
) -> AuthFailureThrottleConfig
pub const fn with_trusted_proxy_hops( self, hops: usize, ) -> AuthFailureThrottleConfig
Sets the number of trusted reverse-proxy hops.
Sourcepub fn with_trusted_proxies(
self,
proxies: impl IntoIterator<Item = TrustedProxy>,
) -> AuthFailureThrottleConfig
pub fn with_trusted_proxies( self, proxies: impl IntoIterator<Item = TrustedProxy>, ) -> AuthFailureThrottleConfig
Sets the address ranges the trusted proxies connect from. See
trusted_proxies.
Sourcepub const fn with_forwarded_header(
self,
header: ForwardedHeader,
) -> AuthFailureThrottleConfig
pub const fn with_forwarded_header( self, header: ForwardedHeader, ) -> AuthFailureThrottleConfig
Sets the header the trusted proxies write the client’s address into.
Sourcepub const fn with_max_peers(self, max: usize) -> AuthFailureThrottleConfig
pub const fn with_max_peers(self, max: usize) -> AuthFailureThrottleConfig
Sets the maximum number of peers tracked. Must be non-zero.
Trait Implementations§
Source§impl Clone for AuthFailureThrottleConfig
impl Clone for AuthFailureThrottleConfig
Source§fn clone(&self) -> AuthFailureThrottleConfig
fn clone(&self) -> AuthFailureThrottleConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AuthFailureThrottleConfig
impl Debug for AuthFailureThrottleConfig
Source§impl Default for AuthFailureThrottleConfig
impl Default for AuthFailureThrottleConfig
Source§fn default() -> AuthFailureThrottleConfig
fn default() -> AuthFailureThrottleConfig
Auto Trait Implementations§
impl Forget for AuthFailureThrottleConfig
impl Freeze for AuthFailureThrottleConfig
impl Move for AuthFailureThrottleConfig
impl RefUnwindSafe for AuthFailureThrottleConfig
impl Send for AuthFailureThrottleConfig
impl Sync for AuthFailureThrottleConfig
impl Unpin for AuthFailureThrottleConfig
impl UnsafeUnpin for AuthFailureThrottleConfig
impl UnwindSafe for AuthFailureThrottleConfig
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].