pub fn classify_addr(addr: IpAddr) -> HostClassExpand description
Classifies a DNS-resolved socket address into a HostClass.
The counterpart to classify_host used by crate::cache’s connect-time resolver guard
(issue #449) to close the DNS-rebinding TOCTOU gap the module docs describe: a hostname’s
resolved address, not just its string form, needs the same classification. Reuses this
module’s own private IP-classification and mapped-address-unwrapping helpers rather than
duplicating their match arms (DRY).
§Examples
use deps_core::net_policy::{HostClass, classify_addr};
let addr = "169.254.169.254".parse().unwrap();
assert_eq!(classify_addr(addr), HostClass::CloudMetadata);