diff --git a/udp_mux.go b/udp_mux.go index f93a546..a477ead 100644 --- a/udp_mux.go +++ b/udp_mux.go @@ -365,12 +365,19 @@ func (m *UDPMuxDefault) connWorker() { //nolint:gocognit var destinationConn *udpMuxedConn m.addressMapMu.Lock() if conns, ok := m.addressMap[addr.String()]; ok { - destinationConn = conns[ipAddr(localHost.String())] + if localHost.IsUnspecified() { + for _, c := range conns { + destinationConn = c + break + } + } else { + destinationConn = conns[ipAddr(localHost.String())] + } } m.addressMapMu.Unlock() // If we haven't seen this address before but is a STUN packet lookup by ufrag - if destinationConn == nil && stun.IsMessage(buf[:n]) { + if destinationConn == nil && stun.IsMessage(buf[:n]) && !localHost.IsUnspecified() { msg := &stun.Message{ Raw: append([]byte{}, buf[:n]...), } diff --git a/udpmsghelper.go b/udpmsghelper.go index b5b95d5..51efa36 100644 --- a/udpmsghelper.go +++ b/udpmsghelper.go @@ -1,4 +1,4 @@ -//go:build !js +//go:build !js && !windows package ice diff --git a/udpmsghelper_js.go b/udpmsghelper_js_win.go similarity index 92% rename from udpmsghelper_js.go rename to udpmsghelper_js_win.go index e55911a..51c990a 100644 --- a/udpmsghelper_js.go +++ b/udpmsghelper_js_win.go @@ -1,4 +1,4 @@ -//go:build js +//go:build js || windows package ice