Skip to main content

extract_axum_socket_address

Function extract_axum_socket_address 

Source
pub fn extract_axum_socket_address<B>(
    request: &Request<B>,
) -> Option<SocketAddr>
Expand description

Extract the Axum transport peer stored in a request extension.

This reads axum::extract::ConnectInfo<SocketAddr> inserted by Router::into_make_service_with_connect_info or explicitly by a test. It returns None when that extension is absent. The returned address is the socket peer; this function neither parses nor trusts forwarding Headers.