pub struct TlsConfig {
pub required: bool,
pub ca_file: Option<String>,
pub cert_file: Option<String>,
pub key_file: Option<String>,
pub cert_password: Option<String>,
pub accept_invalid_certs: bool,
}Expand description
TLS configuration for secure connections.
Configures Transport Layer Security (TLS/SSL) for encrypted communication. Supports both client certificate (mutual TLS) and server certificate validation.
§Examples
use mq_bridge::models::TlsConfig;
let tls = TlsConfig {
required: true,
ca_file: Some("/path/to/ca.pem".to_string()),
cert_file: Some("/path/to/cert.pem".to_string()),
key_file: Some("/path/to/key.pem".to_string()),
..Default::default()
};Fields§
§required: boolIf true, enable TLS/SSL.
ca_file: Option<String>Path to the CA certificate file.
cert_file: Option<String>Path to the client certificate file (PEM).
key_file: Option<String>Path to the client private key file (PEM).
cert_password: Option<String>Password for the private key (if encrypted).
accept_invalid_certs: boolIf true, disable server certificate verification (insecure).
Implementations§
Source§impl TlsConfig
impl TlsConfig
pub fn with_ca_file(self, ca_file: impl Into<String>) -> Self
pub fn with_client_cert( self, cert_file: impl Into<String>, key_file: impl Into<String>, ) -> Self
pub fn with_insecure(self, accept_invalid_certs: bool) -> Self
Sourcepub fn is_mtls_client_configured(&self) -> bool
pub fn is_mtls_client_configured(&self) -> bool
Checks if mutual TLS (mTLS) client authentication is configured.
Sourcepub fn is_tls_server_configured(&self) -> bool
pub fn is_tls_server_configured(&self) -> bool
Checks if TLS server certificate authentication is configured.
Sourcepub fn is_tls_client_configured(&self) -> bool
pub fn is_tls_client_configured(&self) -> bool
Checks if the TLS configuration is sufficient to make a TLS client connection.
Sourcepub fn normalize_url(&self, url: &str) -> String
pub fn normalize_url(&self, url: &str) -> String
Helper to normalize a URL by adding the appropriate scheme prefix (http:// or https://) if missing.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TlsConfig
impl<'de> Deserialize<'de> for TlsConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl SecretExtractor for TlsConfig
impl SecretExtractor for TlsConfig
impl Eq for TlsConfig
impl StructuralPartialEq for TlsConfig
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