pub struct ConnectionInfo {
pub client: Address,
pub server: Address,
pub request_size: i64,
pub sni_hostname: Option<String>,
pub tls: bool,
}Expand description
Network context for the current connection, passed into every Controller.
Fields§
§client: AddressClient (peer) address.
server: AddressServer (local) address.
request_size: i64Bytes allocated for reading the request.
sni_hostname: Option<String>SNI hostname sent by the client during the TLS handshake, if any.
None for plain-HTTP connections or when the client omits SNI.
tls: boolThe client connected over TLS (HTTPS, HTTP/2 over TLS, HTTP/3).
Proxies send it on as X-Forwarded-Proto (18.9.0).
Implementations§
Source§impl ConnectionInfo
impl ConnectionInfo
Sourcepub fn new(client: Address, server: Address) -> ConnectionInfo
pub fn new(client: Address, server: Address) -> ConnectionInfo
A connection from client to server; plain (not TLS), no SNI, the
default request allocation size. Set tls/sni_hostname after.
Sourcepub fn peer_addr(&self) -> Option<SocketAddr>
pub fn peer_addr(&self) -> Option<SocketAddr>
Parse the client address into a std::net::SocketAddr, if the stored
IP and port are valid. Returns None if parsing fails.
Trait Implementations§
Source§impl Clone for ConnectionInfo
impl Clone for ConnectionInfo
Source§fn clone(&self) -> ConnectionInfo
fn clone(&self) -> ConnectionInfo
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for ConnectionInfo
impl Default for ConnectionInfo
Source§fn default() -> ConnectionInfo
fn default() -> ConnectionInfo
Unknown addresses (0.0.0.0:0), no SNI, not TLS: for building one
with ..Default::default() in tests and adapters.