aboutsummaryrefslogtreecommitdiff
path: root/internal/netutil/netutil.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/netutil/netutil.go')
-rw-r--r--internal/netutil/netutil.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/internal/netutil/netutil.go b/internal/netutil/netutil.go
index e3b3b8cc..5059d463 100644
--- a/internal/netutil/netutil.go
+++ b/internal/netutil/netutil.go
@@ -47,8 +47,15 @@ func init() {
}
}
-// IsLocalHostname returns true if given hostname is a known local address.
-func IsLocalHostname(hostname string) bool {
+// IsLocalHostname returns true if given hostname is resolved to local network
+// address, except exempted from the allowlist.
+func IsLocalHostname(hostname string, allowlist []string) bool {
+ for _, allow := range allowlist {
+ if hostname == allow {
+ return false
+ }
+ }
+
ips, err := net.LookupIP(hostname)
if err != nil {
return true