pub struct ReloadableCertResolver { /* private fields */ }Expand description
A ResolvesServerCert implementation that supports atomic in-place
certificate rotation without restarting the listener (RFC 020).
§Usage
- Build with
ReloadableCertResolver::newat server startup. - Pass
Arc::clone(&resolver)to the server loop and keep one Arc inServerHandle::cert_reloader. - Call
reload_from_pathswhen the GUI applies aTlsCertFileorTlsKeyFilechange. The swap is atomic: in-progress handshakes complete with the old cert; new handshakes use the new cert.
Implementations§
Source§impl ReloadableCertResolver
impl ReloadableCertResolver
Sourcepub fn new(
certs: Vec<CertificateDer<'static>>,
key: PrivateKeyDer<'static>,
) -> Result<Self, TlsReloadError>
pub fn new( certs: Vec<CertificateDer<'static>>, key: PrivateKeyDer<'static>, ) -> Result<Self, TlsReloadError>
Create a new resolver from DER-encoded cert and key material.
Sourcepub fn reload_from_paths(
&self,
cert_path: &str,
key_path: &str,
) -> Result<(), TlsReloadError>
pub fn reload_from_paths( &self, cert_path: &str, key_path: &str, ) -> Result<(), TlsReloadError>
Reload certificates from PEM files on disk.
If loading or parsing fails, the old certificate remains active and this method returns an error describing the failure.
Trait Implementations§
Source§impl Debug for ReloadableCertResolver
impl Debug for ReloadableCertResolver
Source§impl ResolvesServerCert for ReloadableCertResolver
impl ResolvesServerCert for ReloadableCertResolver
Source§fn resolve(&self, _client_hello: ClientHello<'_>) -> Option<Arc<CertifiedKey>>
fn resolve(&self, _client_hello: ClientHello<'_>) -> Option<Arc<CertifiedKey>>
Choose a certificate chain and matching key given simplified
ClientHello information. Read more
Source§fn only_raw_public_keys(&self) -> bool
fn only_raw_public_keys(&self) -> bool
Return true when the server only supports raw public keys.
Auto Trait Implementations§
impl !Freeze for ReloadableCertResolver
impl RefUnwindSafe for ReloadableCertResolver
impl Send for ReloadableCertResolver
impl Sync for ReloadableCertResolver
impl Unpin for ReloadableCertResolver
impl UnsafeUnpin for ReloadableCertResolver
impl UnwindSafe for ReloadableCertResolver
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
Mutably borrows from an owned value. Read more