pub struct TlsClientConfig {
pub ca_cert_path: Option<PathBuf>,
pub client_cert_path: Option<PathBuf>,
pub client_key_path: Option<PathBuf>,
pub server_name: Option<String>,
pub danger_accept_invalid_certs: bool,
}Expand description
TLS configuration for client connections
Fields§
§ca_cert_path: Option<PathBuf>Path to CA certificate for server verification
client_cert_path: Option<PathBuf>Path to client certificate (for mTLS)
client_key_path: Option<PathBuf>Path to client private key (for mTLS)
server_name: Option<String>Server name for SNI (defaults to address hostname)
danger_accept_invalid_certs: boolSkip server certificate verification (dangerous, testing only)
Implementations§
Source§impl TlsClientConfig
impl TlsClientConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new TLS configuration with default settings
Uses system root certificates for server verification.
Sourcepub fn with_ca_cert(self, path: impl AsRef<Path>) -> Self
pub fn with_ca_cert(self, path: impl AsRef<Path>) -> Self
Set the CA certificate path for server verification
Sourcepub fn with_client_cert(
self,
cert_path: impl AsRef<Path>,
key_path: impl AsRef<Path>,
) -> Self
pub fn with_client_cert( self, cert_path: impl AsRef<Path>, key_path: impl AsRef<Path>, ) -> Self
Set client certificate and key for mTLS authentication
Sourcepub fn with_server_name(self, name: impl Into<String>) -> Self
pub fn with_server_name(self, name: impl Into<String>) -> Self
Set the server name for SNI
If not set, the hostname from the connection address is used.
Sourcepub fn danger_accept_invalid_certs(self) -> Self
pub fn danger_accept_invalid_certs(self) -> Self
Skip server certificate verification (DANGEROUS)
This should only be used for testing. It disables certificate verification, making the connection vulnerable to MITM attacks.
Sourcepub fn to_network_config(&self) -> TlsConfig
pub fn to_network_config(&self) -> TlsConfig
Convert to lnc-network TlsConfig
Trait Implementations§
Source§impl Clone for TlsClientConfig
impl Clone for TlsClientConfig
Source§fn clone(&self) -> TlsClientConfig
fn clone(&self) -> TlsClientConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TlsClientConfig
impl Debug for TlsClientConfig
Source§impl Default for TlsClientConfig
impl Default for TlsClientConfig
Source§fn default() -> TlsClientConfig
fn default() -> TlsClientConfig
Auto Trait Implementations§
impl Freeze for TlsClientConfig
impl RefUnwindSafe for TlsClientConfig
impl Send for TlsClientConfig
impl Sync for TlsClientConfig
impl Unpin for TlsClientConfig
impl UnwindSafe for TlsClientConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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