Documentation
¶
Overview ¶
Package nodedirectory verifies deployment configuration without performing I/O.
Index ¶
- Constants
- Variables
- func Accept(highest Cursor, next Snapshot, now time.Time, grace time.Duration) error
- func Compare(highest, cursor Cursor) error
- func RetainAliases(previous map[string]string, snapshot Snapshot) (map[string]string, error)
- func Sign(payload Payload, certificate SignedCertificate, key ed25519.PrivateKey, ...) ([]byte, error)
- func ValidAlias(alias string) bool
- func Validate(payload Payload) error
- type Certificate
- type Cursor
- type Envelope
- type History
- type Node
- type Payload
- type Root
- type STUNEndpoint
- type SignedCertificate
- type Snapshot
- func (snapshot Snapshot) Cursor() Cursor
- func (snapshot Snapshot) Envelope() []byte
- func (snapshot Snapshot) Payload() Payload
- func (snapshot Snapshot) Resolve(alias string) (string, bool)
- func (snapshot Snapshot) TrustedUntil(grace time.Duration) time.Time
- func (snapshot Snapshot) Usable(now time.Time, grace time.Duration) bool
- type Status
Constants ¶
const ( Format = 1 MaximumEnvelopeBytes = 512 << 10 MaximumNodes = 256 MaximumPublicSTUN = 128 MaximumCounter = 1<<53 - 1 DefaultGrace = 7 * 24 * time.Hour MaximumCertificateLifetime = 180 * 24 * time.Hour MaximumPayloadLifetime = 90 * 24 * time.Hour ClockSkew = 5 * time.Minute CertificateDomain = "windshare/network-certificate/v1\x00" PayloadDomain = "windshare/network-directory/v1\x00" )
Variables ¶
var ( ErrFormat = errors.New("invalid network directory") ErrSignature = errors.New("network directory signature rejected") ErrExpired = errors.New("network directory temporarily unavailable") ErrRollback = errors.New("network directory rollback or equivocation") ErrAliasReassigned = errors.New("network directory alias reassigned") )
Functions ¶
func RetainAliases ¶
RetainAliases carries tombstones across removals and signing generations. A familiar alias must never silently select a different relay authority.
func Sign ¶
func Sign(payload Payload, certificate SignedCertificate, key ed25519.PrivateKey, roots []Root) ([]byte, error)
Sign verifies the complete chain before exporting it, catching mismatched keys and generations locally rather than publishing an unusable directory.
func ValidAlias ¶
Types ¶
type Certificate ¶
type Envelope ¶
type Envelope struct {
Payload string `json:"payload"`
Certificate SignedCertificate `json:"certificate"`
Signature string `json:"signature"`
}
type History ¶
type History struct {
// contains filtered or unexported fields
}
History authenticates immutable publication history without granting admission. Old publications establish alias ownership and rollback barriers even when they lack the node identity now required by runtime snapshots.
type Node ¶
type Node struct {
Alias string `json:"alias"`
NodeKey string `json:"node_key"`
Relay string `json:"relay"`
STUN []string `json:"stun"`
Roles []string `json:"roles"`
Zone string `json:"zone"`
Region string `json:"region"`
Provider string `json:"provider"`
Operator string `json:"operator"`
CapacityMbps uint32 `json:"capacity_mbps"`
Status Status `json:"status"`
}
type Payload ¶
type Payload struct {
Format int `json:"format"`
Network string `json:"network"`
Generation uint64 `json:"generation"`
Serial uint64 `json:"serial"`
IssuedAt time.Time `json:"issued_at"`
ExpiresAt time.Time `json:"expires_at"`
Nodes []Node `json:"nodes"`
PublicSTUN []STUNEndpoint `json:"public_stun"`
}
type STUNEndpoint ¶
type SignedCertificate ¶
type SignedCertificate struct {
Root string `json:"root"`
Payload string `json:"payload"`
Signature string `json:"signature"`
}
func Certify ¶
func Certify(certificate Certificate, rootID string, root ed25519.PrivateKey) (SignedCertificate, error)
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot retains verified bytes privately. Callers cannot mutate trusted data.