Documentation
¶
Overview ¶
Package senderrelay owns one relay's registration for the lifetime of a share.
Index ¶
- Constants
- Variables
- func PublicURLs(candidates []Candidate) ([]string, error)
- type Attempt
- type AttemptControl
- type AttemptPermit
- type AttemptState
- type Authorization
- type AuthorizationError
- type AuthorizationSource
- type AuthorizationState
- type Candidate
- type Clock
- type Config
- type Connection
- type Dialer
- type Endpoint
- type Lifecycle
- func (lifecycle *Lifecycle) Accept(ctx context.Context) (*relayv2.Channel, error)
- func (lifecycle *Lifecycle) Cleanup(ctx context.Context) error
- func (lifecycle *Lifecycle) CompleteObservations() relayv2.LifecycleObservationCompletion
- func (lifecycle *Lifecycle) ObserveRegistration(observer func(RegistrationState))
- func (lifecycle *Lifecycle) StopRecovery()
- func (lifecycle *Lifecycle) WaitReady(ctx context.Context) error
- func (lifecycle *Lifecycle) Wake()
- type RegistrationState
- type StaticKey
- type SystemClock
Constants ¶
const ( AuthorizationReady = serviceauthority.AdmissionReady AuthorizationPendingSetup = serviceauthority.AdmissionPendingSetup AuthorizationPendingAttribution = serviceauthority.AdmissionPendingAttribution AuthorizationExpired = serviceauthority.AdmissionExpired AuthorizationTemporaryFailure = serviceauthority.AdmissionTemporaryFailure AuthorizationDenied = serviceauthority.AdmissionDenied AuthorizationUserActionRequired = serviceauthority.AdmissionUserActionRequired )
const MaxAccessKeyBytes = 4096
Variables ¶
var ErrCandidate = errors.New("invalid sender relay candidate")
var ErrStopped = senderRelayRecoveryStoppedError{}
Functions ¶
func PublicURLs ¶
PublicURLs validates the entire publication before any candidate can register. Aliases of the same relay identity would compete for one share's ownership.
Types ¶
type AttemptControl ¶
type AttemptControl interface {
Begin(context.Context) (AttemptPermit, error)
}
AttemptControl limits individual handshakes, leaving retry clocks and resume authority with the endpoint. Waiting for capacity must not consume a dial timeout.
type AttemptPermit ¶
type AttemptPermit interface {
Admit() bool
Release()
}
type AttemptState ¶
type AttemptState uint8
const ( AttemptStarted AttemptState = iota + 1 AttemptSucceeded AttemptFailed AttemptWaiting AttemptParked AttemptStage AttemptAuthorization )
func (AttemptState) DiagnosticName ¶ added in v0.1.5
func (value AttemptState) DiagnosticName() string
DiagnosticName belongs to the source vocabulary; recorders accept new values.
type Authorization ¶
type Authorization = serviceauthority.RegistrationAuthorization
type AuthorizationError ¶
type AuthorizationError struct {
State AuthorizationState
Cause error
}
func (*AuthorizationError) Error ¶
func (err *AuthorizationError) Error() string
func (*AuthorizationError) Unwrap ¶
func (err *AuthorizationError) Unwrap() error
type AuthorizationSource ¶
type AuthorizationSource interface {
ReserveRegistrationAuthorization() Authorization
}
AuthorizationSource reserves authorization for one fresh registration. Waiting results describe the revision to watch and hold no reservation or dial slot.
type AuthorizationState ¶
type AuthorizationState = serviceauthority.AdmissionState
type Candidate ¶
type Candidate struct {
PublicURL string
Authorization AuthorizationSource `json:"-"`
}
Candidate binds deployment registration authority to one public relay address. Only PublicURL may enter a capability; the token is not session/STOP authority.
type Config ¶
type Config struct {
Candidate Candidate
Fresh v2.RegisterInit
ResumeToken v2.ResumeToken
PrivateKey ed25519.PrivateKey
Descriptor []byte
Initial Endpoint
Dialer Dialer
Clock Clock
LifecycleObservationCapacity int
ObserveConnection func(Connection) func()
ObserveAttempt func(Attempt)
Attempts AttemptControl
// Jitter is applied only in the slow phase, keeping short outages responsive.
Jitter func(time.Duration) time.Duration
}
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection keeps factories concrete while containing the narrow transport interface at the consumer boundary.
func NewConnection ¶
func NewConnection(endpoint Endpoint) Connection
func (Connection) Close ¶
func (connection Connection) Close() error
func (Connection) CompleteObservations ¶
func (connection Connection) CompleteObservations() relayv2.LifecycleObservationCompletion
func (Connection) LifecycleTrace ¶
func (connection Connection) LifecycleTrace() <-chan relayv2.LifecycleTrace
type Dialer ¶
type Dialer interface {
Dial(context.Context, relayv2.SenderConfig) (Connection, error)
}
Dialer owns the complete attempt outcome. RegistrationNotSentError proves no registration was sent by any internal attempt; observations never own policy.
type Endpoint ¶
Endpoint is defined at the lifecycle that consumes it so recovery policy does not depend on the concrete WebSocket transport.
type Lifecycle ¶
type Lifecycle struct {
// contains filtered or unexported fields
}
func (*Lifecycle) CompleteObservations ¶
func (lifecycle *Lifecycle) CompleteObservations() relayv2.LifecycleObservationCompletion
func (*Lifecycle) ObserveRegistration ¶ added in v0.1.4
func (lifecycle *Lifecycle) ObserveRegistration(observer func(RegistrationState))
ObserveRegistration provides the current route state even when diagnostic observations are disabled or dropped. The callback must not reenter Lifecycle.
func (*Lifecycle) StopRecovery ¶
func (lifecycle *Lifecycle) StopRecovery()
type RegistrationState ¶ added in v0.1.4
type RegistrationState uint8
const ( RegistrationPending RegistrationState = iota RegistrationNeedsUserAuthorization RegistrationAvailable )
type StaticKey ¶
type StaticKey string
func (StaticKey) ReserveRegistrationAuthorization ¶ added in v0.1.4
func (key StaticKey) ReserveRegistrationAuthorization() Authorization
type SystemClock ¶ added in v0.1.5
type SystemClock struct{}
func (SystemClock) Now ¶ added in v0.1.5
func (SystemClock) Now() time.Time