domain

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FeatureMultiObserver      = "multi-observer"
	FeatureObserverWithdrawal = "observer-withdrawal"
	FeatureDeviceDirectory    = "device-directory"
)
View Source
const ProtocolVersion = 1

Variables

This section is empty.

Functions

func EdgeID

func EdgeID(a, b string) (id, source, target string)

func NormalizeDirectorySnapshot added in v0.5.0

func NormalizeDirectorySnapshot(snapshot DirectorySnapshot) (DirectorySnapshot, DirectoryNormalization, error)

func PathEvidenceKey added in v0.5.0

func PathEvidenceKey(path PathObservation) string

func SamePathEvidence added in v0.5.0

func SamePathEvidence(left, right PathEvidenceState) bool

Types

type AcceptedTraffic

type AcceptedTraffic struct {
	EdgeID          string
	SourceID        string
	TargetID        string
	ObserverID      string
	SystemTelemetry bool
	AToBBytes       int64
	BToABytes       int64
	ReceivedAt      time.Time
}

type DeviceDirectory added in v0.5.0

type DeviceDirectory struct {
	Sync    DirectorySyncState `json:"sync"`
	Devices []DirectoryNode    `json:"devices"`
}

type DirectoryDevice added in v0.5.0

type DirectoryDevice struct {
	StableNodeID       string     `json:"stableNodeId"`
	NodeKey            string     `json:"nodeKey,omitempty"`
	DNSName            string     `json:"dnsName,omitempty"`
	Hostname           string     `json:"hostname,omitempty"`
	OS                 string     `json:"os,omitempty"`
	TailscaleIPs       []string   `json:"tailscaleIps"`
	Tags               []string   `json:"tags"`
	ConnectedToControl bool       `json:"connectedToControl"`
	LastSeen           *time.Time `json:"lastSeen,omitempty"`
}

func (DirectoryDevice) Clone added in v0.5.0

func (device DirectoryDevice) Clone() DirectoryDevice

func (DirectoryDevice) DisplayName added in v0.5.0

func (device DirectoryDevice) DisplayName() string

type DirectoryEnrichment added in v0.5.0

type DirectoryEnrichment struct {
	StableNodeID       string             `json:"stableNodeId"`
	DNSName            string             `json:"dnsName,omitempty"`
	Hostname           string             `json:"hostname,omitempty"`
	OS                 string             `json:"os,omitempty"`
	TailscaleIPs       []string           `json:"tailscaleIps"`
	Tags               []string           `json:"tags"`
	ConnectedToControl bool               `json:"connectedToControl"`
	LastSeen           *time.Time         `json:"lastSeen,omitempty"`
	CollectedAt        time.Time          `json:"collectedAt"`
	Conflicts          []MetadataConflict `json:"conflicts"`
}

type DirectoryErrorCode added in v0.5.0

type DirectoryErrorCode string
const (
	DirectoryErrorUnauthorized    DirectoryErrorCode = "unauthorized"
	DirectoryErrorForbidden       DirectoryErrorCode = "forbidden"
	DirectoryErrorRateLimited     DirectoryErrorCode = "rate-limited"
	DirectoryErrorUnavailable     DirectoryErrorCode = "unavailable"
	DirectoryErrorTimeout         DirectoryErrorCode = "timeout"
	DirectoryErrorInvalidResponse DirectoryErrorCode = "invalid-response"
)

type DirectoryNode added in v0.5.0

type DirectoryNode struct {
	ID             string                    `json:"id"`
	Device         DirectoryDevice           `json:"device"`
	CollectedAt    time.Time                 `json:"collectedAt"`
	Runtime        *DirectoryRuntimeEvidence `json:"runtime,omitempty"`
	IdentityStatus IdentityStatus            `json:"identityStatus"`
	Conflicts      []MetadataConflict        `json:"conflicts"`
}

type DirectoryNormalization added in v0.5.0

type DirectoryNormalization struct {
	InvalidAddressCount int
}

type DirectoryRuntimeEvidence added in v0.5.0

