refactor(docker): simplify flow of isLocal check

This commit is contained in:
yusing
2026-01-06 16:38:49 +08:00
parent 90948f7443
commit 1d1b01efd7

View File

@@ -174,11 +174,14 @@ func isLocal(c *types.Container) bool {
return false
}
hostname := url.Hostname()
if hostname == "localhost" {
return true
}
ip := net.ParseIP(hostname)
if ip != nil {
return ip.IsLoopback() || ip.IsUnspecified()
}
return hostname == "localhost"
return false
}
func setPublicHostname(c *types.Container) {