pub struct ClientIdentity { /* private fields */ }Expand description
A client certificate and key that reload underneath a running caller.
The outbound mirror of TlsListener, and deliberately built from the same
parts. A client certificate expires on the same schedule a server one does,
so a node that could not renew without a restart would drop publishers on
rotation day — the failure the listener side already avoids.
Resolution happens per handshake through an ArcSwap, so a rotation is one
atomic store: connections already established keep the identity they
negotiated with, and the next handshake picks up the new one.
Implementations§
Source§impl ClientIdentity
impl ClientIdentity
Sourcepub fn new<O: TlsObserver>(
certificate: PathBuf,
key: PathBuf,
observer: Arc<O>,
) -> Result<Self, TlsError>
pub fn new<O: TlsObserver>( certificate: PathBuf, key: PathBuf, observer: Arc<O>, ) -> Result<Self, TlsError>
Loads the pair and starts watching for rotations.
Failing at startup is fatal, unlike failing to reload later: a node configured to present an identity it cannot read should not come up pretending it will be admitted.
Sourcepub fn resolver(&self) -> Arc<dyn ResolvesClientCert> ⓘ
pub fn resolver(&self) -> Arc<dyn ResolvesClientCert> ⓘ
The resolver a rustls client configuration should ask per handshake.
Handed out rather than a built configuration so the caller keeps ownership of its own root store and protocol versions, which are not this type’s business.