Struct ServerConfig
pub struct ServerConfig { /* private fields */ }quic and std only.Expand description
Parameters governing incoming connections
Default values should be suitable for most internet applications.
Implementations§
§impl ServerConfig
impl ServerConfig
pub fn with_transport_config(
self,
transport: Arc<TransportConfig>,
) -> ServerConfig
pub fn with_transport_config( self, transport: Arc<TransportConfig>, ) -> ServerConfig
Set a custom TransportConfig
pub fn set_transport_config(
&mut self,
transport: Arc<TransportConfig>,
) -> &mut ServerConfig
pub fn set_transport_config( &mut self, transport: Arc<TransportConfig>, ) -> &mut ServerConfig
Set a custom TransportConfig
pub fn with_validation_token_config(
self,
validation_token: ValidationTokenConfig,
) -> ServerConfig
pub fn with_validation_token_config( self, validation_token: ValidationTokenConfig, ) -> ServerConfig
Set a custom ValidationTokenConfig, which governs the tokens this server sends
in NEW_TOKEN frames and how long it accepts them for.
pub fn set_validation_token_config(
&mut self,
validation_token: ValidationTokenConfig,
) -> &mut ServerConfig
pub fn set_validation_token_config( &mut self, validation_token: ValidationTokenConfig, ) -> &mut ServerConfig
Set a custom ValidationTokenConfig, which governs the tokens this server sends
in NEW_TOKEN frames and how long it accepts them for.
pub fn with_address_token_key(self, key: AddressTokenKey) -> ServerConfig
pub fn with_address_token_key(self, key: AddressTokenKey) -> ServerConfig
The key this server seals address-validation tokens with.
Servers given the same key can read one another’s Retry and NEW_TOKEN tokens; the address, lifetime and reuse checks still decide whether one is accepted. Defaults to material from the operating system’s random source, generated per configuration.
pub fn set_address_token_key(
&mut self,
key: AddressTokenKey,
) -> &mut ServerConfig
pub fn set_address_token_key( &mut self, key: AddressTokenKey, ) -> &mut ServerConfig
The key this server seals address-validation tokens with.
Servers given the same key can read one another’s Retry and NEW_TOKEN tokens; the address, lifetime and reuse checks still decide whether one is accepted. Defaults to material from the operating system’s random source, generated per configuration.
pub fn with_retry_token_lifetime(self, value: Duration) -> ServerConfig
pub fn with_retry_token_lifetime(self, value: Duration) -> ServerConfig
Duration after a retry token was issued for which it’s considered valid
Defaults to 15 seconds.
pub fn set_retry_token_lifetime(&mut self, value: Duration) -> &mut ServerConfig
pub fn set_retry_token_lifetime(&mut self, value: Duration) -> &mut ServerConfig
Duration after a retry token was issued for which it’s considered valid
Defaults to 15 seconds.
pub fn with_migration(self, value: bool) -> ServerConfig
pub fn with_migration(self, value: bool) -> ServerConfig
Whether to allow clients to migrate to new addresses
Improves behavior for clients that move between different internet connections or suffer NAT rebinding. Enabled by default.
pub fn set_migration(&mut self, value: bool) -> &mut ServerConfig
pub fn set_migration(&mut self, value: bool) -> &mut ServerConfig
Whether to allow clients to migrate to new addresses
Improves behavior for clients that move between different internet connections or suffer NAT rebinding. Enabled by default.
pub fn maybe_with_preferred_address_v4(
self,
address: Option<SocketAddrV4>,
) -> ServerConfig
pub fn maybe_with_preferred_address_v4( self, address: Option<SocketAddrV4>, ) -> ServerConfig
The preferred IPv4 address that will be communicated to clients during handshaking
If the client is able to reach this address, it will switch to it.
pub fn maybe_set_preferred_address_v4(
&mut self,
address: Option<SocketAddrV4>,
) -> &mut ServerConfig
pub fn maybe_set_preferred_address_v4( &mut self, address: Option<SocketAddrV4>, ) -> &mut ServerConfig
The preferred IPv4 address that will be communicated to clients during handshaking
If the client is able to reach this address, it will switch to it.
pub fn with_preferred_address_v4(self, address: SocketAddrV4) -> ServerConfig
pub fn with_preferred_address_v4(self, address: SocketAddrV4) -> ServerConfig
The preferred IPv4 address that will be communicated to clients during handshaking
If the client is able to reach this address, it will switch to it.
pub fn set_preferred_address_v4(
&mut self,
address: SocketAddrV4,
) -> &mut ServerConfig
pub fn set_preferred_address_v4( &mut self, address: SocketAddrV4, ) -> &mut ServerConfig
The preferred IPv4 address that will be communicated to clients during handshaking
If the client is able to reach this address, it will switch to it.
pub fn without_preferred_address_v4(self) -> ServerConfig
pub fn without_preferred_address_v4(self) -> ServerConfig
The preferred IPv4 address that will be communicated to clients during handshaking
If the client is able to reach this address, it will switch to it.
pub fn unset_preferred_address_v4(&mut self) -> &mut ServerConfig
pub fn unset_preferred_address_v4(&mut self) -> &mut ServerConfig
The preferred IPv4 address that will be communicated to clients during handshaking
If the client is able to reach this address, it will switch to it.
pub fn maybe_with_preferred_address_v6(
self,
address: Option<SocketAddrV6>,
) -> ServerConfig
pub fn maybe_with_preferred_address_v6( self, address: Option<SocketAddrV6>, ) -> ServerConfig
The preferred IPv6 address that will be communicated to clients during handshaking
If the client is able to reach this address, it will switch to it.
pub fn maybe_set_preferred_address_v6(
&mut self,
address: Option<SocketAddrV6>,
) -> &mut ServerConfig
pub fn maybe_set_preferred_address_v6( &mut self, address: Option<SocketAddrV6>, ) -> &mut ServerConfig
The preferred IPv6 address that will be communicated to clients during handshaking
If the client is able to reach this address, it will switch to it.
pub fn with_preferred_address_v6(self, address: SocketAddrV6) -> ServerConfig
pub fn with_preferred_address_v6(self, address: SocketAddrV6) -> ServerConfig
The preferred IPv6 address that will be communicated to clients during handshaking
If the client is able to reach this address, it will switch to it.
pub fn set_preferred_address_v6(
&mut self,
address: SocketAddrV6,
) -> &mut ServerConfig
pub fn set_preferred_address_v6( &mut self, address: SocketAddrV6, ) -> &mut ServerConfig
The preferred IPv6 address that will be communicated to clients during handshaking
If the client is able to reach this address, it will switch to it.
pub fn without_preferred_address_v6(self) -> ServerConfig
pub fn without_preferred_address_v6(self) -> ServerConfig
The preferred IPv6 address that will be communicated to clients during handshaking
If the client is able to reach this address, it will switch to it.
pub fn unset_preferred_address_v6(&mut self) -> &mut ServerConfig
pub fn unset_preferred_address_v6(&mut self) -> &mut ServerConfig
The preferred IPv6 address that will be communicated to clients during handshaking
If the client is able to reach this address, it will switch to it.
pub fn with_max_incoming(self, max_incoming: usize) -> ServerConfig
pub fn with_max_incoming(self, max_incoming: usize) -> ServerConfig
Maximum number of [Incoming][crate::proto::Incoming] to allow to exist at a time
An [Incoming][crate::proto::Incoming] comes into existence when an incoming connection attempt
is received and stops existing when the application either accepts it or otherwise disposes
of it. While this limit is reached, new incoming connection attempts are immediately
refused. Larger values have greater worst-case memory consumption, but accommodate greater
application latency in handling incoming connection attempts.
The default value is set to 65536. With a typical Ethernet MTU of 1500 bytes, this limits memory consumption from this to under 100 MiB–a generous amount that still prevents memory exhaustion in most contexts.
pub fn set_max_incoming(&mut self, max_incoming: usize) -> &mut ServerConfig
pub fn set_max_incoming(&mut self, max_incoming: usize) -> &mut ServerConfig
Maximum number of [Incoming][crate::proto::Incoming] to allow to exist at a time
An [Incoming][crate::proto::Incoming] comes into existence when an incoming connection attempt
is received and stops existing when the application either accepts it or otherwise disposes
of it. While this limit is reached, new incoming connection attempts are immediately
refused. Larger values have greater worst-case memory consumption, but accommodate greater
application latency in handling incoming connection attempts.
The default value is set to 65536. With a typical Ethernet MTU of 1500 bytes, this limits memory consumption from this to under 100 MiB–a generous amount that still prevents memory exhaustion in most contexts.
pub fn with_incoming_buffer_size(
self,
incoming_buffer_size: u64,
) -> ServerConfig
pub fn with_incoming_buffer_size( self, incoming_buffer_size: u64, ) -> ServerConfig
Maximum number of received bytes to buffer for each [Incoming][crate::proto::Incoming]
An [Incoming][crate::proto::Incoming] comes into existence when an incoming connection attempt
is received and stops existing when the application either accepts it or otherwise disposes
of it. This limit governs only packets received within that period, and does not include
the first packet. Packets received in excess of this limit are dropped, which may cause
0-RTT or handshake data to have to be retransmitted.
The default value is set to 10 MiB–an amount such that in most situations a client would
not transmit that much 0-RTT data faster than the server handles the corresponding
[Incoming][crate::proto::Incoming].
pub fn set_incoming_buffer_size(
&mut self,
incoming_buffer_size: u64,
) -> &mut ServerConfig
pub fn set_incoming_buffer_size( &mut self, incoming_buffer_size: u64, ) -> &mut ServerConfig
Maximum number of received bytes to buffer for each [Incoming][crate::proto::Incoming]
An [Incoming][crate::proto::Incoming] comes into existence when an incoming connection attempt
is received and stops existing when the application either accepts it or otherwise disposes
of it. This limit governs only packets received within that period, and does not include
the first packet. Packets received in excess of this limit are dropped, which may cause
0-RTT or handshake data to have to be retransmitted.
The default value is set to 10 MiB–an amount such that in most situations a client would
not transmit that much 0-RTT data faster than the server handles the corresponding
[Incoming][crate::proto::Incoming].
pub fn with_incoming_buffer_size_total(
self,
incoming_buffer_size_total: u64,
) -> ServerConfig
pub fn with_incoming_buffer_size_total( self, incoming_buffer_size_total: u64, ) -> ServerConfig
Maximum number of received bytes to buffer for all [Incoming][crate::proto::Incoming]
collectively
An [Incoming][crate::proto::Incoming] comes into existence when an incoming connection attempt
is received and stops existing when the application either accepts it or otherwise disposes
of it. This limit governs only packets received within that period, and does not include
the first packet. Packets received in excess of this limit are dropped, which may cause
0-RTT or handshake data to have to be retransmitted.
The default value is set to 100 MiB–a generous amount that still prevents memory exhaustion in most contexts.
pub fn set_incoming_buffer_size_total(
&mut self,
incoming_buffer_size_total: u64,
) -> &mut ServerConfig
pub fn set_incoming_buffer_size_total( &mut self, incoming_buffer_size_total: u64, ) -> &mut ServerConfig
Maximum number of received bytes to buffer for all [Incoming][crate::proto::Incoming]
collectively
An [Incoming][crate::proto::Incoming] comes into existence when an incoming connection attempt
is received and stops existing when the application either accepts it or otherwise disposes
of it. This limit governs only packets received within that period, and does not include
the first packet. Packets received in excess of this limit are dropped, which may cause
0-RTT or handshake data to have to be retransmitted.
The default value is set to 100 MiB–a generous amount that still prevents memory exhaustion in most contexts.
pub fn with_time_source(self, time_source: Arc<dyn TimeSource>) -> ServerConfig
pub fn with_time_source(self, time_source: Arc<dyn TimeSource>) -> ServerConfig
Object to get current SystemTime
This exists to allow system time to be mocked in tests, or wherever else desired.
Defaults to StdSystemTime, which simply calls SystemTime::now().
pub fn set_time_source(
&mut self,
time_source: Arc<dyn TimeSource>,
) -> &mut ServerConfig
pub fn set_time_source( &mut self, time_source: Arc<dyn TimeSource>, ) -> &mut ServerConfig
Object to get current SystemTime
This exists to allow system time to be mocked in tests, or wherever else desired.
Defaults to StdSystemTime, which simply calls SystemTime::now().
§impl ServerConfig
impl ServerConfig
pub fn try_from_rama_tls(
config: &TlsServerConfig,
options: TlsOptions,
) -> Result<ServerConfig, TlsConfigError>
Available on crate feature rustls and (crate features aws-lc or ring) only.
pub fn try_from_rama_tls( config: &TlsServerConfig, options: TlsOptions, ) -> Result<ServerConfig, TlsConfigError>
rustls and (crate features aws-lc or ring) only.Build a server configuration from the common Rama TLS server configuration: the identity to present, the protocols to accept and everything else TLS decides, with the provider chosen by this crate’s features.
Trait Implementations§
§impl Clone for ServerConfig
impl Clone for ServerConfig
§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ServerConfig
impl !UnwindSafe for ServerConfig
impl Freeze for ServerConfig
impl Send for ServerConfig
impl Sync for ServerConfig
impl Unpin for ServerConfig
impl UnsafeUnpin for ServerConfig
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