pub struct TlsConfig {
pub ca_cert_pem: Option<Vec<u8>>,
pub client_cert_pem: Option<Vec<u8>>,
pub client_key_pem: Option<Vec<u8>>,
pub skip_verify: bool,
pub domain_name: Option<String>,
}Expand description
TLS configuration for a gRPC connection.
§Examples
use dapr_durabletask::client::{ClientOptions, TlsConfig};
// Use system CA certificates (no client cert).
let opts = ClientOptions::new().with_tls(TlsConfig::default());
// Mutual TLS with a custom CA and client certificate.
let tls = TlsConfig::new()
.with_ca_cert_pem(std::fs::read("ca.pem").unwrap())
.with_client_cert_pem(
std::fs::read("client.pem").unwrap(),
std::fs::read("client.key").unwrap(),
);
let opts = ClientOptions::new().with_tls(tls);Fields§
§ca_cert_pem: Option<Vec<u8>>PEM-encoded CA certificate to use for server certificate verification.
If None, the system root CA store is used.
client_cert_pem: Option<Vec<u8>>PEM-encoded client certificate for mutual TLS. Requires client_key_pem.
client_key_pem: Option<Vec<u8>>PEM-encoded private key for the client certificate.
skip_verify: boolSkip server certificate verification. Use only in development.
domain_name: Option<String>Override the domain name used for TLS verification. Useful when the server’s certificate CN differs from the host address.
Implementations§
Source§impl TlsConfig
impl TlsConfig
Sourcepub fn with_ca_cert_pem(self, pem: Vec<u8>) -> Self
pub fn with_ca_cert_pem(self, pem: Vec<u8>) -> Self
Set a custom PEM-encoded CA certificate for server verification.
Sourcepub fn with_client_cert_pem(self, cert_pem: Vec<u8>, key_pem: Vec<u8>) -> Self
pub fn with_client_cert_pem(self, cert_pem: Vec<u8>, key_pem: Vec<u8>) -> Self
Set a PEM-encoded client certificate and private key for mutual TLS.
Sourcepub fn with_skip_verify(self) -> Self
pub fn with_skip_verify(self) -> Self
Skip server certificate verification. Use only in development.
Sourcepub fn with_domain_name(self, name: impl Into<String>) -> Self
pub fn with_domain_name(self, name: impl Into<String>) -> Self
Override the domain name used for TLS server name indication (SNI).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TlsConfig
impl RefUnwindSafe for TlsConfig
impl Send for TlsConfig
impl Sync for TlsConfig
impl Unpin for TlsConfig
impl UnsafeUnpin for TlsConfig
impl UnwindSafe for TlsConfig
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Wrap the input message
T in a tonic::Request