Documentation
¶
Overview ¶
Package turncapacity owns shared TURN admission and bounded handoff capacity. It accounts for reservations, independently of socket or protocol implementations.
Index ¶
Constants ¶
const ( MaximumConnections = 16 MaximumSockets = 64 MaximumPathSockets = 8 MaximumHandoffEndpoints = 2 MaximumQueuedRequests = 64 )
Variables ¶
var ( ErrCapacity = errors.New("TURN capacity exhausted") ErrReservation = errors.New("invalid TURN reservation") )
Functions ¶
This section is empty.
Types ¶
type Owner ¶
type Owner struct {
// contains filtered or unexported fields
}
Owner distinguishes local endpoints of the same protocol session sharing a pool.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool belongs to the application that injects it into its connectivity owners. Ordinary capacity is preserved during one bounded make-before-break handoff, including both endpoints when the sender and receiver share this pool.
type Request ¶
type Request struct {
ProtocolSessionID [16]byte
PeerPathID [16]byte
ReplacesPeerPathID [16]byte
Service iceconfig.Identity
Sockets int
}
Request reserves initial routes before signaling. Backup routes acquire additional slots without queueing; each closed route returns its own slot. Replaces identifies actual predecessor ownership, never an unbounded bypass.
type Reservation ¶
type Reservation struct {
// contains filtered or unexported fields
}
Reservation owns capacity through preparation, gathering and final close. Its predecessor/successor relationship transfers ordinary capacity atomically.
func (*Reservation) Claim ¶
func (r *Reservation) Claim(session, path [16]byte, service iceconfig.Identity) error
func (*Reservation) Close ¶
func (r *Reservation) Close()
func (*Reservation) SocketLimit ¶
func (r *Reservation) SocketLimit() int
func (*Reservation) StartInitialRoute ¶
func (r *Reservation) StartInitialRoute() (func(), bool)
StartInitialRoute consumes a prepaid slot without queueing behind another path.
func (*Reservation) TryBackupRoute ¶
func (r *Reservation) TryBackupRoute() (func(), bool)
TryBackupRoute yields to queued ordinary work and never borrows its capacity.