pub fn private_ip(ip: IpAddr) -> boolExpand description
Whether ip is an address a webhook must never reach: private, loopback, link-local, shared (CGNAT), unspecified, multicast, broadcast or reserved.
IPv4-mapped IPv6 addresses (::ffff:10.0.0.1) are checked as IPv4.
ยงExamples
use ocre::webhooks::private_ip;
assert!(private_ip("169.254.169.254".parse().unwrap()), "cloud metadata");
assert!(private_ip("::ffff:127.0.0.1".parse().unwrap()));
assert!(private_ip("fd00::1".parse().unwrap()));
assert!(!private_ip("93.184.216.34".parse().unwrap()));
assert!(!private_ip("2606:4700::1111".parse().unwrap()));