From f112ef34f64e0208e9c82759524c84304eb6a8cc Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Sun, 17 May 2015 16:42:26 +0100 Subject: [PATCH] Don't check interface flags on Windows --- internal/discover/discover.go | 4 +++- internal/upnp/upnp.go | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/discover/discover.go b/internal/discover/discover.go index b05acafab..dac472e1e 100644 --- a/internal/discover/discover.go +++ b/internal/discover/discover.go @@ -12,6 +12,7 @@ import ( "errors" "io" "net" + "runtime" "strconv" "time" @@ -110,7 +111,8 @@ func (d *Discoverer) startLocalIPv6Multicasts(localMCAddr string) { v6Intfs := 0 for _, intf := range intfs { - if intf.Flags&net.FlagUp == 0 || intf.Flags&net.FlagMulticast == 0 { + // Interface flags seem to always be 0 on Windows + if runtime.GOOS != "windows" && (intf.Flags&net.FlagUp == 0 || intf.Flags&net.FlagMulticast == 0) { continue } diff --git a/internal/upnp/upnp.go b/internal/upnp/upnp.go index b62a8752e..b8d9759f3 100644 --- a/internal/upnp/upnp.go +++ b/internal/upnp/upnp.go @@ -21,6 +21,7 @@ import ( "net/http" "net/url" "regexp" + "runtime" "strings" "time" @@ -129,10 +130,8 @@ func Discover(timeout time.Duration) []IGD { wg := sync.NewWaitGroup() for _, intf := range interfaces { - if intf.Flags&net.FlagUp == 0 { - continue - } - if intf.Flags&net.FlagMulticast == 0 { + // Interface flags seem to always be 0 on Windows + if runtime.GOOS != "windows" && (intf.Flags&net.FlagUp == 0 || intf.Flags&net.FlagMulticast == 0) { continue }