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.
TCPMux before would create one internal connection per ufrag. This could
cause remote IPv6 traffic to be dispatched to a local IPv4 handler (or
the inverse). The ice.Agent would then discard the traffic since a
candidate pair must be the same IP version.
This commit now creates two connections per ufrag. When requesting a
connection for a ufrag the user must specify if they want IPv4 or IPv6.
Relates to pion/webrtc#2125
Relates to pion/webrtc#1356
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.