Struct forwarded_header_value::ForwardedHeaderValue[][src]

pub struct ForwardedHeaderValue { /* fields omitted */ }
Expand description

This structure represents the contents of the Forwarded header

It should contain one or more ForwardedStanzas

Implementations

The number of valid stanzas in this value

This can never be empty

Get the value farthest from this system (the left-most value)

This may represent the remote client

Get the value farthest from this system (the left-most value), consuming this object

This may represent the remote client

Get the value closest to this system (the right-most value).

This is typically the only trusted value in a well-architected system.

Get the value closest to this system (the right-most value), consuming this object

This is typically the only trusted value in a well-architected system.

Iterate through all ForwardedStanzas

Return the rightmost non-empty forwarded-for IP, if one is present

Return the leftmost forwarded-for IP, if one is present

Parse the value from a Forwarded header into this structure

Example

let input = "for=1.2.3.4;by=\"[::1]:1234\"";
let value = ForwardedHeaderValue::from_forwarded(input)?;
assert_eq!(value.len(), 1);
assert_eq!(value.remotest_forwarded_for_ip(), Some("1.2.3.4".parse()?));

Parse the value from an X-Forwarded-For header into this structure

Example

let input = "1.2.3.4, 5.6.7.8";
let value = ForwardedHeaderValue::from_x_forwarded_for(input)?;
assert_eq!(value.len(), 2);
assert_eq!(value.remotest_forwarded_for_ip(), Some("1.2.3.4".parse()?));
assert_eq!(value.proximate_forwarded_for_ip(), Some("5.6.7.8".parse()?));

Trait Implementations

Formats the value using the given formatter. Read more

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.