package allocation

Import Path
	github.com/pion/turn/v4/internal/allocation (on go.dev)

Dependency Relation
	imports 10 packages, and imported by 2 packages

Involved Source Files Package allocation contains all CRUD operations for allocations allocation_manager.go channel_bind.go errors.go five_tuple.go permission.go
Package-Level Type Names (total 8)
/* sort by: | */
Allocation is tied to a FiveTuple and relays traffic use CreateAllocation and GetAllocation to operate. Protocol Protocol RelayAddr net.Addr RelaySocket net.PacketConn TurnSocket net.PacketConn AddChannelBind adds a new ChannelBind to the allocation, it also updates the permissions needed for this ChannelBind. AddPermission adds a new permission to the allocation. Close closes the allocation. GetChannelByAddr gets the ChannelBind from this allocation by net.Addr. GetChannelByNumber gets the ChannelBind from this allocation by id. GetPermission gets the Permission from the allocation. GetResponseCache return response cache for retransmit allocation request. Refresh updates the allocations lifetime. RemoveChannelBind removes the ChannelBind from this allocation by id. RemovePermission removes the net.Addr's fingerprint from the allocation's permissions. SetResponseCache cache allocation response for retransmit allocation request. *Allocation : github.com/prometheus/common/expfmt.Closer *Allocation : io.Closer func NewAllocation(turnSocket net.PacketConn, fiveTuple *FiveTuple, log logging.LeveledLogger) *Allocation func (*Manager).CreateAllocation(fiveTuple *FiveTuple, turnSocket net.PacketConn, requestedPort int, lifetime time.Duration) (*Allocation, error) func (*Manager).GetAllocation(fiveTuple *FiveTuple) *Allocation
ChannelBind represents a TURN Channel See: https://tools.ietf.org/html/rfc5766#section-2.5 Number proto.ChannelNumber Peer net.Addr func NewChannelBind(number proto.ChannelNumber, peer net.Addr, log logging.LeveledLogger) *ChannelBind func (*Allocation).GetChannelByAddr(addr net.Addr) *ChannelBind func (*Allocation).GetChannelByNumber(number proto.ChannelNumber) *ChannelBind func (*Allocation).AddChannelBind(chanBind *ChannelBind, lifetime time.Duration) error
FiveTuple is the combination (client IP address and port, server IP address and port, and transport protocol (currently one of UDP, TCP, or TLS)) used to communicate between the client and the server. The 5-tuple uniquely identifies this communication stream. The 5-tuple also uniquely identifies the Allocation on the server. DstAddr net.Addr Protocol Protocol SrcAddr net.Addr Equal asserts if two FiveTuples are equal. Fingerprint is the identity of a FiveTuple. func NewAllocation(turnSocket net.PacketConn, fiveTuple *FiveTuple, log logging.LeveledLogger) *Allocation func (*FiveTuple).Equal(b *FiveTuple) bool func (*Manager).CreateAllocation(fiveTuple *FiveTuple, turnSocket net.PacketConn, requestedPort int, lifetime time.Duration) (*Allocation, error) func (*Manager).DeleteAllocation(fiveTuple *FiveTuple) func (*Manager).GetAllocation(fiveTuple *FiveTuple) *Allocation
FiveTupleFingerprint is a comparable representation of a FiveTuple. func (*FiveTuple).Fingerprint() (fp FiveTupleFingerprint)
Manager is used to hold active allocations. AllocationCount returns the number of existing allocations. Close closes the manager and closes all allocations it manages. CreateAllocation creates a new allocation and starts relaying. CreateReservation stores the reservation for the token+port. DeleteAllocation removes an allocation. GetAllocation fetches the allocation matching the passed FiveTuple. GetRandomEvenPort returns a random un-allocated udp4 port. GetReservation returns the port for a given reservation if it exists. GrantPermission handles permission requests by calling the permission handler callback associated with the TURN server listener socket. *Manager : github.com/prometheus/common/expfmt.Closer *Manager : io.Closer func NewManager(config ManagerConfig) (*Manager, error)
ManagerConfig a bag of config params for Manager. AllocateConn func(network string, requestedPort int) (net.Conn, net.Addr, error) AllocatePacketConn func(network string, requestedPort int) (net.PacketConn, net.Addr, error) LeveledLogger logging.LeveledLogger PermissionHandler func(sourceAddr net.Addr, peerIP net.IP) bool func NewManager(config ManagerConfig) (*Manager, error)
Permission represents a TURN permission. TURN permissions mimic the address-restricted filtering mechanism of NATs that comply with [RFC4787]. See: https://tools.ietf.org/html/rfc5766#section-2.3 Addr net.Addr func NewPermission(addr net.Addr, log logging.LeveledLogger) *Permission func (*Allocation).GetPermission(addr net.Addr) *Permission func (*Allocation).AddPermission(perms *Permission)
Protocol is an enum for relay protocol. const TCP const UDP
Package-Level Functions (total 4)
NewAllocation creates a new instance of NewAllocation.
NewChannelBind creates a new ChannelBind.
NewManager creates a new instance of Manager.
NewPermission create a new Permission.
Package-Level Constants (total 2)
Network protocols for relay.
Network protocols for relay.