udpmux

package
v0.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 13 Imported by: 3

Documentation

Index

Constants

View Source
const ReceiveMTU = 1500

Variables

This section is empty.

Functions

This section is empty.

Types

type Candidate

type Candidate struct {
	Ufrag string
	Addr  *net.UDPAddr
}

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) Accept

func (mux *UDPMux) Accept(ctx context.Context) (Candidate, error)

func (*UDPMux) Close

func (mux *UDPMux) Close() error

Close implements ice.UDPMux

func (*UDPMux) GetConn

func (mux *UDPMux) GetConn(ufrag string, addr net.Addr) (net.PacketConn, error)

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

func (mux *UDPMux) GetListenAddresses() []net.Addr

GetListenAddresses implements ice.UDPMux

func (*UDPMux) RemoveConnByUfrag

func (mux *UDPMux) RemoveConnByUfrag(ufrag string)

func (*UDPMux) Start

func (mux *UDPMux) Start()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL