#[non_exhaustive]pub enum TlsPolicy {
Disable,
Prefer,
Require,
VerifyCa {
root_cert: Option<PathBuf>,
},
VerifyFull {
root_cert: Option<PathBuf>,
},
}Expand description
How a connection is secured. A typed setting, not a sslmode= string someone has to remember.
The policy given to PgBackend::connect_with (or MysqlBackend::connect_with) overrides whatever sslmode the connection
string carries, so a URL cannot weaken it. The default is TlsPolicy::Require: encryption is
on unless a program says otherwise in code.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Disable
No TLS. For a loopback or socket connection in a test; never over a network.
Prefer
TLS if the server offers it, plain otherwise (sqlx’s default). A downgrade is silent: an attacker who strips the offer gets a plain connection.
Require
TLS, or fail. The certificate is not checked, so this stops eavesdropping but not an impostor server.
VerifyCa
TLS, and the server’s certificate must chain to a trusted root (root_cert, or the
built-in web roots if None). The host name is not checked.
VerifyFull
As VerifyCa, and the certificate must also name the host connected to.
Trait Implementations§
impl Eq for TlsPolicy
impl StructuralPartialEq for TlsPolicy
Auto Trait Implementations§
impl Freeze for TlsPolicy
impl RefUnwindSafe for TlsPolicy
impl Send for TlsPolicy
impl Sync for TlsPolicy
impl Unpin for TlsPolicy
impl UnsafeUnpin for TlsPolicy
impl UnwindSafe for TlsPolicy
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> 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