Struct TlsConnectorBuilder
pub struct TlsConnectorBuilder { /* private fields */ }tls only.Expand description
A builder for TlsConnectors.
You can get one from TlsConnector::builder()
Implementations§
§impl TlsConnectorBuilder
impl TlsConnectorBuilder
pub fn identity(&mut self, identity: Identity) -> &mut TlsConnectorBuilder
pub fn identity(&mut self, identity: Identity) -> &mut TlsConnectorBuilder
Sets the identity to be used for client certificate authentication.
pub fn min_protocol_version(
&mut self,
protocol: Option<Protocol>,
) -> &mut TlsConnectorBuilder
pub fn min_protocol_version( &mut self, protocol: Option<Protocol>, ) -> &mut TlsConnectorBuilder
Sets the minimum supported protocol version.
A value of None enables support for the oldest protocols supported by the implementation.
Defaults to Some(Protocol::Tlsv10).
pub fn max_protocol_version(
&mut self,
protocol: Option<Protocol>,
) -> &mut TlsConnectorBuilder
pub fn max_protocol_version( &mut self, protocol: Option<Protocol>, ) -> &mut TlsConnectorBuilder
Sets the maximum supported protocol version.
A value of None enables support for the newest protocols supported by the implementation.
Defaults to None.
pub fn add_root_certificate(
&mut self,
cert: Certificate,
) -> &mut TlsConnectorBuilder
pub fn add_root_certificate( &mut self, cert: Certificate, ) -> &mut TlsConnectorBuilder
Adds a certificate to the set of roots that the connector will trust.
The connector will use the system’s trust root by default. This method can be used to add to that set when communicating with servers not trusted by the system.
Defaults to an empty set.
pub fn disable_built_in_roots(
&mut self,
disable: bool,
) -> &mut TlsConnectorBuilder
pub fn disable_built_in_roots( &mut self, disable: bool, ) -> &mut TlsConnectorBuilder
Controls the use of built-in system certificates during certificate validation.
Defaults to false – built-in system certs will be used.
pub fn request_alpns(&mut self, protocols: &[&str]) -> &mut TlsConnectorBuilder
Available on crate feature alpn only.
pub fn request_alpns(&mut self, protocols: &[&str]) -> &mut TlsConnectorBuilder
alpn only.Request specific protocols through ALPN (Application-Layer Protocol Negotiation).
Defaults to no protocols.
pub fn danger_accept_invalid_certs(
&mut self,
accept_invalid_certs: bool,
) -> &mut TlsConnectorBuilder
pub fn danger_accept_invalid_certs( &mut self, accept_invalid_certs: bool, ) -> &mut TlsConnectorBuilder
Controls the use of certificate validation.
Defaults to false.
§Warning
You should think very carefully before using this method. If invalid certificates are trusted, any certificate for any site will be trusted for use. This includes expired certificates. This introduces significant vulnerabilities, and should only be used as a last resort.
pub fn use_sni(&mut self, use_sni: bool) -> &mut TlsConnectorBuilder
pub fn use_sni(&mut self, use_sni: bool) -> &mut TlsConnectorBuilder
Controls the use of Server Name Indication (SNI).
Defaults to true.
pub fn danger_accept_invalid_hostnames(
&mut self,
accept_invalid_hostnames: bool,
) -> &mut TlsConnectorBuilder
pub fn danger_accept_invalid_hostnames( &mut self, accept_invalid_hostnames: bool, ) -> &mut TlsConnectorBuilder
Controls the use of hostname verification.
Defaults to false.
§Warning
You should think very carefully before using this method. If invalid hostnames are trusted, any valid certificate for any site will be trusted for use. This introduces significant vulnerabilities, and should only be used as a last resort.
pub fn build(&self) -> Result<TlsConnector, Error>
pub fn build(&self) -> Result<TlsConnector, Error>
Creates a new TlsConnector.
Auto Trait Implementations§
impl Freeze for TlsConnectorBuilder
impl RefUnwindSafe for TlsConnectorBuilder
impl Send for TlsConnectorBuilder
impl Sync for TlsConnectorBuilder
impl Unpin for TlsConnectorBuilder
impl UnwindSafe for TlsConnectorBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more