pub struct TlsConfig {
pub enable_tls: bool,
pub generate_self_signed_certificates: bool,
pub certificate_authority_root_path: String,
pub server_certificate_path: String,
pub server_private_key_path: String,
pub client_certificate_authority_root_path: String,
pub enable_mtls: bool,
}
Fields§
§enable_tls: bool
Enables TLS encryption for network communication Default: false (disabled)
generate_self_signed_certificates: bool
Automatically generates self-signed certificates on startup Default: false (requires pre-configured certificates)
Path to Certificate Authority root certificate Default: “/etc/ssl/certs/ca.pem”
server_certificate_path: String
Server certificate chain path in PEM format Default: “./certs/server.pem”
server_private_key_path: String
Server private key path in PEM format Default: “./certs/server.key”
Client CA certificate path for mTLS authentication Default: “/etc/ssl/certs/ca.pem”
enable_mtls: bool
Enables mutual TLS (mTLS) for bidirectional authentication Default: false (server-side TLS only)
Implementations§
Source§impl TlsConfig
impl TlsConfig
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validates TLS configuration consistency and file existence
§Errors
Returns Error::InvalidConfig
when:
- mTLS is enabled without base TLS
- Required certificate files are missing
- Self-signed generation conflicts with existing paths
- Invalid certificate file permissions
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
Auto Trait Implementations§
impl Freeze for TlsConfig
impl RefUnwindSafe for TlsConfig
impl Send for TlsConfig
impl Sync for TlsConfig
impl Unpin 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