Skip to main content

ForwardedClientExt

Trait ForwardedClientExt 

pub trait ForwardedClientExt: ExtensionsRef + Sealed {
    // Provided methods
    fn trusted_forwarded(&self) -> Option<&Forwarded> { ... }
    fn forwarded_client(&self) -> Option<&ForwardedElement> { ... }
    fn forwarded_client_ip(&self) -> Option<IpAddr> { ... }
    fn forwarded_client_socket_addr(&self) -> Option<SocketAddress> { ... }
    fn forwarded_client_host(&self) -> Option<&ForwardedAuthority> { ... }
    fn forwarded_client_proto(&self) -> Option<ForwardedProtocol> { ... }
    fn forwarded_client_version(&self) -> Option<ForwardedVersion> { ... }
}
Available on crate feature net only.
Expand description

The client of the Forwarded chain in these extensions, selected by their ForwardedSelectionPolicy, else the default one (the rightmost element).

A chain received from a peer the policy does not trust has no client.

Implemented for every ExtensionsRef; sealed, as it only reads what the extensions hold. Unlike ClientIp it never falls back to the connection’s peer.

Provided Methods§

fn trusted_forwarded(&self) -> Option<&Forwarded>

The chain as recorded, unless it came from a peer the policy does not trust: what may be selected from, or passed on to the next hop as this connection’s history.

fn forwarded_client(&self) -> Option<&ForwardedElement>

The element describing the client.

fn forwarded_client_ip(&self) -> Option<IpAddr>

The client’s IP, from its for node.

fn forwarded_client_socket_addr(&self) -> Option<SocketAddress>

The client’s IP and port, from its for node.

fn forwarded_client_host(&self) -> Option<&ForwardedAuthority>

The host the client asked for.

fn forwarded_client_proto(&self) -> Option<ForwardedProtocol>

The protocol the client used.

fn forwarded_client_version(&self) -> Option<ForwardedVersion>

The HTTP version the client used.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

§

impl<T> ForwardedClientExt for T
where T: ExtensionsRef + ?Sized,