Documentation
¶
Overview ¶
Package relayplan makes bounded, deterministic relay choices from supplied facts.
Index ¶
Constants ¶
const ( MaximumEndpoints = 8 MaximumNetworkCandidates = 4 TargetNetworkRegistrations = 2 MaximumConcurrentAttempts = 4 ObservationAge = 15 * time.Minute )
const ( BulkCapacityThresholdMbps uint32 = 50 DurationBucket = 100 * time.Millisecond )
Variables ¶
var ErrConfiguration = errors.New("invalid relay plan")
Functions ¶
Types ¶
type Candidate ¶
type Candidate struct {
URL string
Identity string
Alias string
Zone string
Region string
Provider string
Operator string
ObservedDuration time.Duration
CapacityMbps uint32
Canary bool
Configured bool
CooldownUntil time.Time
ServerRetryAt time.Time
// contains filtered or unexported fields
}
func (Candidate) HistoryState ¶ added in v0.1.5
func (Candidate) ObservedHandshake ¶ added in v0.1.5
ObservedHandshake returns the recent admitted handshake duration used for ranking, reporting false when the candidate was unmeasured or last failed.
func (Candidate) WithRegistrationFailure ¶ added in v0.1.6
WithRegistrationFailure marks a candidate copy as failed so live backup arbitration within the same share applies the same ranking rule as Build.
func (Candidate) WithoutRegistrationFailure ¶ added in v0.1.6
WithoutRegistrationFailure clears a failed state once a candidate completes a registration handshake, without inventing a measured duration sample.
type CooldownReason ¶ added in v0.1.5
type CooldownReason string
const ( CooldownNone CooldownReason = "" CooldownServerBackoff CooldownReason = "server_backoff" CooldownNodeRejected CooldownReason = "node_rejected" CooldownTransportFailure CooldownReason = "transport_failure" )
type Input ¶
type Input struct {
Configured []string
Directory nodedirectory.Payload
SelectionSeed string
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
CooldownReason CooldownReason
ServerRetryAt time.Time
}
func (Observation) ActiveAt ¶ added in v0.1.5
func (o Observation) ActiveAt(now time.Time) Observation
ActiveAt projects historical deadlines into the current scheduling decision.
type Plan ¶
type Plan struct {
Configured []Candidate
Network []Candidate
Standby []Candidate
Policy Policy
Decision Decision
}
func (Plan) DirectoryCandidates ¶ added in v0.1.6
DirectoryCandidates returns every directory-sourced candidate in startup wave order (initial Network followed by canary Standby) so consumers that classify or coordinate official relays cannot overlook the standby wave.