turncontrol

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, AGPL-3.0 Imports: 5 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 turncontrol defines session-authenticated TURN delegation messages. It contains wire values only; issuers, sockets and account policy stay outside core.

Index

Constants

View Source
const (
	Schema                    = uint64(4)
	IdentityBytes             = 16
	MaximumBodyBytes          = 8192
	MaximumTextBytes          = 1024
	MaximumIdentifierBytes    = 64
	MaximumURLs               = 8
	MaximumURLBytes           = 512
	MaximumDemandLifetime     = 120 * time.Second
	MaximumCredentialLifetime = 48 * time.Hour
)

Variables

View Source
var ErrMessage = errors.New("invalid TURN path control")

Functions

func Encode

func Encode(message Message) ([]byte, error)

Types

type Available

type Available struct {
	Authority Header
	Profiles  []string
}

Available replaces the bounded profile inventory. Its header sequence is the sender configuration revision, independent of receiver demand sequences.

func (Available) Header

func (m Available) Header() Header

type CredentialKind

type CredentialKind uint8
const (
	Fixed CredentialKind = iota + 1
	Expiring
)

type Demand

type Demand struct {
	Authority Header
	HoldFor   time.Duration
}

func (Demand) Header

func (m Demand) Header() Header

type Grant

type Grant struct {
	Authority                  Header
	PathID                     [IdentityBytes]byte
	Replaces                   [IdentityBytes]byte
	Provider, Account, Profile string
	CredentialKind             CredentialKind
	Username, Password         string
	ValidFor                   time.Duration
	URLs                       []string
}

Fixed passwords have no WindShare-enforced expiry. Expiring grants carry a remaining duration, so receiver clock skew cannot postpone replacement.

func (Grant) Header

func (m Grant) Header() Header
type Header struct {
	SessionID   [IdentityBytes]byte
	OwnerPathID [IdentityBytes]byte
	Sequence    uint64
}

type Lane

type Lane struct {
	ID    uint32
	Epoch uint32
}

Lane identifies an authenticated connection incarnation within the session. Epoch prevents a late readiness message from authorizing a later attempt.

func (Lane) Valid

func (lane Lane) Valid() bool

type Message

type Message interface {
	Header() Header
	// contains filtered or unexported methods
}

func Decode

func Decode(body []byte) (Message, error)

type Quality

type Quality struct {
	Authority         Header
	PathID            [IdentityBytes]byte
	Lane              Lane
	NetworkGeneration [IdentityBytes]byte
	SampleSequence    uint64
	ContentBytes      uint64
	BusyMilliseconds  uint64
	PendingBytes      uint64
}

Quality is a per-incarnation content measurement. Report remains the cumulative accounting observation across incarnations; neither is a command authorizing retirement. BusyMilliseconds excludes intervals without work.

func (Quality) Header

func (m Quality) Header() Header

type Ready

type Ready struct {
	Authority Header
	PathID    [IdentityBytes]byte
	Lane      Lane
}

Ready acknowledges receiver admission for one exact lane. Replays are idempotent; only matching, still-live sender admission can commit a handoff.

func (Ready) Header

func (m Ready) Header() Header

type Recover

type Recover struct {
	Authority Header
	PathID    [IdentityBytes]byte
	Reason    RecoveryReason
}

Recover requests a bounded replacement without retiring a still-usable lane. The grant authority and path ID make duplicate or stale requests harmless.

func (Recover) Header

func (m Recover) Header() Header

type RecoveryReason

type RecoveryReason uint8
const (
	AllocationStateMismatch RecoveryReason = iota + 1
	ChannelUnavailable
)

type Report

type Report struct {
	Authority   Header
	PathID      [IdentityBytes]byte
	UsefulBytes uint64
}

Report carries receiver-confirmed useful content, not a billing assertion. The cumulative counter makes retries on surviving control lanes idempotent.

func (Report) Header

func (m Report) Header() Header

type Retire

type Retire struct {
	Authority Header
	PathID    [IdentityBytes]byte
	Reason    RetireReason
}

func (Retire) Header

func (m Retire) Header() Header

type RetireReason

type RetireReason uint8
const (
	Idle RetireReason = iota + 1
	Replaced
	Expired
	BudgetExhausted
	ProviderRevoked
	Unhelpful
)

type Unavailable

type Unavailable struct {
	Authority  Header
	Profile    string
	RetryAfter time.Duration
	Reason     string
}

func (Unavailable) Header

func (m Unavailable) Header() Header

Jump to

Keyboard shortcuts

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