Skip to content

Commit

Permalink
add IPv4 link-local address to private ranges detector
Browse files Browse the repository at this point in the history
https://datatracker.ietf.org/doc/html/rfc3927#section-2.1, this new range is the same as fe80::/10 for IPv6.
  • Loading branch information
paskal committed Aug 4, 2024
1 parent a087e36 commit 87f8cac
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions realip/real.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ type ipRange struct {
end net.IP
}

// reference: https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
var privateRanges = []ipRange{
{start: net.ParseIP("10.0.0.0"), end: net.ParseIP("10.255.255.255")},
{start: net.ParseIP("100.64.0.0"), end: net.ParseIP("100.127.255.255")},
{start: net.ParseIP("169.254.0.0"), end: net.ParseIP("169.254.255.255")},
{start: net.ParseIP("172.16.0.0"), end: net.ParseIP("172.31.255.255")},
{start: net.ParseIP("192.0.0.0"), end: net.ParseIP("192.0.0.255")},
{start: net.ParseIP("192.168.0.0"), end: net.ParseIP("192.168.255.255")},
Expand Down

0 comments on commit 87f8cac

Please sign in to comment.