type DirectoryRuntimeEvidence struct {
	Identity       NodeIdentity `json:"identity"`
	Observable     bool         `json:"observable"`
	Online         bool         `json:"online"`
	LastEvidenceAt time.Time    `json:"lastEvidenceAt"`
	CollectedAt    time.Time    `json:"collectedAt"`
}

type DirectorySnapshot added in v0.5.0

type DirectorySnapshot struct {
	CollectedAt time.Time         `json:"collectedAt"`
	Devices     []DirectoryDevice `json:"devices"`
}

func (DirectorySnapshot) Clone added in v0.5.0

func (snapshot DirectorySnapshot) Clone() DirectorySnapshot

func (DirectorySnapshot) ConflictingNodeKeys added in v0.5.0

func (snapshot DirectorySnapshot) ConflictingNodeKeys() map[string][]string

type DirectorySyncState added in v0.5.0

type DirectorySyncState struct {
	Status              DirectorySyncStatus `json:"status"`
	LastAttemptAt       *time.Time          `json:"lastAttemptAt,omitempty"`
	LastSuccessAt       *time.Time          `json:"lastSuccessAt,omitempty"`
	NextRetryAt         *time.Time          `json:"nextRetryAt,omitempty"`
	ErrorCode           DirectoryErrorCode  `json:"errorCode,omitempty"`
	InvalidAddressCount int                 `json:"invalidAddressCount,omitempty"`
}

func (DirectorySyncState) Clone added in v0.5.0

func (state DirectorySyncState) Clone() DirectorySyncState

func (DirectorySyncState) Validate added in v0.5.0

func (state DirectorySyncState) Validate() error

type DirectorySyncStatus added in v0.5.0

type DirectorySyncStatus string
const (
	DirectorySyncDisabled DirectorySyncStatus = "disabled"
	DirectorySyncSyncing  DirectorySyncStatus = "syncing"
	DirectorySyncHealthy  DirectorySyncStatus = "healthy"
	DirectorySyncStale    DirectorySyncStatus = "stale"
)

type EdgeHistory

type EdgeHistory struct {
	EdgeID              string                 `json:"edgeId"`
	Source              HistoryNodeReference   `json:"source"`
	Target              HistoryNodeReference   `json:"target"`
	SystemTelemetry     bool                   `json:"systemTelemetry"`
	RelatedNodes        []HistoryNodeReference `json:"relatedNodes"`
	From                time.Time              `json:"from"`
	To                  time.Time              `json:"to"`
	BucketDurationMS    int64                  `json:"bucketDurationMs"`
	LastTrafficAt       *time.Time             `json:"lastTrafficAt,omitempty"`
	Traffic             []TrafficBucket        `json:"traffic"`
	PathAnchor          *PathEvent             `json:"pathAnchor,omitempty"`
	PathEvents          []PathEvent            `json:"pathEvents"`
	TrafficTruncated    bool                   `json:"trafficTruncated"`
	PathEventsTruncated bool                   `json:"pathEventsTruncated"`
}

type EdgeState

type EdgeState string
const (
	EdgeActive EdgeState = "active"
	EdgeRecent EdgeState = "recent"
)

type HistoryEdgePage

type HistoryEdgePage struct {
	Edges      []HistoryEdgeSummary `json:"edges"`
	NextCursor string               `json:"nextCursor,omitempty"`
}

type HistoryEdgeQuery

type HistoryEdgeQuery struct {
	Window                 HistoryWindow
	NodeID                 string
	Path                   PathKind
	Cursor                 string
	Limit                  int
	IncludeSystemTelemetry bool
}

type HistoryEdgeSummary

type HistoryEdgeSummary struct {
	EdgeID          string               `json:"edgeId"`
	Source          HistoryNodeReference `json:"source"`
	Target          HistoryNodeReference `json:"target"`
	SystemTelemetry bool                 `json:"systemTelemetry"`
	LastTrafficAt   time.Time            `json:"lastTrafficAt"`
	AToBBytes       int64                `json:"aToBBytes"`
	BToABytes       int64                `json:"bToABytes"`
	Paths           []PathKind           `json:"paths"`
}

type HistoryMetadata

type HistoryMetadata struct {
	Nodes          []TopologyNode
	Redirects      map[string]string
	ControlNodeIDs []string
}

