mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 10:58:57 +00:00
Point-to-point interfaces are typically VPNs and similar which, for our purposes, do not qualify as LANs.
This commit is contained in:
parent
b70cb580c8
commit
b1ed2802fb
@ -11,21 +11,26 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func GetLans() ([]*net.IPNet, error) {
|
func GetLans() ([]*net.IPNet, error) {
|
||||||
ifs, err := net.Interfaces()
|
intfs, err := net.Interfaces()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var addrs []net.Addr
|
var addrs []net.Addr
|
||||||
|
|
||||||
for _, currentIf := range ifs {
|
for _, intf := range intfs {
|
||||||
if currentIf.Flags&net.FlagRunning == 0 {
|
if intf.Flags&net.FlagRunning == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
currentAddrs, err := currentIf.Addrs()
|
if intf.Flags&net.FlagPointToPoint != 0 {
|
||||||
|
// Point-to-point interfaces are typically VPNs and similar
|
||||||
|
// which, for our purposes, do not qualify as LANs.
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
intfAddrs, err := intf.Addrs()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
addrs = append(addrs, currentAddrs...)
|
addrs = append(addrs, intfAddrs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
nets := make([]*net.IPNet, 0, len(addrs))
|
nets := make([]*net.IPNet, 0, len(addrs))
|
||||||
|
Loading…
Reference in New Issue
Block a user