Struct StartTlsState
pub struct StartTlsState { /* private fields */ }Expand description
Host-owned STARTTLS transition guard for one connection.
The downgrade this closes is the classic one: a negotiation that fails to upgrade, and an adapter that carries on in the clear because the connection is technically still usable. Once an upgrade begins, plaintext I/O is over whether or not the handshake succeeds.
Implementations§
Source§impl StartTlsState
impl StartTlsState
Sourcepub fn phase(&self) -> StartTlsPhase
pub fn phase(&self) -> StartTlsPhase
Current authoritative connection phase.
Sourcepub fn plaintext_negotiation_allowed(&self) -> bool
pub fn plaintext_negotiation_allowed(&self) -> bool
Whether protocol-specific plaintext negotiation I/O is currently legal.
Sourcepub fn application_io_allowed(&self) -> bool
pub fn application_io_allowed(&self) -> bool
Whether authenticated/application I/O is currently legal.
Sourcepub fn begin_upgrade(&mut self) -> Result<(), EgressError>
pub fn begin_upgrade(&mut self) -> Result<(), EgressError>
Commit to an in-place TLS upgrade and permanently end plaintext I/O.
§Errors
Returns EgressError::InvalidStartTlsTransition unless negotiation is
still active.
Sourcepub fn complete_upgrade(&mut self) -> Result<(), EgressError>
pub fn complete_upgrade(&mut self) -> Result<(), EgressError>
Record a successful TLS handshake.
§Errors
Returns EgressError::InvalidStartTlsTransition unless a handshake is
in progress.
Sourcepub fn fail_upgrade(&mut self) -> Result<(), EgressError>
pub fn fail_upgrade(&mut self) -> Result<(), EgressError>
Record a failed TLS handshake. The failed phase is terminal and must result in connection closure; plaintext fallback is never permitted.
§Errors
Returns EgressError::InvalidStartTlsTransition unless a handshake is
in progress.