Struct ClientConfig
#[non_exhaustive]pub struct ClientConfig { /* private fields */ }quic and std only.Expand description
Configuration for outgoing connections
Default values should be suitable for most internet applications.
Implementations§
§impl ClientConfig
impl ClientConfig
pub fn apply_quic_profile(
&mut self,
profile: &QuicProfile,
) -> Result<(), ConfigError>
pub fn apply_quic_profile( &mut self, profile: &QuicProfile, ) -> Result<(), ConfigError>
Apply the client parts of a profile: the version policy, the first destination connection ID length and a transport configuration with this profile’s limits and layout.
§impl ClientConfig
impl ClientConfig
pub fn new(crypto: Arc<dyn ClientConfig>) -> ClientConfig
pub fn new(crypto: Arc<dyn ClientConfig>) -> ClientConfig
Create a default config with a particular cryptographic config
pub fn with_time_source(self, time_source: Arc<dyn TimeSource>) -> ClientConfig
pub fn with_time_source(self, time_source: Arc<dyn TimeSource>) -> ClientConfig
The clock received tokens are dated with, and aged by when they are reused (RFC 9287 §3.1). Defaults to the system clock.
pub fn set_time_source(
&mut self,
time_source: Arc<dyn TimeSource>,
) -> &mut ClientConfig
pub fn set_time_source( &mut self, time_source: Arc<dyn TimeSource>, ) -> &mut ClientConfig
The clock received tokens are dated with, and aged by when they are reused (RFC 9287 §3.1). Defaults to the system clock.
pub fn with_initial_dst_cid_provider(
self,
provider: Arc<dyn Fn() -> ConnectionId + Sync + Send>,
) -> ClientConfig
pub fn with_initial_dst_cid_provider( self, provider: Arc<dyn Fn() -> ConnectionId + Sync + Send>, ) -> ClientConfig
How the destination connection ID of a first Initial is chosen (RFC 9000 §7.2: at least eight bytes of unpredictable value).
pub fn set_initial_dst_cid_provider(
&mut self,
provider: Arc<dyn Fn() -> ConnectionId + Sync + Send>,
) -> &mut ClientConfig
pub fn set_initial_dst_cid_provider( &mut self, provider: Arc<dyn Fn() -> ConnectionId + Sync + Send>, ) -> &mut ClientConfig
How the destination connection ID of a first Initial is chosen (RFC 9000 §7.2: at least eight bytes of unpredictable value).
pub fn versions_policy(&self) -> &ClientVersionPolicy
pub fn versions_policy(&self) -> &ClientVersionPolicy
How this client negotiates QUIC versions.
pub fn set_version(
&mut self,
version: Version,
) -> Result<&mut ClientConfig, ConfigError>
pub fn set_version( &mut self, version: Version, ) -> Result<&mut ClientConfig, ConfigError>
The QUIC version of the first flight, keeping the rest of the version policy.
Fails for a version this crate does not implement.
pub fn try_with_version(
self,
version: Version,
) -> Result<ClientConfig, ConfigError>
pub fn try_with_version( self, version: Version, ) -> Result<ClientConfig, ConfigError>
The QUIC version of the first flight; see Self::set_version.
pub fn set_versions(
&mut self,
versions: ClientVersionPolicy,
) -> Result<&mut ClientConfig, ConfigError>
pub fn set_versions( &mut self, versions: ClientVersionPolicy, ) -> Result<&mut ClientConfig, ConfigError>
How this client negotiates QUIC versions (RFC 9368).
Fails when the policy lets a server move the connection to another compatible version but the TLS provider cannot change version during the handshake.
pub fn try_with_versions(
self,
versions: ClientVersionPolicy,
) -> Result<ClientConfig, ConfigError>
pub fn try_with_versions( self, versions: ClientVersionPolicy, ) -> Result<ClientConfig, ConfigError>
How this client negotiates QUIC versions; see Self::set_versions.
pub fn with_preferred_address_policy(
self,
policy: PreferredAddressPolicy,
) -> ClientConfig
pub fn with_preferred_address_policy( self, policy: PreferredAddressPolicy, ) -> ClientConfig
What to do with the address a server advertises as preferred (RFC 9000 §9.6).
Defaults to PreferredAddressPolicy::Migrate: the address advertised for the family
in use is probed once the handshake is confirmed, and the connection moves there with
the connection ID the server bound to it as soon as a probe is answered.
pub fn set_preferred_address_policy(
&mut self,
policy: PreferredAddressPolicy,
) -> &mut ClientConfig
pub fn set_preferred_address_policy( &mut self, policy: PreferredAddressPolicy, ) -> &mut ClientConfig
What to do with the address a server advertises as preferred (RFC 9000 §9.6).
Defaults to PreferredAddressPolicy::Migrate: the address advertised for the family
in use is probed once the handshake is confirmed, and the connection moves there with
the connection ID the server bound to it as soon as a probe is answered.
pub fn with_transport_config(
self,
transport: Arc<TransportConfig>,
) -> ClientConfig
pub fn with_transport_config( self, transport: Arc<TransportConfig>, ) -> ClientConfig
Set a custom TransportConfig
pub fn set_transport_config(
&mut self,
transport: Arc<TransportConfig>,
) -> &mut ClientConfig
pub fn set_transport_config( &mut self, transport: Arc<TransportConfig>, ) -> &mut ClientConfig
Set a custom TransportConfig
pub fn with_token_store(self, store: Arc<dyn TokenStore>) -> ClientConfig
pub fn with_token_store(self, store: Arc<dyn TokenStore>) -> ClientConfig
Set a custom TokenStore
Defaults to TokenMemoryCache, which is suitable for most internet applications.
pub fn set_token_store(
&mut self,
store: Arc<dyn TokenStore>,
) -> &mut ClientConfig
pub fn set_token_store( &mut self, store: Arc<dyn TokenStore>, ) -> &mut ClientConfig
Set a custom TokenStore
Defaults to TokenMemoryCache, which is suitable for most internet applications.
§impl ClientConfig
impl ClientConfig
pub fn try_from_rama_tls(
config: &TlsClientConfig,
options: TlsOptions,
) -> Result<ClientConfig, TlsConfigError>
pub fn try_from_rama_tls( config: &TlsClientConfig, options: TlsOptions, ) -> Result<ClientConfig, TlsConfigError>
Build a client configuration from the common Rama TLS client configuration: the peer identity to trust, the protocols to offer and everything else TLS decides, with the provider chosen by this crate’s features.
The destination address is not part of it. A connection is made to an address with
Endpoint::connect_with, and the identity it must prove
comes from here and from the server name given there.
§impl ClientConfig
impl ClientConfig
pub fn try_from_rama_tls_with_provider(
config: &TlsClientConfig,
options: TlsOptions,
provider: &dyn QuicClientConfigProvider,
) -> Result<ClientConfig, TlsConfigError>
pub fn try_from_rama_tls_with_provider( config: &TlsClientConfig, options: TlsOptions, provider: &dyn QuicClientConfigProvider, ) -> Result<ClientConfig, TlsConfigError>
Build through the explicitly injected provider, independently of enabled defaults.
Trait Implementations§
§impl Clone for ClientConfig
impl Clone for ClientConfig
§fn clone(&self) -> ClientConfig
fn clone(&self) -> ClientConfig
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 ClientConfig
impl !UnwindSafe for ClientConfig
impl Freeze for ClientConfig
impl Send for ClientConfig
impl Sync for ClientConfig
impl Unpin for ClientConfig
impl UnsafeUnpin for ClientConfig
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