pub struct TlsOptionsBuilder<S: State = Empty> { /* private fields */ }Expand description
Use builder syntax to set the inputs and finish with build().
Implementations§
Source§impl<S: State> TlsOptionsBuilder<S>
impl<S: State> TlsOptionsBuilder<S>
Sourcepub fn build(self) -> TlsOptionswhere
S: IsComplete,
pub fn build(self) -> TlsOptionswhere
S: IsComplete,
Finish building and return the requested object
Sourcepub fn server_root_ca_cert(
self,
value: Vec<u8>,
) -> TlsOptionsBuilder<SetServerRootCaCert<S>>where
S::ServerRootCaCert: IsUnset,
pub fn server_root_ca_cert(
self,
value: Vec<u8>,
) -> TlsOptionsBuilder<SetServerRootCaCert<S>>where
S::ServerRootCaCert: IsUnset,
Sourcepub fn maybe_server_root_ca_cert(
self,
value: Option<Vec<u8>>,
) -> TlsOptionsBuilder<SetServerRootCaCert<S>>where
S::ServerRootCaCert: IsUnset,
pub fn maybe_server_root_ca_cert(
self,
value: Option<Vec<u8>>,
) -> TlsOptionsBuilder<SetServerRootCaCert<S>>where
S::ServerRootCaCert: IsUnset,
Sourcepub fn domain(self, value: String) -> TlsOptionsBuilder<SetDomain<S>>where
S::Domain: IsUnset,
pub fn domain(self, value: String) -> TlsOptionsBuilder<SetDomain<S>>where
S::Domain: IsUnset,
Sourcepub fn maybe_domain(
self,
value: Option<String>,
) -> TlsOptionsBuilder<SetDomain<S>>where
S::Domain: IsUnset,
pub fn maybe_domain(
self,
value: Option<String>,
) -> TlsOptionsBuilder<SetDomain<S>>where
S::Domain: IsUnset,
Sourcepub fn client_tls_options(
self,
value: ClientTlsOptions,
) -> TlsOptionsBuilder<SetClientTlsOptions<S>>where
S::ClientTlsOptions: IsUnset,
pub fn client_tls_options(
self,
value: ClientTlsOptions,
) -> TlsOptionsBuilder<SetClientTlsOptions<S>>where
S::ClientTlsOptions: IsUnset,
Optional (Some / Option setters). TLS info for the client. If specified, core will attempt to use mTLS.
Mutually exclusive with client_cert_resolver.
Setting both is an error.
Sourcepub fn maybe_client_tls_options(
self,
value: Option<ClientTlsOptions>,
) -> TlsOptionsBuilder<SetClientTlsOptions<S>>where
S::ClientTlsOptions: IsUnset,
pub fn maybe_client_tls_options(
self,
value: Option<ClientTlsOptions>,
) -> TlsOptionsBuilder<SetClientTlsOptions<S>>where
S::ClientTlsOptions: IsUnset,
Optional (Some / Option setters). TLS info for the client. If specified, core will attempt to use mTLS.
Mutually exclusive with client_cert_resolver.
Setting both is an error.
Sourcepub fn server_cert_verifier(
self,
value: Arc<dyn ServerCertVerifier>,
) -> TlsOptionsBuilder<SetServerCertVerifier<S>>where
S::ServerCertVerifier: IsUnset,
pub fn server_cert_verifier(
self,
value: Arc<dyn ServerCertVerifier>,
) -> TlsOptionsBuilder<SetServerCertVerifier<S>>where
S::ServerCertVerifier: IsUnset,
Optional (Some / Option setters).
Optional custom server certificate verifier. When set, this replaces the default
certificate verification and server_root_ca_cert is ignored.
This is useful for:
- Certificate pinning
- Custom trust-domain validation (e.g., SAN-URI extraction)
- Federated root certificate stores
§WARNING
Implementing a custom ServerCertVerifier can lead to severely insecure TLS connections
(e.g., disabling all validation or allowing man-in-the-middle attacks) if not done carefully.
Only use this if you know exactly what you are doing.
The verifier must implement ServerCertVerifier from the rustls crate.
Note that domain is still respected for the :authority header / origin override
even when a custom verifier is set.
Sourcepub fn maybe_server_cert_verifier(
self,
value: Option<Arc<dyn ServerCertVerifier>>,
) -> TlsOptionsBuilder<SetServerCertVerifier<S>>where
S::ServerCertVerifier: IsUnset,
pub fn maybe_server_cert_verifier(
self,
value: Option<Arc<dyn ServerCertVerifier>>,
) -> TlsOptionsBuilder<SetServerCertVerifier<S>>where
S::ServerCertVerifier: IsUnset,
Optional (Some / Option setters).
Optional custom server certificate verifier. When set, this replaces the default
certificate verification and server_root_ca_cert is ignored.
This is useful for:
- Certificate pinning
- Custom trust-domain validation (e.g., SAN-URI extraction)
- Federated root certificate stores
§WARNING
Implementing a custom ServerCertVerifier can lead to severely insecure TLS connections
(e.g., disabling all validation or allowing man-in-the-middle attacks) if not done carefully.
Only use this if you know exactly what you are doing.
The verifier must implement ServerCertVerifier from the rustls crate.
Note that domain is still respected for the :authority header / origin override
even when a custom verifier is set.
Auto Trait Implementations§
impl<S = Empty> !RefUnwindSafe for TlsOptionsBuilder<S>
impl<S = Empty> !UnwindSafe for TlsOptionsBuilder<S>
impl<S> Freeze for TlsOptionsBuilder<S>
impl<S> Send for TlsOptionsBuilder<S>
impl<S> Sync for TlsOptionsBuilder<S>
impl<S> Unpin for TlsOptionsBuilder<S>
impl<S> UnsafeUnpin for TlsOptionsBuilder<S>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request