refactor(docker): simplify flow of isLocal check

This commit is contained in:
yusing
2026-01-06 16:38:49 +08:00
parent 424398442b
commit a44b9e352c

View File

@@ -175,11 +175,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) {