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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -164,12 +165,12 @@ func (c *Container) isLocal() bool {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
switch url.Hostname() {
|
hostname := url.Hostname()
|
||||||
case "localhost", "127.0.0.1", "::1":
|
ip := net.ParseIP(hostname)
|
||||||
return true
|
if ip != nil {
|
||||||
default:
|
return ip.IsLoopback() || ip.IsUnspecified()
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
return hostname == "localhost"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Container) setPublicHostname() {
|
func (c *Container) setPublicHostname() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue