Documentation ¶
Index ¶
- Constants
- type Candidate
- type UDPMux
- func (mux *UDPMux) Accept(ctx context.Context) (Candidate, error)
- func (mux *UDPMux) Close() error
- func (mux *UDPMux) GetConn(ufrag string, addr net.Addr) (net.PacketConn, error)
- func (mux *UDPMux) GetListenAddresses() []net.Addr
- func (mux *UDPMux) RemoveConnByUfrag(ufrag string)
- func (mux *UDPMux) Start()
Constants ¶
const ReceiveMTU = 1500
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UDPMux ¶
type UDPMux struct {
// contains filtered or unexported fields
}
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.
func NewUDPMux ¶
func NewUDPMux(socket net.PacketConn) *UDPMux
func (*UDPMux) GetConn ¶
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).
func (*UDPMux) GetListenAddresses ¶
GetListenAddresses implements ice.UDPMux