pub enum SslMode {
Disable,
Prefer,
Require,
VerifyCa,
VerifyFull,
}Expand description
SSL/TLS connection mode.
These modes match PostgreSQL’s sslmode connection parameter.
See PostgreSQL SSL Support
for detailed documentation.
Variants§
Disable
Never use TLS. Connection will fail if server requires TLS.
Prefer
Try TLS first, fall back to unencrypted if server doesn’t support it.
Warning: Vulnerable to downgrade attacks. Not recommended for production.
Require
Require TLS but don’t verify the server certificate.
Protects against passive eavesdropping but not active MITM attacks.
VerifyCa
Require TLS and verify the server certificate chain against trusted CAs.
Does NOT verify that the certificate hostname matches the connection target.
VerifyFull
Require TLS, verify certificate chain, AND verify hostname matches.
Recommended for production. Provides full protection against MITM attacks.
Implementations§
Source§impl SslMode
impl SslMode
Sourcepub fn requires_tls(&self) -> bool
pub fn requires_tls(&self) -> bool
Returns true if this mode requires TLS (won’t fall back to plain).
Sourcepub fn verifies_certificate(&self) -> bool
pub fn verifies_certificate(&self) -> bool
Returns true if this mode verifies the certificate chain.
Sourcepub fn verifies_hostname(&self) -> bool
pub fn verifies_hostname(&self) -> bool
Returns true if this mode verifies the server hostname.
Trait Implementations§
impl Copy for SslMode
impl Eq for SslMode
impl StructuralPartialEq for SslMode
Auto Trait Implementations§
impl Freeze for SslMode
impl RefUnwindSafe for SslMode
impl Send for SslMode
impl Sync for SslMode
impl Unpin for SslMode
impl UnsafeUnpin for SslMode
impl UnwindSafe for SslMode
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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