Skip to main content

TlsConnectorBuilder

Trait TlsConnectorBuilder 

Source
pub trait TlsConnectorBuilder:
    Sized
    + Sync
    + Send
    + 'static {
    type Connector: TlsConnector;
    type Underlying;

    // Required methods
    fn underlying_mut(&mut self) -> &mut Self::Underlying;
    fn set_alpn_protocols(&mut self, protocols: &[&[u8]]) -> Result<()>;
    fn set_verify_hostname(&mut self, verify: bool) -> Result<()>;
    fn add_root_certificate(&mut self, cert: &[u8]) -> Result<()>;
    fn build(self) -> Result<Self::Connector>;
}
Expand description

A builder for TlsConnectors.

Required Associated Types§

Source

type Connector: TlsConnector

Result of connector to be build.

Source

type Underlying

Type of the underlying builder.

In the world of HKT this would be:

type TlsStream<S: TlsStreamDyn> : TlsStreamWithSocketDyn<S>;

Note each implementation has accept_impl function which returns more specific type, providing both access to implementation details and the underlying socket.

Required Methods§

Source

fn underlying_mut(&mut self) -> &mut Self::Underlying

Get the underlying builder.

API intentionally exposes the underlying acceptor builder to allow fine tuning not possible in common API.

Source

fn set_alpn_protocols(&mut self, protocols: &[&[u8]]) -> Result<()>

Set ALPN-protocols to negotiate.

This operations fails is not TlsConnector::SUPPORTS_ALPN.

Source

fn set_verify_hostname(&mut self, verify: bool) -> Result<()>

Should hostname verification be performed? Use carefully, it opens the door to MITM attacks.

Source

fn add_root_certificate(&mut self, cert: &[u8]) -> Result<()>

Add trusted root certificate. By default connector supports only global trusted root.

Param is DER-encoded X.509 certificate.

Source

fn build(self) -> Result<Self::Connector>

Finish the acceptor construction.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§