mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-24 01:08:31 +02:00
refactor(docker): simplify flow of isLocal check
This commit is contained in:
@@ -174,11 +174,14 @@ func isLocal(c *types.Container) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
hostname := url.Hostname()
|
hostname := url.Hostname()
|
||||||
|
if hostname == "localhost" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
ip := net.ParseIP(hostname)
|
ip := net.ParseIP(hostname)
|
||||||
if ip != nil {
|
if ip != nil {
|
||||||
return ip.IsLoopback() || ip.IsUnspecified()
|
return ip.IsLoopback() || ip.IsUnspecified()
|
||||||
}
|
}
|
||||||
return hostname == "localhost"
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func setPublicHostname(c *types.Container) {
|
func setPublicHostname(c *types.Container) {
|
||||||
|
|||||||
Reference in New Issue
Block a user