pub struct TlsState { /* private fields */ }Expand description
Reloadable TLS state (v0.3 #10). Wraps an ArcSwap<ServerConfig> so the
listener can swap the cert/key pair atomically on SIGHUP without dropping
any in-flight connections. Construct via TlsState::load and pass
Arc<TlsState> to both the accept loop and the SIGHUP handler.
Implementations§
Source§impl TlsState
impl TlsState
Sourcepub fn load(
cert_path: impl Into<PathBuf>,
key_path: impl Into<PathBuf>,
) -> Result<Self, Box<dyn Error + Send + Sync + 'static>>
pub fn load( cert_path: impl Into<PathBuf>, key_path: impl Into<PathBuf>, ) -> Result<Self, Box<dyn Error + Send + Sync + 'static>>
Initial load — fails on parse error.
Sourcepub fn acceptor(&self) -> TlsAcceptor
pub fn acceptor(&self) -> TlsAcceptor
Build a fresh TlsAcceptor from the current config. Cheap (one
atomic load + Arc clone). Call this once per accepted connection.
Sourcepub fn reload(&self) -> Result<(), Box<dyn Error + Send + Sync + 'static>>
pub fn reload(&self) -> Result<(), Box<dyn Error + Send + Sync + 'static>>
Re-read the cert + key from disk and atomically swap the active
config. Returns Ok(()) on success and Err(...) if the new pair
failed to parse — the previous config remains in effect either way,
so a bad reload never causes a listener outage.
Auto Trait Implementations§
impl !Freeze for TlsState
impl !RefUnwindSafe for TlsState
impl Send for TlsState
impl Sync for TlsState
impl Unpin for TlsState
impl UnsafeUnpin for TlsState
impl !UnwindSafe for TlsState
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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