MetadataMapClientIp

Trait MetadataMapClientIp 

Source
pub trait MetadataMapClientIp {
    // Required methods
    fn get_header_value_fmt(&self, key: &str) -> MetadataValueFmt<'_>;
    fn extract_leftmost_forwarded_ip(&self) -> Option<IpAddr>;
    fn extract_rightmost_forwarded_ip(&self) -> Option<IpAddr>;
    fn extract_filtered_forwarded_ip(
        &self,
        filter: &impl Filter,
    ) -> Option<IpAddr>;
}
Expand description

MetadataMap extension trait

Required Methods§

Source

fn get_header_value_fmt(&self, key: &str) -> MetadataValueFmt<'_>

Retrieves FMT formatter for header value matching provided key

Source

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

Extracts leftmost client IP with no assumption.

Note that this is generally not reliable as your client might be behind proxy Prefer to use extract_client_ip_with by filtering out your proxies to find correct IP

Returns None if IP is not provided or obfuscated

Source

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

Extracts rightmost client IP with no assumption.

Returns None if IP is not provided or obfuscated

Source

fn extract_filtered_forwarded_ip(&self, filter: &impl Filter) -> Option<IpAddr>

Extracts client ip taking rightmost, after filtering out any IP matching filter

Returns None if IP is not provided or obfuscated

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§