mirror of
https://github.com/henrygd/beszel.git
synced 2026-09-22 01:17:48 +02:00
fix: widen coverage of internal ip space in isInternalIP
This commit is contained in:
@@ -203,6 +203,16 @@ func isInternalURL(rawURL string) (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func isInternalIP(ip net.IP) bool {
|
||||
return ip.IsPrivate() || ip.IsLoopback() || ip.IsUnspecified()
|
||||
var cgnatNetwork = &net.IPNet{
|
||||
IP: net.IPv4(100, 64, 0, 0),
|
||||
Mask: net.CIDRMask(10, 32),
|
||||
}
|
||||
|
||||
func isInternalIP(ip net.IP) bool {
|
||||
return ip.IsPrivate() ||
|
||||
ip.IsLoopback() ||
|
||||
ip.IsUnspecified() ||
|
||||
ip.IsLinkLocalUnicast() ||
|
||||
ip.IsMulticast() ||
|
||||
cgnatNetwork.Contains(ip)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user