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) -> Self
pub fn new(client: Address, server: Address) -> Self
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
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