type HistoryNodeReference

type HistoryNodeReference struct {
	ID             string         `json:"id"`
	StableNodeID   string         `json:"stableNodeId,omitempty"`
	Label          string         `json:"label"`
	Hostname       string         `json:"hostname,omitempty"`
	DNSName        string         `json:"dnsName,omitempty"`
	OS             string         `json:"os,omitempty"`
	IdentityStatus IdentityStatus `json:"identityStatus,omitempty"`
}

type HistoryNodes

type HistoryNodes struct {
	Nodes []HistoryNodeReference `json:"nodes"`
}

type HistoryWindow

type HistoryWindow string
const (
	History15Minutes HistoryWindow = "15m"
	History1Hour     HistoryWindow = "1h"
	History6Hours    HistoryWindow = "6h"
	History24Hours   HistoryWindow = "24h"
	History7Days     HistoryWindow = "7d"
)

func (HistoryWindow) Duration

func (window HistoryWindow) Duration() time.Duration

func (HistoryWindow) Resolution

func (window HistoryWindow) Resolution() time.Duration

func (HistoryWindow) Valid

func (window HistoryWindow) Valid() bool

type IdentityStatus added in v0.4.0

type IdentityStatus string
const (
	IdentityResolved  IdentityStatus = "resolved"
	IdentityPartial   IdentityStatus = "partial"
	IdentityAnonymous IdentityStatus = "anonymous"
	IdentityConflict  IdentityStatus = "conflict"
)

type MetadataConflict added in v0.5.0

type MetadataConflict struct {
	Field                MetadataField `json:"field"`
	DirectoryValues      []string      `json:"directoryValues"`
	RuntimeValues        []string      `json:"runtimeValues"`
	DirectoryCollectedAt time.Time     `json:"directoryCollectedAt"`
	RuntimeCollectedAt   time.Time     `json:"runtimeCollectedAt"`
}

func DirectoryMetadataConflicts added in v0.5.0

func DirectoryMetadataConflicts(directory DirectoryDevice, runtime NodeIdentity, directoryAt, runtimeAt time.Time) []MetadataConflict

type MetadataField added in v0.5.0

type MetadataField string
const (
	MetadataDNSName      MetadataField = "dnsName"
	MetadataHostname     MetadataField = "hostname"
	MetadataOS           MetadataField = "os"
	MetadataTailscaleIPs MetadataField = "tailscaleIps"
)

type NodeIdentity

type NodeIdentity struct {
	StableNodeID string   `json:"stableNodeId"`
	NodeID       string   `json:"nodeId,omitempty"`
	NodeKey      string   `json:"nodeKey,omitempty"`
	DiscoKey     string   `json:"discoKey,omitempty"`
	Hostname     string   `json:"hostname"`
	DNSName      string   `json:"dnsName,omitempty"`
	OS           string   `json:"os,omitempty"`
	TailscaleIPs []string `json:"tailscaleIps,omitempty"`
}

func (NodeIdentity) CanonicalID

func (n NodeIdentity) CanonicalID() string

func (NodeIdentity) DisplayName

func (n NodeIdentity) DisplayName() string

func (NodeIdentity) HasIdentity

func (n NodeIdentity) HasIdentity() bool

func (NodeIdentity) IdentityKey

func (n NodeIdentity) IdentityKey() string

type ObservationProvenance

type ObservationProvenance struct {
	ObserverID   string                  `json:"observerId"`
	Path         PathObservation         `json:"path"`
	CollectedAt  time.Time               `json:"collectedAt"`
	ReceivedAt   time.Time               `json:"receivedAt"`
	ClockSkewed  bool                    `json:"clockSkewed"`
	RelaySession *RelaySessionProvenance `json:"relaySession,omitempty"`
}

type ObserverReport

type ObserverReport struct {
	Observer            NodeIdentity      `json:"observer"`
	InventoryGeneration string            `json:"inventoryGeneration"`
	CollectedAt         *time.Time        `json:"collectedAt,omitempty"`
	Peers               []PeerObservation `json:"peers,omitempty"`
}

