icepolicy

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: AGPL-3.0 Imports: 13 Imported by: 1 module, 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 icepolicy owns trusted, transport-independent ICE selection policy. Construct pools only from build, deployment, or explicit local configuration.

Index

Constants

View Source
const (
	EndpointsPerProfile     = 2
	EndpointsPerWave        = 4
	MaximumCatalogEndpoints = 512
	EndpointFailureCooldown = 30 * time.Second
	ProfileSuccessAge       = 15 * time.Minute
)
View Source
const CloudflareSTUNServer = "stun:stun.cloudflare.com:3478"
View Source
const DefaultCandidateLimit = 64
View Source
const ExistingDefaultSTUNServer = "stun:stun.l.google.com:19302"
View Source
const MaximumCandidateBytes = 4096
View Source
const MaximumProfileFacts = 64
View Source
const TwilioSTUNServer = "stun:global.stun.twilio.com:3478"

Variables

View Source
var ErrConfiguration = errors.New("invalid trusted ICE endpoint configuration")

Functions

This section is empty.

Types

type AttemptICEProfile

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

AttemptICEProfile is a snapshot: accessors copy slices so a live attempt cannot change configuration when the owner's pool or observations change.

func RebindAttemptProfile

func RebindAttemptProfile(profile AttemptICEProfile, request SelectionRequest, facts GenerationFacts) AttemptICEProfile

RebindAttemptProfile rechecks an existing wave's membership against a new network generation without granting another endpoint exploration allowance.

func SelectAttemptProfile

func SelectAttemptProfile(pool ICEEndpointPool, request SelectionRequest, facts GenerationFacts) AttemptICEProfile

func (AttemptICEProfile) EndpointIDs

func (p AttemptICEProfile) EndpointIDs() []string

func (AttemptICEProfile) FailureDomains

func (p AttemptICEProfile) FailureDomains() []string

func (AttemptICEProfile) ID

func (p AttemptICEProfile) ID() string

func (AttemptICEProfile) NetworkGenerationID

func (p AttemptICEProfile) NetworkGenerationID() string

func (AttemptICEProfile) URLs

func (p AttemptICEProfile) URLs() []string

type CandidateBudget

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

func NewCandidateBudget

func NewCandidateBudget(limit int) *CandidateBudget

func (*CandidateBudget) Accept

func (b *CandidateBudget) Accept(candidate string) CandidateDecision

Accept prunes local gathering; it never validates remote signaling.

func (*CandidateBudget) AcceptMapped

func (b *CandidateBudget) AcceptMapped(candidate string) CandidateDecision

AcceptMapped requires provider provenance, not a guess from srflx SDP.

type CandidateDecision

type CandidateDecision struct {
	Accepted bool
	Reason   string
	Class    string
}

type Endpoint

type Endpoint struct {
	ID            string `json:"id"`
	URL           string `json:"url"`
	Region        string `json:"region"`
	FailureDomain string `json:"failureDomain"`
	Provider      string `json:"provider"`
	Family        string `json:"family"`
	Trust         string `json:"trust"`
	Priority      int    `json:"priority"`
	Enabled       bool   `json:"enabled"`
}

type EndpointFact

type EndpointFact struct {
	EndpointID  string
	FailedUntil time.Time
}

type FactStore

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

FactStore records only current-network runtime facts. Endpoint errors must be explicitly attributable; profile production never implies endpoint success.

func NewFactStore

func NewFactStore(generation string) *FactStore

func (*FactStore) RecordEndpointFailure

func (s *FactStore) RecordEndpointFailure(profile AttemptICEProfile, endpointID string, now time.Time) bool

func (*FactStore) RecordProfile

func (s *FactStore) RecordProfile(profile AttemptICEProfile, produced bool, delay time.Duration, now time.Time)

func (*FactStore) SetGeneration

func (s *FactStore) SetGeneration(generation string)

func (*FactStore) Snapshot

func (s *FactStore) Snapshot() GenerationFacts

type GenerationFacts

type GenerationFacts struct {
	NetworkGenerationID string
	Endpoints           []EndpointFact
	Profiles            []ProfileFact
}

type ICEEndpointPool

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

ICEEndpointPool keeps catalog entries separate from enabled trusted endpoints.

func DefaultPool

func DefaultPool() ICEEndpointPool

Provider-published endpoints are fallbacks, not mainland reachability claims.

func DirectoryPool

func DirectoryPool(directory nodedirectory.Payload) ICEEndpointPool

DirectoryPool consumes only an application's currently trusted snapshot.

func NewICEEndpointPool

func NewICEEndpointPool(entries []Endpoint) (ICEEndpointPool, error)

func ParseLocalConfiguration

func ParseLocalConfiguration(data []byte) (ICEEndpointPool, error)

ParseLocalConfiguration never resolves or contacts an endpoint.

type ProfileFact

type ProfileFact struct {
	ProfileID               string
	ServerReflexiveProduced bool
	FirstCandidateDelay     time.Duration
	EndpointIDs             []string
	ObservedAt              time.Time
}

type SelectionRequest

type SelectionRequest struct {
	NetworkGenerationID string
	WaveID              string
	Sequence            uint64
	Now                 time.Time
	UsedEndpointIDs     []string
	UsedFailureDomains  []string
	IPv4                bool
	IPv6                bool
}

Jump to

Keyboard shortcuts

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