Documentation
¶
Overview ¶
Package relayset coordinates independent relay endpoint lifecycles. Each endpoint retains registration/resume authority; the set only merges ingress.
Index ¶
- Constants
- Variables
- type Admission
- type NetworkAdmissions
- type Receiver
- type ReceiverClock
- type ReceiverConfig
- type ReceiverConnection
- type ReceiverJoinFailure
- type ReceiverRecovery
- type ReceiverRecoveryObservation
- type ReceiverRecoveryOptions
- type ReceiverRecoveryPhase
- type RegistrationFailure
- type Sender
- func (s *Sender) Accept(ctx context.Context) (*relayv2.Channel, error)
- func (s *Sender) Cleanup(ctx context.Context) error
- func (s *Sender) ObserveStatus(observer func(SenderStatus))
- func (s *Sender) ReadyRelayURL() string
- func (s *Sender) Registrations() SenderRegistrations
- func (s *Sender) Status() SenderStatus
- func (s *Sender) StopRecovery()
- func (s *Sender) WaitReady(ctx context.Context) error
- func (s *Sender) Wake()
- type SenderAvailability
- type SenderEndpoint
- type SenderFactory
- type SenderRegistrations
- type SenderStatus
Constants ¶
const ( AdmissionAdmitted = "admitted" AdmissionParked = "parked" )
const ( AdmissionReasonPrimary = "primary" AdmissionReasonBackup = "backup" AdmissionReasonPermitReleased = "permit_released" AdmissionReasonTargetReached = "target_reached" AdmissionReasonBackupNotChosen = "backup_not_selected" AdmissionReasonPrimaryLost = "primary_lost" AdmissionReasonBackupLost = "backup_lost" )
const MaximumEndpoints = 8
const (
ReceiverInitialWait = 10 * time.Second
)
Variables ¶
var ( ErrReceiverWaitExpired = errors.New("receiver connection waiting deadline expired") )
var ErrConfig = errors.New("invalid sender relay set configuration")
var ErrReceiverAuthentication = errors.New("receiver relay authentication failed")
Functions ¶
This section is empty.
Types ¶
type NetworkAdmissions ¶
type NetworkAdmissions struct {
// contains filtered or unexported fields
}
NetworkAdmissions coordinates only directory candidates. Configured endpoints keep independent lifetimes, and no successful published connection is evicted.
func NewNetworkAdmissions ¶
func NewNetworkAdmissions(plan relayplan.Plan, clock senderrelay.Clock, serverRetryAt func(string) time.Time) *NetworkAdmissions
func (*NetworkAdmissions) Control ¶
func (a *NetworkAdmissions) Control(url string) senderrelay.AttemptControl
func (*NetworkAdmissions) Observe ¶
func (a *NetworkAdmissions) Observe(observer func(Admission))
type Receiver ¶
type Receiver struct {
// contains filtered or unexported fields
}
Receiver owns relay connections for one cryptographic session. Competing initial handshakes race to publish the first usable session; losers release their authority and join the winner using a fresh authenticated lane grant.
func NewReceiver ¶
func NewReceiver(ctx context.Context, config ReceiverConfig) (*Receiver, error)
func (*Receiver) AllRelaysStopped ¶ added in v0.1.5
AllRelaysStopped requires an explicit stop from every route in the link's resolved candidate set. Missing directory results and temporary failures leave open the possibility of joining the same share again.
func (*Receiver) WaitReady ¶
func (receiver *Receiver) WaitReady(ctx context.Context) (*receiversession.Runtime, ReceiverConnection, error)
type ReceiverClock ¶
type ReceiverConfig ¶
type ReceiverConfig struct {
Clock ReceiverClock
Receiver liveshare.ReceiverConfig
Dial func(context.Context, relayv2.ReceiverConfig) (ReceiverConnection, error)
DialOptions relayv2.DialOptions
Connected func(ReceiverConnection)
ResolveEndpoints func(context.Context) ([]string, error)
// contains filtered or unexported fields
}
type ReceiverConnection ¶
type ReceiverConnection interface {
Descriptor() []byte
Channel() protocolsession.FrameChannel
Endpoint() v2.RelayEndpoint
Done() <-chan struct{}
Err() error
Close() error
}
ReceiverConnection is the authority needed to attach and retire one relay lane.
func DialReceiver ¶
func DialReceiver(ctx context.Context, config relayv2.ReceiverConfig) (ReceiverConnection, error)
type ReceiverJoinFailure ¶
type ReceiverJoinFailure struct {
// contains filtered or unexported fields
}
ReceiverJoinFailure retains endpoint authority boundaries. One permanently rejected endpoint cannot veto recovery through an independently failed relay.
func (*ReceiverJoinFailure) Error ¶
func (failure *ReceiverJoinFailure) Error() string
func (*ReceiverJoinFailure) RetryEndpoints ¶
func (failure *ReceiverJoinFailure) RetryEndpoints() []string
func (*ReceiverJoinFailure) Unwrap ¶
func (failure *ReceiverJoinFailure) Unwrap() []error
type ReceiverRecovery ¶
type ReceiverRecovery struct {
// contains filtered or unexported fields
}
func NewReceiverRecovery ¶
func NewReceiverRecovery(options ReceiverRecoveryOptions) (*ReceiverRecovery, error)
func (*ReceiverRecovery) Join ¶
func (recovery *ReceiverRecovery) Join(ctx context.Context, config ReceiverConfig) (*Receiver, error)
Join has a finite default window. An explicit caller wait limit also selects how long the caller wants to wait before any usable share has been observed.
func (*ReceiverRecovery) Replace ¶
func (recovery *ReceiverRecovery) Replace(ctx context.Context, config ReceiverConfig) (*Receiver, error)
Replace waits through temporary outages until success, terminal rejection, or caller cancellation. The unchanged continuation owns the transfer and output.
type ReceiverRecoveryOptions ¶
type ReceiverRecoveryOptions struct {
Clock ReceiverClock
TimeoutContext func(context.Context, time.Duration) (context.Context, context.CancelFunc)
InitialWait time.Duration
FastWindow time.Duration
WaitTimeout time.Duration
Jitter func(time.Duration) time.Duration
Observe func(ReceiverRecoveryObservation)
}
A joined share keeps endpoint decisions and retry pressure across protocol generations. Neither a new session nor a lane attachment resets this owner.
type ReceiverRecoveryPhase ¶
type ReceiverRecoveryPhase string
const ( ReceiverRecoveryConnecting ReceiverRecoveryPhase = "connecting" ReceiverRecoveryRetrying ReceiverRecoveryPhase = "retrying" ReceiverRecoveryWaiting ReceiverRecoveryPhase = "waiting" ReceiverRecoveryConnected ReceiverRecoveryPhase = "connected" ReceiverRecoveryTerminal ReceiverRecoveryPhase = "terminal" )
type RegistrationFailure ¶
RegistrationFailure retains endpoint identity across the aggregate readiness result, so applications can recover the rejected authority without parsing text.
func (*RegistrationFailure) Error ¶
func (failure *RegistrationFailure) Error() string
func (*RegistrationFailure) Unwrap ¶
func (failure *RegistrationFailure) Unwrap() error
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
func (*Sender) ObserveStatus ¶ added in v0.1.4
func (s *Sender) ObserveStatus(observer func(SenderStatus))
func (*Sender) ReadyRelayURL ¶
func (*Sender) Registrations ¶
func (s *Sender) Registrations() SenderRegistrations
Registrations freezes what is known at publication. Pending candidates can still become useful after the first relay releases the share link.
func (*Sender) Status ¶ added in v0.1.4
func (s *Sender) Status() SenderStatus
Status reads the owner's current state even when observations were dropped.
func (*Sender) StopRecovery ¶
func (s *Sender) StopRecovery()
type SenderAvailability ¶
SenderAvailability describes only admission through relays. Existing direct transfers have independent lifetimes and must never be inferred from this count.
type SenderEndpoint ¶
type SenderFactory ¶
type SenderFactory func(context.Context, string) (SenderEndpoint, error)
type SenderRegistrations ¶
type SenderStatus ¶ added in v0.1.4
type SenderStatus struct {
Availability SenderAvailability
AuthorizationRequired bool
}