Documentation
¶
Overview ¶
Package reachability owns demand-bounded gateway leases, never ICE attempts.
Index ¶
- Constants
- Variables
- func PublicAddress(address netip.Addr) bool
- type Authority
- func (a *Authority) Changes() <-chan struct{}
- func (a *Authority) Close(ctx context.Context)
- func (a *Authority) Facts() []Fact
- func (a *Authority) Reconcile(ctx context.Context)
- func (a *Authority) RefreshUnavailable()
- func (a *Authority) Retire(generation uint64)
- func (a *Authority) SetDemand(d Demand) error
- func (a *Authority) Withdraw(id string)
- type Config
- type Demand
- type Endpoint
- type Event
- type Fact
- type Gateway
- type Lease
- type Protocol
- type Request
- type Scope
Constants ¶
const ( // DefaultCapacity accommodates UDP+TCP endpoint demands across four full // paths (4 * 16 addresses * 2 protocols = 128), matching socketauthority. DefaultCapacity = 128 DefaultDemandTTL = 60 * time.Second DefaultLeaseTTL = 120 * time.Second DefaultHeadStart = 2 * time.Second DefaultGrace = 3 * time.Second DefaultOperationTimeout = 2 * time.Second )
Variables ¶
var ( ErrInvalid = errors.New("invalid reachability request") ErrCapacity = errors.New("reachability capacity exhausted") ErrInvalidResponse = errors.New("invalid gateway response") ErrClosed = errors.New("reachability authority closed") // ErrLeaseLost means a renewal no longer authorizes the previous endpoint. // Other errors retain the previous lease only until its original expiry. ErrLeaseLost = errors.New("gateway lease lost") )
Functions ¶
func PublicAddress ¶
PublicAddress is deliberately stricter than netip.IsGlobalUnicast, which includes private and documentation addresses that cannot establish reachability.
Types ¶
type Authority ¶
type Authority struct {
// contains filtered or unexported fields
}
func (*Authority) Reconcile ¶
Reconcile is invoked by the connectivity owner's background maintenance worker. Each pass services at most one gateway step per resource, concurrently: a slow discovery must not hold unrelated renewal or revocation deadlines. Capacity bounds the number of workers; serialized passes preserve single-flight.
func (*Authority) RefreshUnavailable ¶
func (a *Authority) RefreshUnavailable()
RefreshUnavailable consumes a discovery-catalog change, not a retry timer. Only resources with live content demand and no successful lease are eligible; the next background maintenance pass remains bounded by normal gateway limits.
type Gateway ¶
type Gateway interface {
Create(context.Context, Request) (Lease, error)
Renew(context.Context, Request, Lease) (Lease, error)
Delete(context.Context, Request, Lease) error
}
Gateway implementations must respect context cancellation and support calls for independent resources concurrently. Renewal errors wrap ErrLeaseLost only when the previous mapping has been revoked or is known to be absent.