Skip to content

Commit 24e6dd2

Browse files
committed
fix: update private IP address checks
1 parent 63796cf commit 24e6dd2

2 files changed

Lines changed: 29 additions & 139 deletions

File tree

Cargo.lock

Lines changed: 27 additions & 139 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/http-backend/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ fn is_private_ip(ip: &IpAddr) -> bool {
527527
}
528528

529529
/// Check if an IPv4 address is private
530+
/// This is a a copu of std::net::Ipv4Addr::is_global with inverted logic and some additions
530531
fn is_private_ipv4(ip: &Ipv4Addr) -> bool {
531532
ip.octets()[0] == 0 // "This network"
532533
|| ip.is_private()
@@ -541,6 +542,7 @@ fn is_private_ipv4(ip: &Ipv4Addr) -> bool {
541542
}
542543

543544
/// Check if an IPv6 address is private
545+
/// This is a a copu of std::net::Ipv6Addr::is_global with inverted logic and some additions
544546
fn is_private_ipv6(ip: &Ipv6Addr) -> bool {
545547
ip.is_unspecified()
546548
|| ip.is_loopback()

0 commit comments

Comments
 (0)