Commit Graph

19 Commits

Author SHA1 Message Date
cnderrauber
04a6027e93 Use MultiUDPMux to implement listen any address
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.
2022-10-10 20:22:30 +08:00
cnderrauber
af9281dc76 Fix udpmux not work on AWS/ECS
ECS network might not set destination address of udp packet
to local address, so we can't only rely on it to dispatch
packet.
2022-10-08 10:50:19 +08:00
cnderrauber
12148c5d62 Fix build failed on windows
Udp mux need retrieve destination address to dispatch received
packet when listen at Any address. Windows use winsock APIs to
get that, but conn.FD() is not implement for windows, so
dispatch packet to first candidate, not ideally, but it will
work for ice connectin, wasm will have same result too.
2022-09-27 15:59:29 +08:00
cnderrauber
93980395c8 Fix muxed conn shared by candidate
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.
2022-09-26 09:26:23 +08:00
Antoine Baché
cfc20992b4 Fix UDPMux memory leaks
Clients performing an early termination/cancelation
would cause `udpMuxedConn` to leak addresses
into `UDPMuxDefault`
2022-08-26 14:18:57 +02:00
Steffen Vogel
e32a520e4c Do not use newlines in logging statements
A newline is automatically added by the DefaultLeveledLogger.
The current code-base used a mix of log statements w/o endlines.
This is misleading for custom loggers.
2022-05-08 22:53:42 -04:00
Pion
16e03db8f8 Update CI configs to v0.7.2
Update lint scripts and CI configs.
2022-04-26 23:27:21 -04:00
Antoine Baché
45ff379fd3 Makes UDPMux IPv4/IPv6 aware
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
2022-03-02 19:02:34 +01:00
Sean DuBois
d5db223420 UDPMuxParams use net.PacketConn instead of UDPConn
UDPConn satisifies the net.PacketConn interface. Allows us to pass in
structures that satisfy the interface, but aren't a UDPConn
2021-10-26 14:45:21 -04:00
cgojin
1f4e18f401 Fix UDPMux logger
If no logger is passed in, it will be created.
Error running webrtc/examples/ice-single-port :
invalid memory address or nil pointer dereference
2021-04-27 14:13:03 +08:00
David Zhao
c4d5d1c670 Bypass other host candidates with UDPMux
Separate candidate gathering when UDPMux is enabled.
Only a single UDP host candidate should be generated
that points to the mux.
2021-04-25 14:07:45 -07:00
Juliusz Chroboczek
894452d0c3 Use os.IsTimeout instead of os.ErrDeadlineExceeded
This fixes compilation with Go 1.13 and 1.14.
2021-04-22 09:03:35 -07:00
Sean DuBois
e6e49f59b0 Update UDPMux to dispatch inbound packets on ufrag
If we get a packet for an address we don't know dispatch it
by ufrag still.

Resolves #357
2021-04-20 22:52:35 -07:00
Sean DuBois
b3b84a5b0a Generalize UDP and TCP Mux
Refactor UDPMux to match TCPMux patterns. The goal is to have a
collection of mux instances and no specific UDP/TCP code

Resolves #350
2021-04-20 14:38:25 -07:00
David Zhao
35f704e2e4 Fix UDPMux read/write race condition
Resolves #351
2021-04-19 18:36:38 -07:00
David Zhao
166ba31563 Improved performance of UDPMux
The previous implementation of UDPMux was dropping
packets due to channel usage in the critical write path.
2021-04-18 13:44:08 -07:00
David Zhao
cdb84a2dcf Remove print line
accidentally left in the last PR
2021-04-15 13:18:44 -07:00
David Zhao
f7b11daf96 Improve UDPMux performance
improved buffer handling and prevents channel clogging
2021-04-14 14:19:07 -07:00
David Zhao
86d69d6ce5 Single port handling via UDPMux
Allows for ICE to handle connections on a single UDP port
2021-04-12 20:42:10 -07:00