Struct AdmissionConfig
pub struct AdmissionConfig { /* private fields */ }quic and std only.Expand description
How a server admits incoming connection attempts while it is under load.
An attempt is in progress from the moment it is admitted until its handshake completes, fails, times out or is abandoned, whether it waits for the application or is already being accepted. While few attempts are in progress every attempt is accepted at once. Past the retry threshold, an attempt from an address that has not proven it receives what is sent there (no valid Retry or NEW_TOKEN token) is answered with a Retry (RFC 9000 §8.1.2): it is stateless and cheap, so a flood from spoofed addresses costs no handshake work, while a real client returns the token one round trip later and is admitted. At the limit every attempt is refused with CONNECTION_REFUSED, so clients fall back at once.
The retry threshold follows what the endpoint actually completes: the handshakes it
finished in about the last second, smoothed (quick to rise, slow to fall), kept between
Self::set_retry_threshold_min and Self::set_retry_threshold_max. Once crossed,
Retry stays on until the attempts in progress fall below three quarters of the threshold,
so the endpoint does not flap at the boundary.
Implementations§
§impl AdmissionConfig
impl AdmissionConfig
pub fn with_retry_threshold_min(self, value: usize) -> AdmissionConfig
pub fn with_retry_threshold_min(self, value: usize) -> AdmissionConfig
The retry threshold when the endpoint completes few handshakes.
Defaults to 256: a burst that large is accepted without an extra round trip even on an idle endpoint. A minimum and maximum of zero answer every unvalidated attempt with a Retry; a minimum above the maximum fixes the threshold at the minimum.
pub fn set_retry_threshold_min(&mut self, value: usize) -> &mut AdmissionConfig
pub fn set_retry_threshold_min(&mut self, value: usize) -> &mut AdmissionConfig
The retry threshold when the endpoint completes few handshakes.
Defaults to 256: a burst that large is accepted without an extra round trip even on an idle endpoint. A minimum and maximum of zero answer every unvalidated attempt with a Retry; a minimum above the maximum fixes the threshold at the minimum.
pub fn with_retry_threshold_max(self, value: usize) -> AdmissionConfig
pub fn with_retry_threshold_max(self, value: usize) -> AdmissionConfig
The highest the retry threshold rises, however many handshakes the endpoint completes.
Defaults to 4096. It bounds the handshake work a spoofed flood can cause before Retry starts, right after a busy period raised the threshold.
pub fn set_retry_threshold_max(&mut self, value: usize) -> &mut AdmissionConfig
pub fn set_retry_threshold_max(&mut self, value: usize) -> &mut AdmissionConfig
The highest the retry threshold rises, however many handshakes the endpoint completes.
Defaults to 4096. It bounds the handshake work a spoofed flood can cause before Retry starts, right after a busy period raised the threshold.
pub fn with_max_in_progress(self, value: usize) -> AdmissionConfig
pub fn with_max_in_progress(self, value: usize) -> AdmissionConfig
The most attempts in progress at once; beyond it every attempt is refused.
Defaults to 16384. Only attempts from validated addresses can reach it, since Retry holds the others at the threshold; it bounds what clients that complete address validation can make the endpoint hold. It also caps the retry threshold.
pub fn set_max_in_progress(&mut self, value: usize) -> &mut AdmissionConfig
pub fn set_max_in_progress(&mut self, value: usize) -> &mut AdmissionConfig
The most attempts in progress at once; beyond it every attempt is refused.
Defaults to 16384. Only attempts from validated addresses can reach it, since Retry holds the others at the threshold; it bounds what clients that complete address validation can make the endpoint hold. It also caps the retry threshold.
pub fn maybe_with_max_in_progress_per_source(
self,
value: Option<NonZero<usize>>,
) -> AdmissionConfig
pub fn maybe_with_max_in_progress_per_source( self, value: Option<NonZero<usize>>, ) -> AdmissionConfig
The most attempts in progress from one validated source: an IPv4 address, or an IPv6 /64 prefix, the block a subscriber is usually assigned. A validated attempt beyond it is refused.
Only attempts from validated addresses are counted: an unvalidated source address can be spoofed to exhaust another host’s share, so those attempts are bounded by the retry threshold instead. Defaults to 4096, a quarter of the attempts in progress: far above what carrier-grade or enterprise NAT puts behind one address, yet one validated host stalling its handshakes cannot take every slot.
pub fn maybe_set_max_in_progress_per_source(
&mut self,
value: Option<NonZero<usize>>,
) -> &mut AdmissionConfig
pub fn maybe_set_max_in_progress_per_source( &mut self, value: Option<NonZero<usize>>, ) -> &mut AdmissionConfig
The most attempts in progress from one validated source: an IPv4 address, or an IPv6 /64 prefix, the block a subscriber is usually assigned. A validated attempt beyond it is refused.
Only attempts from validated addresses are counted: an unvalidated source address can be spoofed to exhaust another host’s share, so those attempts are bounded by the retry threshold instead. Defaults to 4096, a quarter of the attempts in progress: far above what carrier-grade or enterprise NAT puts behind one address, yet one validated host stalling its handshakes cannot take every slot.
pub fn with_max_in_progress_per_source(
self,
value: NonZero<usize>,
) -> AdmissionConfig
pub fn with_max_in_progress_per_source( self, value: NonZero<usize>, ) -> AdmissionConfig
The most attempts in progress from one validated source: an IPv4 address, or an IPv6 /64 prefix, the block a subscriber is usually assigned. A validated attempt beyond it is refused.
Only attempts from validated addresses are counted: an unvalidated source address can be spoofed to exhaust another host’s share, so those attempts are bounded by the retry threshold instead. Defaults to 4096, a quarter of the attempts in progress: far above what carrier-grade or enterprise NAT puts behind one address, yet one validated host stalling its handshakes cannot take every slot.
pub fn set_max_in_progress_per_source(
&mut self,
value: NonZero<usize>,
) -> &mut AdmissionConfig
pub fn set_max_in_progress_per_source( &mut self, value: NonZero<usize>, ) -> &mut AdmissionConfig
The most attempts in progress from one validated source: an IPv4 address, or an IPv6 /64 prefix, the block a subscriber is usually assigned. A validated attempt beyond it is refused.
Only attempts from validated addresses are counted: an unvalidated source address can be spoofed to exhaust another host’s share, so those attempts are bounded by the retry threshold instead. Defaults to 4096, a quarter of the attempts in progress: far above what carrier-grade or enterprise NAT puts behind one address, yet one validated host stalling its handshakes cannot take every slot.
pub fn without_max_in_progress_per_source(self) -> AdmissionConfig
pub fn without_max_in_progress_per_source(self) -> AdmissionConfig
The most attempts in progress from one validated source: an IPv4 address, or an IPv6 /64 prefix, the block a subscriber is usually assigned. A validated attempt beyond it is refused.
Only attempts from validated addresses are counted: an unvalidated source address can be spoofed to exhaust another host’s share, so those attempts are bounded by the retry threshold instead. Defaults to 4096, a quarter of the attempts in progress: far above what carrier-grade or enterprise NAT puts behind one address, yet one validated host stalling its handshakes cannot take every slot.
pub fn unset_max_in_progress_per_source(&mut self) -> &mut AdmissionConfig
pub fn unset_max_in_progress_per_source(&mut self) -> &mut AdmissionConfig
The most attempts in progress from one validated source: an IPv4 address, or an IPv6 /64 prefix, the block a subscriber is usually assigned. A validated attempt beyond it is refused.
Only attempts from validated addresses are counted: an unvalidated source address can be spoofed to exhaust another host’s share, so those attempts are bounded by the retry threshold instead. Defaults to 4096, a quarter of the attempts in progress: far above what carrier-grade or enterprise NAT puts behind one address, yet one validated host stalling its handshakes cannot take every slot.
Trait Implementations§
§impl Clone for AdmissionConfig
impl Clone for AdmissionConfig
§fn clone(&self) -> AdmissionConfig
fn clone(&self) -> AdmissionConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for AdmissionConfig
impl Debug for AdmissionConfig
§impl Default for AdmissionConfig
impl Default for AdmissionConfig
§fn default() -> AdmissionConfig
fn default() -> AdmissionConfig
Auto Trait Implementations§
impl Freeze for AdmissionConfig
impl RefUnwindSafe for AdmissionConfig
impl Send for AdmissionConfig
impl Sync for AdmissionConfig
impl Unpin for AdmissionConfig
impl UnsafeUnpin for AdmissionConfig
impl UnwindSafe for AdmissionConfig
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 rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more