pub struct TlsConfig {
pub cert_path: PathBuf,
pub key_path: PathBuf,
pub ca_cert_path: Option<PathBuf>,
pub require_client_cert: bool,
}Expand description
TLS configuration for the AstraeaDB server.
Fields§
§cert_path: PathBufPath to the server certificate chain (PEM format).
key_path: PathBufPath to the server private key (PEM format).
ca_cert_path: Option<PathBuf>Optional path to CA certificate for client verification. When set, enables client certificate verification.
require_client_cert: boolWhether to require a valid client certificate (mTLS). If false and ca_cert_path is set, client certs are optional but validated if present.
Implementations§
Source§impl TlsConfig
impl TlsConfig
Sourcepub fn new(cert_path: impl Into<PathBuf>, key_path: impl Into<PathBuf>) -> Self
pub fn new(cert_path: impl Into<PathBuf>, key_path: impl Into<PathBuf>) -> Self
Create a new TLS configuration for server-only TLS (no client verification).
Sourcepub fn with_mtls(
cert_path: impl Into<PathBuf>,
key_path: impl Into<PathBuf>,
ca_cert_path: impl Into<PathBuf>,
) -> Self
pub fn with_mtls( cert_path: impl Into<PathBuf>, key_path: impl Into<PathBuf>, ca_cert_path: impl Into<PathBuf>, ) -> Self
Create a new TLS configuration with mutual TLS (client certificate required).
Sourcepub fn load_server_config(&self) -> Result<ServerConfig, TlsError>
pub fn load_server_config(&self) -> Result<ServerConfig, TlsError>
Load and build a rustls ServerConfig from this configuration.
Sourcepub fn build_acceptor(&self) -> Result<TlsAcceptor, TlsError>
pub fn build_acceptor(&self) -> Result<TlsAcceptor, TlsError>
Create a TlsAcceptor from this 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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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