mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-19 20:32:35 +02:00
fix: route autoconfiguration
This commit is contained in:
parent
1382137f20
commit
e300170c51
1 changed files with 6 additions and 5 deletions
|
@ -2,6 +2,7 @@ package docker
|
|||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -164,12 +165,12 @@ func (c *Container) isLocal() bool {
|
|||
if err != nil {
|
||||
return false
|
||||
}
|
||||
switch url.Hostname() {
|
||||
case "localhost", "127.0.0.1", "::1":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
hostname := url.Hostname()
|
||||
ip := net.ParseIP(hostname)
|
||||
if ip != nil {
|
||||
return ip.IsLoopback() || ip.IsUnspecified()
|
||||
}
|
||||
return hostname == "localhost"
|
||||
}
|
||||
|
||||
func (c *Container) setPublicHostname() {
|
||||
|
|
Loading…
Add table
Reference in a new issue