SslContextBuilderExt

Trait SslContextBuilderExt 

Source
pub trait SslContextBuilderExt: Sealed {
    // Required methods
    fn set_async_select_certificate_callback<F>(&mut self, callback: F)
       where F: Fn(&mut ClientHello<'_>) -> Result<BoxSelectCertFuture, 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<BoxGetSessionFuture> + Send + Sync + 'static;
}
Expand description

Extensions to SslContextBuilder.

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

Required Methods§

Source

fn set_async_select_certificate_callback<F>(&mut self, callback: F)
where F: Fn(&mut ClientHello<'_>) -> Result<BoxSelectCertFuture, AsyncSelectCertError> + Send + Sync + 'static,

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.

Source

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.

Source

unsafe fn set_async_get_session_callback<F>(&mut self, callback: F)
where F: Fn(&mut SslRef, &[u8]) -> Option<BoxGetSessionFuture> + 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.

Implementations on Foreign Types§

Source§

impl SslContextBuilderExt for SslContextBuilder

Source§

fn set_async_select_certificate_callback<F>(&mut self, callback: F)
where F: Fn(&mut ClientHello<'_>) -> Result<BoxSelectCertFuture, AsyncSelectCertError> + Send + Sync + 'static,

Source§

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

Source§

unsafe fn set_async_get_session_callback<F>(&mut self, callback: F)
where F: Fn(&mut SslRef, &[u8]) -> Option<BoxGetSessionFuture> + Send + Sync + 'static,

Implementors§