extract_forwarded_header

Function extract_forwarded_header 

Source
pub fn extract_forwarded_header(
    header_value: &str,
) -> impl DoubleEndedIterator<Item = IpAddr> + '_
Expand description

Get the list of ip addresses from an forwarded header

ยงExample

assert_eq!(
   vec![IpAddr::from([10, 10, 10, 10]), IpAddr::from([10, 10, 10, 20])],
   extract_forwarded_header("for=10.10.10.10, for=10.10.10.20;proto=https").collect::<Vec<_>>()
);

Note: if you need the other data provided by the forwarded header, have a look at the rfc7239 crate.