Skip to main content

QuicClientConfigProvider

Trait QuicClientConfigProvider 

pub trait QuicClientConfigProvider: TlsClientConfigProvider {
    // Required methods
    fn client_config(
        &self,
        config: &TlsClientConfig,
        options: TlsOptions,
    ) -> Result<ClientConfig, TlsConfigError>;
    fn peer_matches_name(
        &self,
        extensions: &Extensions,
        leaf: &CertificateDer<'_>,
        name: &Host,
    ) -> bool;

    // Provided methods
    fn supports_ech(&self) -> bool { ... }
    fn session_defaults(&self) -> Option<Extensions> { ... }
    fn prepare_client_config(
        &self,
        _policy: &TlsClientConfig,
        _options: TlsOptions,
        _peer: Host,
        _handshake: ClientHandshake,
    ) -> Result<Option<ClientConfig>, TlsConfigError> { ... }
    fn acquire_client_config(
        &self,
        request: ClientConfigRequest<'_>,
    ) -> Result<Option<ClientConfig>, TlsConfigError> { ... }
    fn acquire_client_config_async<'a>(
        &'a self,
        request: ClientConfigRequest<'a>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ClientConfig>, TlsConfigError>> + Send + 'a>> { ... }
    fn allows_early_data(&self, _extensions: &Extensions) -> bool { ... }
}
Available on crate features quic and std only.
Expand description

Build QUIC TLS configurations from Rama settings using a fixed provider.

This is the request-configuration boundary; the lower-level session provider interface remains available through ClientConfig::new. Custom providers use this same interface for construction, pool identity and server authentication.

Built-in providers apply common Rama TLS settings and their own native extensions, ignoring other providers’ native settings. Construction, authentication claims and pool identity describe the settings actually applied. Different connectors can therefore use different TLS policies.

Required Methods§

fn client_config( &self, config: &TlsClientConfig, options: TlsOptions, ) -> Result<ClientConfig, TlsConfigError>

Apply the final TLS settings and client handshake policy in options. Fresh clients must neither consult nor populate session-ticket stores, including stores supplied through native configuration hooks.

fn peer_matches_name( &self, extensions: &Extensions, leaf: &CertificateDer<'_>, name: &Host, ) -> bool

Whether the peer leaf of a connection authenticated under the effective configuration in extensions is also valid for name, including any pins scoped to it. Providers that cannot tell return false; a pin scoped to name on an intermediate or root never matches the leaf, so it fails closed.

Provided Methods§

fn supports_ech(&self) -> bool

Whether this backend can offer real ECH from endpoint configuration.

fn session_defaults(&self) -> Option<Extensions>

Optional connector-local backend session state shared by sibling configurations. These extensions hold cache metadata; they must not replace TLS security settings. The default retains each native configuration’s own session state.

fn prepare_client_config( &self, _policy: &TlsClientConfig, _options: TlsOptions, _peer: Host, _handshake: ClientHandshake, ) -> Result<Option<ClientConfig>, TlsConfigError>

Prepare peer-bound native TLS state without connection I/O. Prepared configurations bypass ordinary caches because their first native session belongs to this peer; retries obtain fresh ephemeral state.

handshake controls ticket offers; options still controls ticket retention and early data. Authentication and credentials remain policy. Return None if this provider cannot prepare native sessions.

fn acquire_client_config( &self, request: ClientConfigRequest<'_>, ) -> Result<Option<ClientConfig>, TlsConfigError>

Acquire a configuration for one connection through this provider’s cache.

The connector supplies a lookup bound to this provider and its cache. The default uses TlsClientConfigProvider::pool_id to classify effective settings and calls Self::client_config on a cache miss or Self::prepare_client_config for peer-bound sessions. Custom providers with mutable state can pass a supplemental key and matching native builders to ClientConfigRequest::get_or_build. Return None when the provider does not support the requested peer-bound handshake.

fn acquire_client_config_async<'a>( &'a self, request: ClientConfigRequest<'a>, ) -> Pin<Box<dyn Future<Output = Result<Option<ClientConfig>, TlsConfigError>> + Send + 'a>>

Acquire a peer’s configuration asynchronously when the provider needs I/O. The default calls Self::acquire_client_config on the current task.

fn allows_early_data(&self, _extensions: &Extensions) -> bool

Whether backend-specific settings permit early data in this configuration.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

§

impl QuicClientConfigProvider for BoringTlsProvider

Available on crate feature boring only.
§

impl QuicClientConfigProvider for RustlsTlsProvider

Available on crate feature rustls and (crate features aws-lc or ring) only.