func (ObserverReport) CollectionTime added in v0.4.0

func (o ObserverReport) CollectionTime(fallback time.Time) time.Time

type ObserverState

type ObserverState struct {
	ID              string    `json:"id"`
	Hostname        string    `json:"hostname"`
	Online          bool      `json:"online"`
	LastSeen        time.Time `json:"lastSeen"`
	LastCollectedAt time.Time `json:"lastCollectedAt"`
	ClockSkewMS     int64     `json:"clockSkewMs"`
	ClockSkewed     bool      `json:"clockSkewed"`
}

type PathEvent

type PathEvent struct {
	ObservedAt   time.Time               `json:"observedAt"`
	Path         PathObservation         `json:"path"`
	Conflicts    []PathObservation       `json:"conflicts"`
	Observations []ObservationProvenance `json:"observations"`
}

type PathEvidenceState added in v0.5.0

type PathEvidenceState struct {
	Path      PathObservation
	Conflicts []PathObservation
}

func ReconcilePathEvidence added in v0.5.0

func ReconcilePathEvidence(sourceID, targetID string, previous PathObservation, observations []ObservationProvenance) PathEvidenceState

ReconcilePathEvidence selects a stable primary without using cross-observer receipt order as a path signal.

type PathKind

type PathKind string
const (
	PathDirect    PathKind = "direct"
	PathDERP      PathKind = "derp"
	PathPeerRelay PathKind = "peer_relay"
	PathUnknown   PathKind = "unknown"
)

type PathObservation

type PathObservation struct {
	Kind                  PathKind `json:"kind"`
	DirectEndpoint        string   `json:"directEndpoint,omitempty"`
	DERPRegion            string   `json:"derpRegion,omitempty"`
	PeerRelayStableNodeID string   `json:"peerRelayStableNodeId,omitempty"`
	PeerRelayVNI          *int64   `json:"peerRelayVni,omitempty"`
}

func (PathObservation) Equal

func (p PathObservation) Equal(other PathObservation) bool

type PathTransition

type PathTransition struct {
	EdgeID       string
	ObservedAt   time.Time
	Path         PathObservation
	Conflicts    []PathObservation
	Observations []ObservationProvenance
}

type PeerObservation

type PeerObservation struct {
	Peer             NodeIdentity    `json:"peer"`
	RxBytes          int64           `json:"rxBytes"`
	TxBytes          int64           `json:"txBytes"`
	RxDelta          int64           `json:"rxDelta"`
	TxDelta          int64           `json:"txDelta"`
	SampleDurationMS int64           `json:"sampleDurationMs"`
	Path             PathObservation `json:"path"`
	LastActive       time.Time       `json:"lastActive"`
}

type RelaySessionClient added in v0.4.0

type RelaySessionClient struct {
	SessionClientID string        `json:"sessionClientId"`
	Identity        *NodeIdentity `json:"identity,omitempty"`
	DiscoShort      string        `json:"discoShort,omitempty"`
	Endpoint        string        `json:"endpoint,omitempty"`
}

func (RelaySessionClient) IdentityOrEmpty added in v0.4.0

func (client RelaySessionClient) IdentityOrEmpty() NodeIdentity

func (RelaySessionClient) IdentityStatus added in v0.4.0

func (client RelaySessionClient) IdentityStatus() IdentityStatus

type RelaySessionObservation

type RelaySessionObservation struct {
	Relay               NodeIdentity       `json:"relay"`
	Source              RelaySessionClient `json:"source"`
	Target              RelaySessionClient `json:"target"`
	SessionID           string             `json:"sessionId"`
	VNI                 int64              `json:"vni"`
	SourceToTargetBytes int64              `json:"sourceToTargetBytes"`
	TargetToSourceBytes int64              `json:"targetToSourceBytes"`
	SourceToTargetDelta int64              `json:"sourceToTargetDelta"`
	TargetToSourceDelta int64              `json:"targetToSourceDelta"`
	SampleDurationMS    int64              `json:"sampleDurationMs"`
	LastActive          time.Time          `json:"lastActive"`
}

func (RelaySessionObservation) Validate

func (s RelaySessionObservation) Validate() error

