From 87f8cacc87da6d2b6ee5eb714444979324ec2faa Mon Sep 17 00:00:00 2001 From: Dmitry Verkhoturov Date: Sun, 4 Aug 2024 11:42:39 +0100 Subject: [PATCH] add IPv4 link-local address to private ranges detector https://datatracker.ietf.org/doc/html/rfc3927#section-2.1, this new range is the same as fe80::/10 for IPv6. --- realip/real.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/realip/real.go b/realip/real.go index c830a10..b327553 100644 --- a/realip/real.go +++ b/realip/real.go @@ -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")},