pub struct TlsParametersBuilder { /* private fields */ }
smtp-transport
only.Expand description
Builder for TlsParameters
Implementations
sourceimpl TlsParametersBuilder
impl TlsParametersBuilder
sourcepub fn add_root_certificate(self, cert: Certificate) -> Self
pub fn add_root_certificate(self, cert: Certificate) -> Self
Add a custom root certificate
Can be used to safely connect to a server using a self signed certificate, for example.
sourcepub fn dangerous_accept_invalid_hostnames(
self,
accept_invalid_hostnames: bool
) -> Self
Available on crate feature native-tls
only.
pub fn dangerous_accept_invalid_hostnames(
self,
accept_invalid_hostnames: bool
) -> Self
native-tls
only.Controls whether certificates with an invalid hostname are accepted
Defaults to false
.
Warning
You should think very carefully before using this method. If hostname verification is disabled any valid certificate, including those from other sites, are trusted.
This method introduces significant vulnerabilities to man-in-the-middle attacks.
Hostname verification can only be disabled with the native-tls
TLS backend.
sourcepub fn dangerous_accept_invalid_certs(self, accept_invalid_certs: bool) -> Self
pub fn dangerous_accept_invalid_certs(self, accept_invalid_certs: bool) -> Self
Controls whether invalid certificates are accepted
Defaults to false
.
Warning
You should think very carefully before using this method. If certificate verification is disabled, any certificate is trusted for use, including:
- Self signed certificates
- Certificates from different hostnames
- Expired certificates
This method should only be used as a last resort, as it introduces significant vulnerabilities to man-in-the-middle attacks.
sourcepub fn build(self) -> Result<TlsParameters, Error>
Available on crate features native-tls
or rustls-tls
only.
pub fn build(self) -> Result<TlsParameters, Error>
native-tls
or rustls-tls
only.Creates a new TlsParameters
using native-tls or rustls
depending on which one is available
sourcepub fn build_native(self) -> Result<TlsParameters, Error>
Available on crate feature native-tls
only.
pub fn build_native(self) -> Result<TlsParameters, Error>
native-tls
only.Creates a new TlsParameters
using native-tls with the provided configuration
sourcepub fn build_rustls(self) -> Result<TlsParameters, Error>
Available on crate feature rustls-tls
only.
pub fn build_rustls(self) -> Result<TlsParameters, Error>
rustls-tls
only.Creates a new TlsParameters
using rustls with the provided configuration
Trait Implementations
sourceimpl Clone for TlsParametersBuilder
impl Clone for TlsParametersBuilder
sourcefn clone(&self) -> TlsParametersBuilder
fn clone(&self) -> TlsParametersBuilder
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for TlsParametersBuilder
impl Send for TlsParametersBuilder
impl Sync for TlsParametersBuilder
impl Unpin for TlsParametersBuilder
impl UnwindSafe for TlsParametersBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more