type RelaySessionProvenance added in v0.4.0

type RelaySessionProvenance struct {
	SessionID            string         `json:"sessionId"`
	VNI                  int64          `json:"vni"`
	SourceIdentityStatus IdentityStatus `json:"sourceIdentityStatus"`
	TargetIdentityStatus IdentityStatus `json:"targetIdentityStatus"`
}

type ReportEnvelope

type ReportEnvelope struct {
	Version            int                       `json:"version"`
	ReportID           string                    `json:"reportId"`
	ReporterInstanceID string                    `json:"reporterInstanceId"`
	Sequence           int64                     `json:"sequence"`
	CollectedAt        time.Time                 `json:"collectedAt"`
	Kind               ReportKind                `json:"kind"`
	Observers          []ObserverReport          `json:"observers,omitempty"`
	RelaySessions      []RelaySessionObservation `json:"relaySessions,omitempty"`
}

func (ReportEnvelope) Validate

func (r ReportEnvelope) Validate() error

type ReportKind

type ReportKind string
const (
	ReportObserverHello      ReportKind = "observer_hello"
	ReportInventoryUpdate    ReportKind = "inventory_update"
	ReportTrafficSample      ReportKind = "traffic_sample"
	ReportObserverHeartbeat  ReportKind = "observer_heartbeat"
	ReportObserverWithdrawal ReportKind = "observer_withdrawal"
	ReportRelaySessionUpdate ReportKind = "relay_session_update"
)

type ReportReceipt

type ReportReceipt struct {
	Accepted             bool     `json:"accepted"`
	ResyncRequired       bool     `json:"resyncRequired"`
	ControlStableNodeIDs []string `json:"controlStableNodeIds"`
	HeartbeatIntervalMS  int64    `json:"heartbeatIntervalMs"`
}

type ServerCapabilities added in v0.4.0

type ServerCapabilities struct {
	ObserverProtocolVersions []int    `json:"observerProtocolVersions"`
	Features                 []string `json:"features"`
}

func CurrentServerCapabilities added in v0.4.0

func CurrentServerCapabilities() ServerCapabilities

func (ServerCapabilities) SupportsFeature added in v0.4.0

func (c ServerCapabilities) SupportsFeature(feature string) bool

func (ServerCapabilities) SupportsProtocol added in v0.4.0

func (c ServerCapabilities) SupportsProtocol(version int) bool

type Topology

type Topology struct {
	GeneratedAt  time.Time       `json:"generatedAt"`
	NextChangeAt *time.Time      `json:"nextChangeAt,omitempty"`
	Nodes        []TopologyNode  `json:"nodes"`
	Edges        []TopologyEdge  `json:"edges"`
	Observers    []ObserverState `json:"observers"`
}

type TopologyEdge

type TopologyEdge struct {
	ID                 string                  `json:"id"`
	Source             string                  `json:"source"`
	Target             string                  `json:"target"`
	SystemTelemetry    bool                    `json:"systemTelemetry"`
	Path               PathObservation         `json:"path"`
	State              EdgeState               `json:"state"`
	AToBBytesPerSecond float64                 `json:"aToBBytesPerSecond"`
	BToABytesPerSecond float64                 `json:"bToABytesPerSecond"`
	LastActive         time.Time               `json:"lastActive"`
	Observations       []ObservationProvenance `json:"observations"`
	Conflicts          []PathObservation       `json:"conflicts,omitempty"`
}

type TopologyNode

type TopologyNode struct {
	NodeIdentity
	ID             string               `json:"id"`
	Observable     bool                 `json:"observable"`
	Online         bool                 `json:"online"`
	LastEvidenceAt time.Time            `json:"lastEvidenceAt"`
	ClockSkewed    bool                 `json:"clockSkewed"`
	IdentityStatus IdentityStatus       `json:"identityStatus,omitempty"`
	Directory      *DirectoryEnrichment `json:"directory,omitempty"`
}

type TrafficBucket

type TrafficBucket struct {
	BucketStart time.Time `json:"bucketStart"`
	AToBBytes   int64     `json:"aToBBytes"`
	BToABytes   int64     `json:"bToABytes"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL