pub struct ConfTlsProfile {
pub cert: Option<PathBuf>,
pub key: Option<PathBuf>,
pub ca: Option<PathBuf>,
}Expand description
One per-DC TLS profile inside ConfPool::peer_tls_profiles.
Each profile names a PEM cert / private-key pair and an
optional CA bundle. The map’s key is the datacenter name
(matching the value an operator sets in dyn_seeds: for
peers in that DC); when a peer’s DC has no entry, the
connection falls back to the legacy peer_tls_* fields
(treated as the implicit “default” profile). When neither a
per-DC entry nor the default fields are set, the connection
is plaintext.
§Examples
use std::path::PathBuf;
use dynomite::conf::ConfTlsProfile;
let p = ConfTlsProfile {
cert: Some(PathBuf::from("/etc/dynomite/dc1.pem")),
key: Some(PathBuf::from("/etc/dynomite/dc1.key")),
ca: Some(PathBuf::from("/etc/dynomite/dc1-ca.pem")),
};
assert!(p.validate("dc1").is_ok());Fields§
§cert: Option<PathBuf>PEM certificate path. Must be set together with Self::key.
key: Option<PathBuf>PEM private-key path matching Self::cert.
ca: Option<PathBuf>Optional PEM CA bundle. When set, peer-plane connections
using this profile pin the bundle as their trust anchor
(and the listener requires inbound peers to present a
certificate signed by a CA in the bundle for mTLS). When
unset, the listener does not request a client certificate
and the outbound side falls back to the bundled
webpki_roots Mozilla anchors.
Implementations§
Source§impl ConfTlsProfile
impl ConfTlsProfile
Sourcepub fn validate(&self, dc: &str) -> Result<(), ConfError>
pub fn validate(&self, dc: &str) -> Result<(), ConfError>
Validate that the profile is internally consistent.
cert and key must both be set or both be unset; a
ca requires the cert / key pair. The dc argument is
the map key the profile lives under and is included in
any error message so an operator can identify the
offending entry.
§Errors
Returns ConfError::BadServer when the cert / key
pair is mismatched, or when ca is set without the cert
/ key pair.
§Examples
use std::path::PathBuf;
use dynomite::conf::ConfTlsProfile;
let p = ConfTlsProfile {
cert: Some(PathBuf::from("/etc/x.pem")),
key: None,
ca: None,
};
assert!(p.validate("dc1").is_err());Trait Implementations§
Source§impl Clone for ConfTlsProfile
impl Clone for ConfTlsProfile
Source§fn clone(&self) -> ConfTlsProfile
fn clone(&self) -> ConfTlsProfile
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConfTlsProfile
impl Debug for ConfTlsProfile
Source§impl Default for ConfTlsProfile
impl Default for ConfTlsProfile
Source§fn default() -> ConfTlsProfile
fn default() -> ConfTlsProfile
Source§impl<'de> Deserialize<'de> for ConfTlsProfilewhere
ConfTlsProfile: Default,
impl<'de> Deserialize<'de> for ConfTlsProfilewhere
ConfTlsProfile: Default,
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>,
Source§impl PartialEq for ConfTlsProfile
impl PartialEq for ConfTlsProfile
Source§fn eq(&self, other: &ConfTlsProfile) -> bool
fn eq(&self, other: &ConfTlsProfile) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ConfTlsProfile
impl Serialize for ConfTlsProfile
impl Eq for ConfTlsProfile
impl StructuralPartialEq for ConfTlsProfile
Auto Trait Implementations§
impl Freeze for ConfTlsProfile
impl RefUnwindSafe for ConfTlsProfile
impl Send for ConfTlsProfile
impl Sync for ConfTlsProfile
impl Unpin for ConfTlsProfile
impl UnsafeUnpin for ConfTlsProfile
impl UnwindSafe for ConfTlsProfile
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.