relayplan

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: 7 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 relayplan makes bounded, deterministic relay choices from supplied facts.

Index

Constants

View Source
const (
	MaximumEndpoints           = 8
	MaximumNetworkCandidates   = 4
	TargetNetworkRegistrations = 2
	MaximumConcurrentAttempts  = 4
	ObservationAge             = 15 * time.Minute
)

Variables

View Source
var ErrConfiguration = errors.New("invalid relay plan")

Functions

func BackupIndex

func BackupIndex(primary Candidate, candidates []Candidate, policy Policy) int

Types

type Candidate

type Candidate struct {
	URL          string
	Identity     string
	Alias        string
	Zone         string
	Region       string
	Provider     string
	Operator     string
	CapacityMbps uint32
	Canary       bool
	Configured   bool
}

type Decision

type Decision struct {
	DirectoryGeneration uint64
	DirectorySerial     uint64
	NetworkGeneration   string
	ConfiguredOnly      bool
	Candidates          []string
	Filters             []Filter
}

type Filter

type Filter struct{ Endpoint, Reason string }

type Input

type Input struct {
	Configured        []string
	Directory         nodedirectory.Payload
	Observations      []Observation
	NetworkGeneration string
	Now               time.Time
	Policy            Policy
}

type Observation

type Observation struct {
	Identity          string
	NetworkGeneration string
	At                time.Time
	Admitted          bool
	Duration          time.Duration
	CooldownUntil     time.Time
}

type Observations

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

Observations retain ordering hints only, with neither a probe loop nor disk state.

func (*Observations) Record

func (store *Observations) Record(value Observation)

func (*Observations) Snapshot

func (store *Observations) Snapshot(generation string, now time.Time) []Observation

type Plan

type Plan struct {
	Configured []Candidate
	Network    []Candidate
	Policy     Policy
	Decision   Decision
}

func Build

func Build(input Input) (Plan, error)

type Policy

type Policy struct {
	ConfiguredOnly bool
	// Only measured pair coverage permits preferring two global nodes for a
	// global primary. Exit-location guesses cannot establish receiver reachability.
	GlobalPairCoversMainland bool
	Admit                    func(nodedirectory.Node) bool
}

Jump to

Keyboard shortcuts

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