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
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.
pub fn iter(&self) -> ForwardedHeaderValueIterator<'_>ⓘNotable traits for ForwardedHeaderValueIterator<'a>impl<'a> Iterator for ForwardedHeaderValueIterator<'a> type Item = &'a ForwardedStanza;
pub fn iter(&self) -> ForwardedHeaderValueIterator<'_>ⓘNotable traits for ForwardedHeaderValueIterator<'a>impl<'a> Iterator for ForwardedHeaderValueIterator<'a> type Item = &'a ForwardedStanza;
impl<'a> Iterator for ForwardedHeaderValueIterator<'a> type Item = &'a ForwardedStanza;
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()?));
pub fn from_x_forwarded_for(
header_value: &str
) -> Result<Self, ForwardedHeaderValueParseError>
pub fn from_x_forwarded_for(
header_value: &str
) -> Result<Self, ForwardedHeaderValueParseError>
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()?));