Currently, when using UDPMuxDefault with unspecified address,
the loopback address is included by default, but
agentConfig.IncludeLoopback is not respected when gathering
local candidates.
The same holds true when UDPMuxDefault is configured with a loopback
address, but agentConfig.IncludeLoopback is not explicitly set to
true.
This commit adds an extra check to gatherCandidatesLocalUDPMux()
for respecting that setting in both cases.
By default TCP candidate type priority is UDP one minus 27 (except
relay), so that UDP+srlfx priority > TCP+host priority. That priority
offset can be configured using AgentConfig.
IPv6 TCP candidates are also supported.
PR #496 added a mechanism to close connections of duplicate candidates
and avoid memory leaks. When UDPMuxDefault and NAT1To1IPs are used
together, candidates may share the same connection, and candidates may
be equal, since their IPs are overridden by the one specified in
NAT1To1IPs. When a duplicate candidate is found, its connection is
closed, making impossible to use any other candidate that shares the
same connection.
This PR fixes the issue as it prevents duplicate candidates from
creating connections and getting their connection closed.
Canceling previous gathering does not happen synchronously. If it takes
a little bit longer, it can close newly created `gatherCandidateDone`
channel. If we pass channel to the `gatherCandidates` function, it will
always close its done channel and only the latest done channel will be
available in `gatherCandidateDone`.
This change adapts pion/ice to use a new interface for most network
related operations. The interface was formerly a simple struct vnet.Net
which was originally intended to facilicate testing. By replacing it
with an interface we have greater flexibility and allow users to hook
into the networking stack by providing their own implementation of
the interface.
In #475, import low-level API (ReadMsgUDP) to determine
destination interface for packets received by UDPConn listen
at any(unspecified) address, to fix msg received by incorrect
candidate that shared same ufrags. But the api has compatibility
issues, also not reliable in some special network cases like
AWS/ECS.
So this pr revert that change, and make UDPMuxDefault not
accept Conn listen at unspecified address. Also provide a
NewMultiUDPMuxFromPort helper function to create a MultiUDPMux
to listen at all addresses.
For ice gather, it will use UDPMux's listen address to generate
canidates instead of create it from interfaces.
When machine's network interface have more than one ip address and
user don't want expose one of these ips to remote peer, interface
filter can't work in this case, so add a ip filter for that.
When we have multiple host candidates and mux to a
single port, if these candidates share a same conn
(either tcp or udp), they might read other's msg
cause ice connection cost long time or failed.
These wrappers allow a caller to provide UDPMux and TCPMux instances
to the ICE agent that represent multiple open ports. This can be
desirable in what would otherwise be single-port deployments, as it
increases the chance that one of the fixed ports will not be blocked
by a users firewall.
UDPMux before only worked with UDP4 traffic.
UDP6 traffic would simply be ignored.
This commit implements 2 connections per ufrag. When requesting a
connection for a ufrag the user must specify if they want IPv4 or IPv6.
Relates to pion/webrtc#1915
The original UDPMux only works for the HOST candidates.
UniversalUDPMux adds support for SRFLX candidates
and will later support Relay candidates.
UniversalUDPMux embeds UDPMuxDefault and
handles STUN server packets to discover XORMappedAddr
forwarding the remaining packets for muxing to UDPMuxDefault.
Enable user to implement the golang.org/x/net/proxy
dialer interface in order to have a customized dialer.
The customized dialer could be one that connect through
a corporate HTTP/HTTPS proxy.
Resolves#284
This addresses a few points issue of #245:
- Take a net.Listener instead of having global state
- Expose a net.TCPMux based API
Also, the unused closeChannel was removed from tcp_mux.go
Closes#253.
This was an especially noticable issue in an environment
where all UDP was blocked, then we waited for STUN to
timeout (5 seconds) before trying TCP/turn
Timeout check must be inside the scope of routine leak check.
Routine leak check internally has wait for routine exit which
may causes timeout error in some case.
pion/webrtc@v3 will be trickle by default, so removing
support from here. Users can easily simulate non-trickle
by setting a OnICECandidate callback.
This just reduces the amount of things we need to test/worry about.