pub fn remote_ip(headers: &HeaderMap) -> Option<IpAddr>Expand description
The client’s IP address from the CF-Connecting-IP header, for code that has the headers but no extractor.
See RemoteIp.
§Examples
use axum::http::HeaderMap;
let mut headers = HeaderMap::new();
headers.insert("cf-connecting-ip", "203.0.113.7".parse().unwrap());
assert_eq!(ocre::remote_ip(&headers).unwrap().to_string(), "203.0.113.7");
assert_eq!(ocre::remote_ip(&HeaderMap::new()), None);