check last for the address bind in lo interface.
This commit is contained in:
parent
35e7b9551f
commit
a6ab4d7b4b
@ -40,6 +40,7 @@ func Extract(addr string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var addrs []net.Addr
|
var addrs []net.Addr
|
||||||
|
var loAddrs []net.Addr
|
||||||
for _, iface := range ifaces {
|
for _, iface := range ifaces {
|
||||||
ifaceAddrs, err := iface.Addrs()
|
ifaceAddrs, err := iface.Addrs()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -47,10 +48,12 @@ func Extract(addr string) (string, error) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if iface.Flags&net.FlagLoopback != 0 {
|
if iface.Flags&net.FlagLoopback != 0 {
|
||||||
|
loAddrs = append(loAddrs, ifaceAddrs...)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
addrs = append(addrs, ifaceAddrs...)
|
addrs = append(addrs, ifaceAddrs...)
|
||||||
}
|
}
|
||||||
|
addrs = append(addrs, loAddrs...)
|
||||||
|
|
||||||
var ipAddr []byte
|
var ipAddr []byte
|
||||||
var publicIP []byte
|
var publicIP []byte
|
||||||
|
Loading…
x
Reference in New Issue
Block a user