pub struct ConnectionInfo {
pub version: Option<TlsVersion>,
pub cipher_suite: Option<CipherSuite>,
pub alpn_protocol: Option<Vec<u8>>,
pub sni: Option<String>,
pub peer_certificates: Vec<Vec<u8>>,
}Expand description
Information about a completed TLS connection.
Constructed incrementally by adapter crates after the handshake completes.
The builder pattern allows partial population (e.g. ALPN may be None if
not negotiated).
Fields§
§version: Option<TlsVersion>The negotiated TLS protocol version.
cipher_suite: Option<CipherSuite>The negotiated cipher suite.
alpn_protocol: Option<Vec<u8>>The negotiated ALPN protocol (e.g. b"h2", b"http/1.1").
sni: Option<String>The SNI (Server Name Indication) value sent by the client.
peer_certificates: Vec<Vec<u8>>DER-encoded peer certificates (leaf first), if provided.
Implementations§
Source§impl ConnectionInfo
impl ConnectionInfo
Sourcepub fn with_version(self, version: TlsVersion) -> Self
pub fn with_version(self, version: TlsVersion) -> Self
Set the negotiated TLS version.
Sourcepub fn with_cipher_suite(self, suite: CipherSuite) -> Self
pub fn with_cipher_suite(self, suite: CipherSuite) -> Self
Set the negotiated cipher suite.
Sourcepub fn with_alpn_protocol(self, proto: Vec<u8>) -> Self
pub fn with_alpn_protocol(self, proto: Vec<u8>) -> Self
Set the negotiated ALPN protocol.
Sourcepub fn with_peer_certificates(self, certs: Vec<Vec<u8>>) -> Self
pub fn with_peer_certificates(self, certs: Vec<Vec<u8>>) -> Self
Set the peer certificate chain (DER-encoded, leaf first).
Sourcepub fn alpn_protocol_str(&self) -> Option<&str>
pub fn alpn_protocol_str(&self) -> Option<&str>
The negotiated ALPN protocol as a UTF-8 string, if it is valid UTF-8.
Trait Implementations§
Source§impl Clone for ConnectionInfo
impl Clone for ConnectionInfo
Source§fn clone(&self) -> ConnectionInfo
fn clone(&self) -> ConnectionInfo
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConnectionInfo
impl Debug for ConnectionInfo
Auto Trait Implementations§
impl Freeze for ConnectionInfo
impl RefUnwindSafe for ConnectionInfo
impl Send for ConnectionInfo
impl Sync for ConnectionInfo
impl Unpin for ConnectionInfo
impl UnsafeUnpin for ConnectionInfo
impl UnwindSafe for ConnectionInfo
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