@@ -799,7 +799,7 @@ func (s *lanChecker) isLAN(addr net.Addr) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lans, err := osutil.GetLans()
|
lans, err := osutil.GetInterfaceAddrs(false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.Debugln("Failed to retrieve interface IPs:", err)
|
l.Debugln("Failed to retrieve interface IPs:", err)
|
||||||
priv := ip.IsPrivate()
|
priv := ip.IsPrivate()
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ func getURLsForAllAdaptersIfUnspecified(network string, uri *url.URL) []*url.URL
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getHostPortsForAllAdapters(port int) []string {
|
func getHostPortsForAllAdapters(port int) []string {
|
||||||
nets, err := osutil.GetLans()
|
nets, err := osutil.GetInterfaceAddrs(true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Ignore failure.
|
// Ignore failure.
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
+4
-2
@@ -10,7 +10,9 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetLans() ([]*net.IPNet, error) {
|
// GetInterfaceAddrs returns the IP networks of all interfaces that are up.
|
||||||
|
// Point-to-point interfaces are exluded unless includePtP is true.
|
||||||
|
func GetInterfaceAddrs(includePtP bool) ([]*net.IPNet, error) {
|
||||||
intfs, err := net.Interfaces()
|
intfs, err := net.Interfaces()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -21,7 +23,7 @@ func GetLans() ([]*net.IPNet, error) {
|
|||||||
if intf.Flags&net.FlagRunning == 0 {
|
if intf.Flags&net.FlagRunning == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if intf.Flags&net.FlagPointToPoint != 0 {
|
if !includePtP && intf.Flags&net.FlagPointToPoint != 0 {
|
||||||
// Point-to-point interfaces are typically VPNs and similar
|
// Point-to-point interfaces are typically VPNs and similar
|
||||||
// which, for our purposes, do not qualify as LANs.
|
// which, for our purposes, do not qualify as LANs.
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user