pub fn parse_forwarded_ip(forwarded_value: &str) -> Option<IpAddr>Expand description
Parse the Forwarded header to get the IP
Forwarded format: Forwarded: by=<identifier>; for=<identifier><,for=<identifier>>; host=<host>; proto=<http|https>
use bios_basic::helper::request_helper::parse_forwarded_ip;
assert_eq!(parse_forwarded_ip("Forwarded: for=192.168.0.11; proto=http").unwrap().to_string(),"192.168.0.11");
assert_eq!(parse_forwarded_ip("Forwarded: for=192.168.0.9, 192.168.0.11; proto=http").unwrap().to_string(), "192.168.0.9");
assert_eq!(parse_forwarded_ip("Forwarded: proto=http; for=192.168.0.12").unwrap().to_string(), "192.168.0.12");
assert_eq!(parse_forwarded_ip("Forwarded: for=192.168.0.10").unwrap().to_string(), "192.168.0.10");
assert_eq!(parse_forwarded_ip("Forwarded: proto=http; for=192.168.0"), None);