pub struct TlsSetup { /* private fields */ }Expand description
TLS server setup and enforcement.
Implementations§
Source§impl TlsSetup
impl TlsSetup
Sourcepub fn new(
tls_config: Option<TlsServerConfig>,
db_tls_config: Option<DatabaseTlsConfig>,
) -> Result<Self>
pub fn new( tls_config: Option<TlsServerConfig>, db_tls_config: Option<DatabaseTlsConfig>, ) -> Result<Self>
Create new TLS setup from server configuration.
§Errors
Returns error if:
- TLS is enabled but certificate/key files cannot be read
- TLS configuration is invalid
Sourcepub const fn enforcer(&self) -> &TlsEnforcer
pub const fn enforcer(&self) -> &TlsEnforcer
Get the TLS enforcer.
Sourcepub const fn config(&self) -> &Option<TlsServerConfig>
pub const fn config(&self) -> &Option<TlsServerConfig>
Get the server TLS configuration.
Sourcepub const fn db_config(&self) -> &Option<DatabaseTlsConfig>
pub const fn db_config(&self) -> &Option<DatabaseTlsConfig>
Get the database TLS configuration.
Sourcepub fn is_tls_enabled(&self) -> bool
pub fn is_tls_enabled(&self) -> bool
Check if TLS is enabled for server.
Sourcepub fn is_mtls_required(&self) -> bool
pub fn is_mtls_required(&self) -> bool
Check if mTLS is required.
Sourcepub fn client_ca_path(&self) -> Option<&Path>
pub fn client_ca_path(&self) -> Option<&Path>
Get the client CA path (for mTLS).
Sourcepub fn postgres_ssl_mode(&self) -> &str
pub fn postgres_ssl_mode(&self) -> &str
Get PostgreSQL SSL mode for database connections.
Sourcepub fn redis_ssl_enabled(&self) -> bool
pub fn redis_ssl_enabled(&self) -> bool
Check if Redis TLS is enabled.
Sourcepub fn clickhouse_https_enabled(&self) -> bool
pub fn clickhouse_https_enabled(&self) -> bool
Check if ClickHouse HTTPS is enabled.
Sourcepub fn elasticsearch_https_enabled(&self) -> bool
pub fn elasticsearch_https_enabled(&self) -> bool
Check if Elasticsearch HTTPS is enabled.
Sourcepub fn verify_certificates(&self) -> bool
pub fn verify_certificates(&self) -> bool
Check if certificate verification is enabled for databases.
Sourcepub fn ca_bundle_path(&self) -> Option<&Path>
pub fn ca_bundle_path(&self) -> Option<&Path>
Get the CA bundle path for verifying database certificates.
Sourcepub fn apply_postgres_tls(&self, db_url: &str) -> String
pub fn apply_postgres_tls(&self, db_url: &str) -> String
Get database URL with TLS applied (for PostgreSQL).
Sourcepub fn apply_redis_tls(&self, redis_url: &str) -> String
pub fn apply_redis_tls(&self, redis_url: &str) -> String
Get Redis URL with TLS applied.
Sourcepub fn apply_clickhouse_tls(&self, ch_url: &str) -> String
pub fn apply_clickhouse_tls(&self, ch_url: &str) -> String
Get ClickHouse URL with TLS applied.
Sourcepub fn apply_elasticsearch_tls(&self, es_url: &str) -> String
pub fn apply_elasticsearch_tls(&self, es_url: &str) -> String
Get Elasticsearch URL with TLS applied.
Sourcepub fn create_rustls_config(&self) -> Result<Arc<ServerConfig>>
pub fn create_rustls_config(&self) -> Result<Arc<ServerConfig>>
Create a rustls ServerConfig for TLS.
§Errors
Returns error if:
- Certificate or key files cannot be read
- Certificate or key format is invalid
Auto Trait Implementations§
impl Freeze for TlsSetup
impl RefUnwindSafe for TlsSetup
impl Send for TlsSetup
impl Sync for TlsSetup
impl Unpin for TlsSetup
impl UnsafeUnpin for TlsSetup
impl UnwindSafe for TlsSetup
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more