Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllocatorOption ¶
type AllocatorOption func(*VNIAllocator)
AllocatorOption configures a VNIAllocator.
func WithQuarantineWindow ¶
func WithQuarantineWindow(d time.Duration) AllocatorOption
WithQuarantineWindow overrides how long a released VNI is withheld from reuse.
type VNIAllocator ¶
type VNIAllocator struct {
// contains filtered or unexported fields
}
VNIAllocator is a relay-local VNI allocator with quarantine-on-release: a released VNI is held for a quarantine window before it can be handed out again, so a new connection never reuses a VNI whose icx SA teardown may still be in flight (which would let a stale SA match the new peer). VNIs are unique only per relay (§2.5) and nothing stores them durably; a relay restart abandons the whole space and agents reconnect with fresh VNIs.
Quarantined VNIs keep their bit set in the pool (so FirstZero skips them) and carry a release deadline; the next Allocate sweeps any whose deadline has passed back into the free pool.
func NewVNIAllocator ¶
func NewVNIAllocator(opts ...AllocatorOption) *VNIAllocator
NewVNIAllocator creates a relay-local quarantine-aware VNI allocator.
func (*VNIAllocator) Allocate ¶
func (a *VNIAllocator) Allocate() (uint, error)
Allocate reserves and returns an unused VNI. VNI 0 is reserved (the icx handler rejects it), so allocation starts at 1 (VNIPool.Allocate begins at 1).
func (*VNIAllocator) Release ¶
func (a *VNIAllocator) Release(vni uint)
Release moves a VNI into quarantine; it becomes reusable only after the quarantine window elapses (enforced lazily on the next Allocate).
type VNIPool ¶
type VNIPool struct {
// contains filtered or unexported fields
}
TODO: support for some kind of persistent bitmap datastructure (sqlite3?).
func NewVNIPool ¶
func NewVNIPool() *VNIPool