Trait tls_api::TlsConnectorBuilder
source · [−]pub trait TlsConnectorBuilder: Sized + Sync + Send + 'static {
type Connector: TlsConnector;
type Underlying;
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 TlsConnector
s.
Required Associated Types
type Connector: TlsConnector
type Connector: TlsConnector
Result of connector to be build.
type Underlying
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
fn underlying_mut(&mut self) -> &mut Self::Underlying
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.
Set ALPN-protocols to negotiate.
This operations fails is not TlsConnector::SUPPORTS_ALPN
.
fn set_verify_hostname(&mut self, verify: bool) -> Result<()>
fn set_verify_hostname(&mut self, verify: bool) -> Result<()>
Should hostname verification be performed? Use carefully, it opens the door to MITM attacks.
Add trusted root certificate. By default connector supports only global trusted root.
Param is DER-encoded X.509 certificate.