Giter Site home page Giter Site logo

Comments (5)

r1a2y3 avatar r1a2y3 commented on June 7, 2024

Hi, I haven't try to reproduce your issue. In my opinion, you try to use 2 local address but only one external IP And you want to use udp mux?? Such as local ip (192.168.10.10 / 192.168.10.20, multiplex udp port 3000, they have the same external ip. [128.29.20.30]). Maybe the extIPMapper should specify the relation 192.168.10.10->128.29.20.30, rather than set all ipv4 external ip to 128.29.20.30


By the way, I looked through issues because I found the multiudpmux can't works when the remote use multiudpmux too... Such as two sfu cascaded, but they all use one single udp port.

from ice.

m1k1o avatar m1k1o commented on June 7, 2024

Its just about how many local interfaces I have. When inside docker container, those IPs will be 127.0.0.1 and 172.18.0.10 (dynamic, cannot really specify relation) but my real external IP is 192.168.1.10.

This issue is actually generally about wrong handling any UDP duplicate candidates, if the number of them is an even number. This happens to be easily reproducible with NAT 1:1, but its not limited to only this usecase.

Should be as following:

  • 1 canidate: OK
  • 2 duplicate candidates: First added, Second overwrites first one but immediately closes and removes it, so we are left with no canidates.
  • 3 duplicate candidates: After adding and removing one, thrid one is left intact, so OK:

from ice.

r1a2y3 avatar r1a2y3 commented on June 7, 2024

Thanks @m1k1o . Got it! Maybe a temporary workaround is to limit your candidates to certain specified range that you want to avoid it. I use the below code to specify candidates now.

        // se
        se := webrtc.SettingEngine{}

        // handle candidates
        nw := vnet.NewNet(nil)
        if len(c.WebRTC.Candidates) > 0 {
                candidates := c.WebRTC.Candidates
                if ifs, err := nw.Interfaces(); err == nil {
                        for _, ifc := range ifs {
                                if addrs, err := ifc.Addrs(); err == nil {
                                        tmpIfc := vnet.NewInterface((net.Interface)(ifc.InterfaceBase))
                                        for _, c := range candidates {
                                                for _, addr := range addrs {
                                                        if strings.HasPrefix(addr.String(), c+"/") {
                                                                tmpIfc.AddAddr(addr)
                                                        }
                                                }
                                        }
                                        *ifc = *tmpIfc
                                }
                        }
                }
        }
        se.SetVNet(nw)

from ice.

cnderrauber avatar cnderrauber commented on June 7, 2024

@m1k1o You can use MultiUDPMux (NewMultiUDPMuxFromPort) to listen on multiple interfaces for udp mux, then each muxed connection is managed by corresponding UDPMux, will not be closed incorrectly

from ice.

m1k1o avatar m1k1o commented on June 7, 2024

@cnderrauber yes, that actually fixes my issue. But this makes the change backwards incompatible, although it should still work the same way but only with deprecation warning.

from ice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.