pub struct TlsConfig {
pub cert_path: Option<String>,
pub key_path: Option<String>,
pub ca_path: Option<String>,
pub server_name: Option<String>,
pub allow_self_signed: bool,
pub min_version: Option<String>,
pub alpn_protocols: Vec<String>,
}Expand description
TLS configuration builder
Fields§
§cert_path: Option<String>Path to certificate file (PEM format)
key_path: Option<String>Path to private key file (PEM format)
ca_path: Option<String>Path to CA certificate for verification
server_name: Option<String>Server name for SNI and verification
allow_self_signed: boolAllow self-signed certificates
min_version: Option<String>Minimum TLS version (e.g., “1.2”, “1.3”)
alpn_protocols: Vec<String>ALPN protocols to negotiate
Implementations§
Source§impl TlsConfig
impl TlsConfig
Sourcepub fn with_cert(self, cert_path: &str, key_path: &str) -> Self
pub fn with_cert(self, cert_path: &str, key_path: &str) -> Self
Configure certificate and key paths
Sourcepub fn with_server_name(self, name: &str) -> Self
pub fn with_server_name(self, name: &str) -> Self
Configure server name for SNI
Sourcepub fn allow_self_signed(self) -> Self
pub fn allow_self_signed(self) -> Self
Allow self-signed certificates
Sourcepub fn with_min_version(self, version: &str) -> Self
pub fn with_min_version(self, version: &str) -> Self
Set minimum TLS version
Sourcepub fn is_valid_client(&self) -> bool
pub fn is_valid_client(&self) -> bool
Check if this is a valid client configuration
Sourcepub fn is_valid_server(&self) -> bool
pub fn is_valid_server(&self) -> bool
Check if this is a valid server configuration
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