turncapacity

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package turncapacity owns shared TURN admission and bounded handoff capacity. It accounts for reservations, independently of socket or protocol implementations.

Index

Constants

View Source
const (
	MaximumConnections      = 16
	MaximumSockets          = 64
	MaximumPathSockets      = 8
	MaximumHandoffEndpoints = 2
	MaximumQueuedRequests   = 64
)

Variables

View Source
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.

func (*Owner) Acquire

func (o *Owner) Acquire(ctx context.Context, request Request) (*Reservation, error)

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.

func NewPool

func NewPool() *Pool

func (*Pool) NewOwner

func (c *Pool) NewOwner() *Owner

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.

Jump to

Keyboard shortcuts

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