pub struct ClientBuilder<T>(/* private fields */);
rustls
only.Expand description
Helper to construct an Endpoint
for use with outgoing connections only.
To get one, call new_with_xxx
methods.
Implementations§
Source§impl ClientBuilder<RootCertStore>
impl ClientBuilder<RootCertStore>
Sourcepub fn new_with_empty_roots() -> Self
pub fn new_with_empty_roots() -> Self
Create a builder with an empty rustls::RootCertStore
.
Sourcepub fn new_with_native_certs() -> Result<Self>
Available on crate feature native-certs
only.
pub fn new_with_native_certs() -> Result<Self>
native-certs
only.Create a builder with rustls_native_certs
.
Sourcepub fn new_with_webpki_roots() -> Self
Available on crate feature webpki-roots
only.
pub fn new_with_webpki_roots() -> Self
webpki-roots
only.Create a builder with webpki_roots
.
Sourcepub fn with_custom_certificate(
self,
der: CertificateDer<'_>,
) -> Result<Self, Error>
pub fn with_custom_certificate( self, der: CertificateDer<'_>, ) -> Result<Self, Error>
Add a custom certificate.
Sourcepub fn with_no_crls(self) -> ClientBuilder<ClientConfig>
pub fn with_no_crls(self) -> ClientBuilder<ClientConfig>
Don’t configure revocation.
Sourcepub fn with_crls(
self,
crls: impl IntoIterator<Item = CertificateRevocationListDer<'static>>,
) -> Result<ClientBuilder<ClientConfig>, VerifierBuilderError>
pub fn with_crls( self, crls: impl IntoIterator<Item = CertificateRevocationListDer<'static>>, ) -> Result<ClientBuilder<ClientConfig>, VerifierBuilderError>
Verify the revocation state of presented client certificates against the provided certificate revocation lists (CRLs).
Source§impl ClientBuilder<ClientConfig>
impl ClientBuilder<ClientConfig>
Sourcepub fn new_with_rustls_client_config(
client_config: ClientConfig,
) -> ClientBuilder<ClientConfig>
pub fn new_with_rustls_client_config( client_config: ClientConfig, ) -> ClientBuilder<ClientConfig>
Create a builder with the provided rustls::ClientConfig
.
Sourcepub fn new_with_no_server_verification() -> ClientBuilder<ClientConfig>
pub fn new_with_no_server_verification() -> ClientBuilder<ClientConfig>
Do not verify the server’s certificate. It is vulnerable to MITM attacks, but convenient for testing.
Sourcepub fn new_with_platform_verifier() -> ClientBuilder<ClientConfig>
Available on crate feature platform-verifier
only.
pub fn new_with_platform_verifier() -> ClientBuilder<ClientConfig>
platform-verifier
only.Create a builder with rustls_platform_verifier
.
Sourcepub fn new_with_root_certificates(
roots: RootCertStore,
) -> ClientBuilder<ClientConfig>
pub fn new_with_root_certificates( roots: RootCertStore, ) -> ClientBuilder<ClientConfig>
Create a builder with the provided rustls::RootCertStore
.
Sourcepub fn new_with_webpki_verifier(
verifier: Arc<WebPkiServerVerifier>,
) -> ClientBuilder<ClientConfig>
pub fn new_with_webpki_verifier( verifier: Arc<WebPkiServerVerifier>, ) -> ClientBuilder<ClientConfig>
Create a builder with a custom rustls::client::WebPkiServerVerifier
.
Sourcepub fn with_alpn_protocols(self, protocols: &[&str]) -> Self
pub fn with_alpn_protocols(self, protocols: &[&str]) -> Self
Set the ALPN protocols to use.
Sourcepub fn with_key_log(self) -> Self
pub fn with_key_log(self) -> Self
Logging key material to a file for debugging. The file’s name is given
by the SSLKEYLOGFILE
environment variable.
If SSLKEYLOGFILE
is not set, or such a file cannot be opened or cannot
be written, this does nothing.
Sourcepub fn build(self) -> ClientConfig
pub fn build(self) -> ClientConfig
Build a ClientConfig
.
Sourcepub async fn bind(self, addr: impl ToSocketAddrsAsync) -> Result<Endpoint>
pub async fn bind(self, addr: impl ToSocketAddrsAsync) -> Result<Endpoint>
Create a new Endpoint
.
See Endpoint::client
for more information.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for ClientBuilder<T>where
T: Freeze,
impl<T> RefUnwindSafe for ClientBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for ClientBuilder<T>where
T: Send,
impl<T> Sync for ClientBuilder<T>where
T: Sync,
impl<T> Unpin for ClientBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for ClientBuilder<T>where
T: UnwindSafe,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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