pub struct ClientTLSConfigBuilder { /* private fields */ }Expand description
A TLS client configuration builder.
Exposes various options for configuring a client’s TLS configuration that would otherwise be cumbersome to configure, and provides sane defaults for many common options.
§Missing
- ability to configure client authentication
Implementations§
Source§impl ClientTLSConfigBuilder
impl ClientTLSConfigBuilder
pub fn new() -> Self
Sourcepub fn with_max_tls12_resumption_sessions(self, max: usize) -> Self
pub fn with_max_tls12_resumption_sessions(self, max: usize) -> Self
Sets the maximum number of TLS 1.2 sessions to cache.
Defaults to 8.
Sourcepub fn with_root_cert_store(self, store: RootCertStore) -> Self
pub fn with_root_cert_store(self, store: RootCertStore) -> Self
Sets the root certificate store to use for the client.
Defaults to the “default” root certificate store initialized from the platform. (See load_platform_root_certificates.)
Sourcepub fn danger_accept_invalid_certs(self) -> Self
pub fn danger_accept_invalid_certs(self) -> Self
Disables server certificate verification entirely.
This is inherently insecure and should only be used for local/development connections where the server’s identity is already established through other means (e.g. connecting via Unix domain socket to a local process).
Sourcepub fn build(self) -> Result<ClientConfig, GenericError>
pub fn build(self) -> Result<ClientConfig, GenericError>
Builds the client TLS configuration.
§Errors
If the default root cert store (see load_platform_root_certificates) has not been initialized, and a root
cert store has not been provided, or if the resulting configuration is not FIPS compliant, an error will be
returned.