package udpmux

Import Path
	github.com/libp2p/go-libp2p/p2p/transport/webrtc/udpmux (on go.dev)

Dependency Relation
	imports 13 packages, and imported by one package

Involved Source Files The udpmux package contains the logic for multiplexing multiple WebRTC (ICE) connections over a single UDP socket. muxed_connection.go
Package-Level Type Names (total 2)
/* sort by: | */
Addr *net.UDPAddr Ufrag string func (*UDPMux).Accept(ctx context.Context) (Candidate, error)
UDPMux multiplexes multiple ICE connections over a single net.PacketConn, generally a UDP socket. The connections are indexed by (ufrag, IP address family) and by remote address from which the connection has received valid STUN/RTC packets. When a new packet is received on the underlying net.PacketConn, we first check the address map to see if there is a connection associated with the remote address: If found, we pass the packet to that connection. Otherwise, we check to see if the packet is a STUN packet. If it is, we read the ufrag from the STUN packet and use it to check if there is a connection associated with the (ufrag, IP address family) pair. If found we add the association to the address map. (*UDPMux) Accept(ctx context.Context) (Candidate, error) Close implements ice.UDPMux GetConn implements ice.UDPMux It creates a net.PacketConn for a given ufrag if an existing one cannot be found. We differentiate IPv4 and IPv6 addresses, since a remote is can be reachable at multiple different UDP addresses of the same IP address family (eg. server-reflexive addresses and peer-reflexive addresses). GetListenAddresses implements ice.UDPMux RemoveConnByUfrag removes the connection associated with the ufrag and all the addresses associated with that connection. This method is called by pion when a peerconnection is closed. (*UDPMux) Start() *UDPMux : github.com/pion/ice/v4.UDPMux *UDPMux : github.com/prometheus/common/expfmt.Closer *UDPMux : io.Closer func NewUDPMux(socket net.PacketConn) *UDPMux
Package-Level Functions (only one)
Package-Level Constants (only one)
ReceiveBufSize is the size of the buffer used to receive packets from the PacketConn. It is fine for this number to be higher than the actual path MTU as this value is not used to decide the packet size on the write path.