turnroute

package
v0.1.3 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: 7 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 turnroute plans and schedules TURN egress independently of an ICE implementation.

Index

Constants

View Source
const (
	RouteStagger        = time.Second
	MaximumBackupRoutes = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Allocation

type Allocation struct {
	Address netip.AddrPort
	Discard func()
}

Allocation transfers its reservation to the transport until discard or close.

type Attempt

type Attempt func(context.Context, Route, func()) *Allocation

Attempt must release on failure; a successful allocation retains release until closed.

type Capacity

type Capacity interface {
	StartInitialRoute() (func(), bool)
	TryBackupRoute() (func(), bool)
}

Capacity separates scheduling decisions from process-wide resource accounting.

type Event

type Event struct {
	Server       string
	LocalAddress netip.Addr
	Outcome      string
}

type Gathering

type Gathering struct {
	// contains filtered or unexported fields
}

func NewGathering

func NewGathering(plan *Plan, capacity Capacity, observe func(Event)) *Gathering

func (*Gathering) Run

func (g *Gathering) Run(ctx context.Context, attempt Attempt)

func (*Gathering) Select

func (g *Gathering) Select(address netip.AddrPort)

type Plan

type Plan struct {
	// contains filtered or unexported fields
}

Plan is the immutable snapshot shared by admission and gathering.

func NewPlan

func NewPlan(relay iceconfig.Relay, addresses []netip.Addr) (*Plan, error)

func (*Plan) InitialSockets

func (p *Plan) InitialSockets() int

func (*Plan) Matches

func (p *Plan) Matches(relay iceconfig.Relay) bool

Matches prevents a reservation and gatherer from silently using different authority.

type Planner

type Planner struct {
	// contains filtered or unexported fields
}

Planner retains only proven control-transport exits for the current network. History orders optional attempts; it never delays the OS route.

func (*Planner) Plan

func (p *Planner) Plan(generation uint64, relay iceconfig.Relay, addresses []netip.Addr) (*Plan, error)

type Route

type Route struct {
	Server       string
	LocalAddress netip.Addr
}

Route names one server and an optional source-bound exit. The zero address leaves egress to the OS, preserving the fast path before backup exploration.

Jump to

Keyboard shortcuts

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