Documentation ¶
Index ¶
- type FilterFn
- type ICEBind
- type UDPMuxDefault
- func (m *UDPMuxDefault) Close() error
- func (m *UDPMuxDefault) GetConn(ufrag string, addr net.Addr) (net.PacketConn, error)
- func (m *UDPMuxDefault) GetListenAddresses() []net.Addr
- func (m *UDPMuxDefault) HandleSTUNMessage(msg *stun.Message, addr net.Addr) error
- func (m *UDPMuxDefault) IsClosed() bool
- func (m *UDPMuxDefault) LocalAddr() net.Addr
- func (m *UDPMuxDefault) RemoveConnByUfrag(ufrag string)
- type UDPMuxParams
- type UniversalUDPMuxDefault
- func (m *UniversalUDPMuxDefault) GetConnForURL(ufrag string, url string, addr net.Addr) (net.PacketConn, error)
- func (m *UniversalUDPMuxDefault) GetListenAddresses() []net.Addr
- func (m *UniversalUDPMuxDefault) GetRelayedAddr(turnAddr net.Addr, deadline time.Duration) (*net.Addr, error)
- func (m *UniversalUDPMuxDefault) GetSharedConn() net.PacketConn
- func (m *UniversalUDPMuxDefault) GetXORMappedAddr(serverAddr net.Addr, deadline time.Duration) (*stun.XORMappedAddress, error)
- func (m *UniversalUDPMuxDefault) HandleSTUNMessage(msg *stun.Message, addr net.Addr) error
- func (m *UniversalUDPMuxDefault) ReadFromConn(ctx context.Context)
- type UniversalUDPMuxParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FilterFn ¶ added in v0.28.0
FilterFn is a function that filters out candidates based on the address. If it returns true, the address is to be filtered. It also returns the prefix of matching route.
type ICEBind ¶
type ICEBind struct { *wgConn.StdNetBind // contains filtered or unexported fields }
func NewICEBind ¶
func (*ICEBind) GetICEMux ¶
func (s *ICEBind) GetICEMux() (*UniversalUDPMuxDefault, error)
GetICEMux returns the ICE UDPMux that was created and used by ICEBind
type UDPMuxDefault ¶
type UDPMuxDefault struct {
// contains filtered or unexported fields
}
UDPMuxDefault is an implementation of the interface
func NewUDPMuxDefault ¶
func NewUDPMuxDefault(params UDPMuxParams) *UDPMuxDefault
NewUDPMuxDefault creates an implementation of UDPMux
func (*UDPMuxDefault) Close ¶
func (m *UDPMuxDefault) Close() error
Close the mux, no further connections could be created
func (*UDPMuxDefault) GetConn ¶
func (m *UDPMuxDefault) GetConn(ufrag string, addr net.Addr) (net.PacketConn, error)
GetConn returns a PacketConn given the connection's ufrag and network address creates the connection if an existing one can't be found
func (*UDPMuxDefault) GetListenAddresses ¶
func (m *UDPMuxDefault) GetListenAddresses() []net.Addr
GetListenAddresses returns the list of addresses that this mux is listening on
func (*UDPMuxDefault) HandleSTUNMessage ¶
func (m *UDPMuxDefault) HandleSTUNMessage(msg *stun.Message, addr net.Addr) error
HandleSTUNMessage handles STUN packets and forwards them to underlying pion/ice library
func (*UDPMuxDefault) IsClosed ¶
func (m *UDPMuxDefault) IsClosed() bool
IsClosed returns true if the mux had been closed
func (*UDPMuxDefault) LocalAddr ¶
func (m *UDPMuxDefault) LocalAddr() net.Addr
LocalAddr returns the listening address of this UDPMuxDefault
func (*UDPMuxDefault) RemoveConnByUfrag ¶
func (m *UDPMuxDefault) RemoveConnByUfrag(ufrag string)
RemoveConnByUfrag stops and removes the muxed packet connection
type UDPMuxParams ¶
type UDPMuxParams struct { Logger logging.LeveledLogger UDPConn net.PacketConn // Required for gathering local addresses // in case a un UDPConn is passed which does not // bind to a specific local address. Net transport.Net InterfaceFilter func(interfaceName string) bool }
UDPMuxParams are parameters for UDPMux.
type UniversalUDPMuxDefault ¶
type UniversalUDPMuxDefault struct { *UDPMuxDefault // contains filtered or unexported fields }
UniversalUDPMuxDefault handles STUN and TURN servers packets by wrapping the original UDPConn It then passes packets to the UDPMux that does the actual connection muxing.
func NewUniversalUDPMuxDefault ¶
func NewUniversalUDPMuxDefault(params UniversalUDPMuxParams) *UniversalUDPMuxDefault
NewUniversalUDPMuxDefault creates an implementation of UniversalUDPMux embedding UDPMux
func (*UniversalUDPMuxDefault) GetConnForURL ¶
func (m *UniversalUDPMuxDefault) GetConnForURL(ufrag string, url string, addr net.Addr) (net.PacketConn, error)
GetConnForURL add uniques to the muxed connection by concatenating ufrag and URL (e.g. STUN URL) to be able to support multiple STUN/TURN servers and return a unique connection per server.
func (*UniversalUDPMuxDefault) GetListenAddresses ¶
func (m *UniversalUDPMuxDefault) GetListenAddresses() []net.Addr
GetListenAddresses returns the listen addr of this UDP
func (*UniversalUDPMuxDefault) GetRelayedAddr ¶
func (m *UniversalUDPMuxDefault) GetRelayedAddr(turnAddr net.Addr, deadline time.Duration) (*net.Addr, error)
GetRelayedAddr creates relayed connection to the given TURN service and returns the relayed addr. Not implemented yet.
func (*UniversalUDPMuxDefault) GetSharedConn ¶ added in v0.19.0
func (m *UniversalUDPMuxDefault) GetSharedConn() net.PacketConn
GetSharedConn returns the shared udp conn
func (*UniversalUDPMuxDefault) GetXORMappedAddr ¶
func (m *UniversalUDPMuxDefault) GetXORMappedAddr(serverAddr net.Addr, deadline time.Duration) (*stun.XORMappedAddress, error)
GetXORMappedAddr returns *stun.XORMappedAddress if already present for a given STUN server. Makes a STUN binding request to discover mapped address otherwise. Blocks until the stun.XORMappedAddress has been discovered or deadline. Method is safe for concurrent use.
func (*UniversalUDPMuxDefault) HandleSTUNMessage ¶
func (m *UniversalUDPMuxDefault) HandleSTUNMessage(msg *stun.Message, addr net.Addr) error
HandleSTUNMessage discovers STUN packets that carry a XOR mapped address from a STUN server. All other STUN packets will be forwarded to the UDPMux
func (*UniversalUDPMuxDefault) ReadFromConn ¶ added in v0.19.0
func (m *UniversalUDPMuxDefault) ReadFromConn(ctx context.Context)
ReadFromConn reads from the m.params.UDPConn provided upon the creation. It expects STUN packets only, however, will just ignore other packets printing an warning message. It is a blocking method, consider running in a go routine.
type UniversalUDPMuxParams ¶
type UniversalUDPMuxParams struct { Logger logging.LeveledLogger UDPConn net.PacketConn XORMappedAddrCacheTTL time.Duration Net transport.Net FilterFn FilterFn }
UniversalUDPMuxParams are parameters for UniversalUDPMux server reflexive.