refactor(beacon, osutil, upnp, netutil): only use anet on Android (#10211)
Add a wrapper that uses anet on Android, but net on other platforms. ### Purpose Fixes https://forum.syncthing.net/t/workaround-for-android-local-discovery/20403/12 ### Testing Run two Syncthing instances with Global Discovery disabled. Pair them with each other, don't hardcode their addresses, and verify they connect.
This commit is contained in:
+3
-3
@@ -10,13 +10,13 @@ import (
|
||||
"net"
|
||||
"strings"
|
||||
|
||||
"github.com/wlynxg/anet"
|
||||
"github.com/syncthing/syncthing/lib/netutil"
|
||||
)
|
||||
|
||||
// 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 := anet.Interfaces()
|
||||
intfs, err := netutil.Interfaces()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -33,7 +33,7 @@ func GetInterfaceAddrs(includePtP bool) ([]*net.IPNet, error) {
|
||||
// which, for our purposes, do not qualify as LANs.
|
||||
continue
|
||||
}
|
||||
intfAddrs, err := anet.InterfaceAddrsByInterface(&intf)
|
||||
intfAddrs, err := netutil.InterfaceAddrsByInterface(&intf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user