Skip to main content

TlsStreamInfo

Trait TlsStreamInfo 

Source
pub trait TlsStreamInfo {
    // Provided method
    fn connection_info(&self) -> Option<&ConnectionInfo> { ... }
}
Expand description

Trait for TLS streams that can expose post-handshake connection metadata.

Implementors may override Self::connection_info to return a reference to the ConnectionInfo populated after the handshake completes. The default implementation returns None, which is appropriate for stream wrappers that do not have access to connection metadata (e.g. transparent proxies).

§Example

use oxitls_core::{ConnectionInfo, TlsStreamInfo};

struct MyStream {
    info: ConnectionInfo,
}

impl TlsStreamInfo for MyStream {
    fn connection_info(&self) -> Option<&ConnectionInfo> {
        Some(&self.info)
    }
}

Provided Methods§

Source

fn connection_info(&self) -> Option<&ConnectionInfo>

Return the ConnectionInfo for this stream, if available.

Returns None until the TLS handshake has completed, or for streams that do not expose connection metadata.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§