mirror of
https://github.com/juanfont/headscale.git
synced 2026-05-23 18:48:42 +09:00
Every Go-identifier reference in // and /* */ comments now uses
godoc's [Name] linking syntax so pkg.go.dev and `go doc` render
them as clickable cross-references. No behaviour change.
Pattern applied across the tree:
In-package [Foo], [Foo.Bar]
Cross-package [pkg.Foo], [pkg.Foo.Bar]
Stdlib [netip.Prefix], [errors.Is], [context.Context]
Tailscale [tailcfg.MapResponse], [tailcfg.Node.CapMap],
[tailcfg.NodeAttrSuggestExitNode]
Skip rules:
- File:line refs left as plain text
- HuJSON wire keys inside backtick raw strings untouched
- ACL/policy syntax tokens (tag:foo, autogroup:self, ...) not Go
symbols, left as plain text
- JSON/OIDC wire keys, gorm tags, RFC IPv6 placeholders, markdown
link tags, decorative dividers — all left as-is
56 lines
2.0 KiB
Go
56 lines
2.0 KiB
Go
package types
|
||
|
||
import (
|
||
"net/netip"
|
||
"time"
|
||
|
||
"tailscale.com/tailcfg"
|
||
"tailscale.com/types/key"
|
||
)
|
||
|
||
// RegistrationData is the payload cached for a pending node registration.
|
||
// It replaces the previous practice of caching a full *[Node] and carries
|
||
// only the fields the registration callback path actually consumes when
|
||
// promoting a pending registration to a real node.
|
||
//
|
||
// Combined with the bounded-LRU cache that holds these entries, this caps
|
||
// the worst-case memory footprint of unauthenticated cache-fill attempts
|
||
// at (max_entries × per_entry_size). The cache is sized so that the
|
||
// product is bounded to a few MiB even with attacker-supplied 1 MiB
|
||
// Hostinfos (the Noise body limit).
|
||
type RegistrationData struct {
|
||
// MachineKey is the cryptographic identity of the machine being
|
||
// registered. Required.
|
||
MachineKey key.MachinePublic
|
||
|
||
// NodeKey is the cryptographic identity of the node session.
|
||
// Required.
|
||
NodeKey key.NodePublic
|
||
|
||
// DiscoKey is the disco public key for peer-to-peer connections.
|
||
DiscoKey key.DiscoPublic
|
||
|
||
// Hostname is the resolved hostname for the registering node.
|
||
// Already validated/normalised by EnsureHostname at producer time.
|
||
Hostname string
|
||
|
||
// Hostinfo is the original [tailcfg.Hostinfo] from the [tailcfg.RegisterRequest],
|
||
// stored so that the auth callback can populate the new node's
|
||
// initial [tailcfg.Hostinfo] (and so that observability/CLI consumers see
|
||
// fields like OS, OSVersion, and IPNVersion before the first
|
||
// [tailcfg.MapRequest] restores the live set).
|
||
//
|
||
// May be nil if the client did not send [tailcfg.Hostinfo] in the original
|
||
// [tailcfg.RegisterRequest].
|
||
Hostinfo *tailcfg.Hostinfo
|
||
|
||
// Endpoints is the initial set of WireGuard endpoints the node
|
||
// reported. The first [tailcfg.MapRequest] after registration overwrites
|
||
// this with the live set.
|
||
Endpoints []netip.AddrPort
|
||
|
||
// Expiry is the optional client-requested expiry for this node.
|
||
// May be nil if the client did not request a specific expiry.
|
||
Expiry *time.Time
|
||
}
|