SslContextBuilderExt

Trait SslContextBuilderExt 

pub trait SslContextBuilderExt: Sealed {
    // Required methods
    fn set_async_select_certificate_callback<F>(&mut self, callback: F)
       where F: Fn(&mut ClientHello<'_>) -> Result<Pin<Box<dyn Future<Output = Result<Box<dyn FnOnce(ClientHello<'_>) -> Result<(), AsyncSelectCertError>>, AsyncSelectCertError>> + Send>>, AsyncSelectCertError> + Send + Sync + 'static;
    fn set_async_private_key_method(
        &mut self,
        method: impl AsyncPrivateKeyMethod,
    );
    unsafe fn set_async_get_session_callback<F>(&mut self, callback: F)
       where F: Fn(&mut SslRef, &[u8]) -> Option<Pin<Box<dyn Future<Output = Option<Box<dyn FnOnce(&mut SslRef, &[u8]) -> Option<SslSession>>>> + Send>>> + Send + Sync + 'static;
}
Available on (crate features rustls or boring or acme) and crate feature boring only.
Expand description

Extensions to SslContextBuilder.

This trait provides additional methods to use async callbacks with boring.

Required Methods§

fn set_async_select_certificate_callback<F>(&mut self, callback: F)

Sets a callback that is called before most ClientHello processing and before the decision whether to resume a session is made. The callback may inspect the ClientHello and configure the connection.

This method uses a function that returns a future whose output is itself a closure that will be passed ClientHello to configure the connection based on the computations done in the future.

See SslContextBuilder::set_select_certificate_callback for the sync setter of this callback.

fn set_async_private_key_method(&mut self, method: impl AsyncPrivateKeyMethod)

Configures a custom private key method on the context.

See AsyncPrivateKeyMethod for more details.

unsafe fn set_async_get_session_callback<F>(&mut self, callback: F)
where F: Fn(&mut SslRef, &[u8]) -> Option<Pin<Box<dyn Future<Output = Option<Box<dyn FnOnce(&mut SslRef, &[u8]) -> Option<SslSession>>>> + Send>>> + Send + Sync + 'static,

Sets a callback that is called when a client proposed to resume a session but it was not found in the internal cache.

The callback is passed a reference to the session ID provided by the client. It should return the session corresponding to that ID if available. This is only used for servers, not clients.

See SslContextBuilder::set_get_session_callback for the sync setter of this callback.

§Safety

The returned SslSession must not be associated with a different SslContext.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§