domain

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func EdgeID

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

Types

type AcceptedTraffic

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

type EdgeHistory

type EdgeHistory struct {
	EdgeID              string               `json:"edgeId"`
	Source              HistoryNodeReference `json:"source"`
	Target              HistoryNodeReference `json:"target"`
	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
}

type HistoryEdgeSummary

type HistoryEdgeSummary struct {
	EdgeID        string               `json:"edgeId"`
	Source        HistoryNodeReference `json:"source"`
	Target        HistoryNodeReference `json:"target"`
	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
}

type HistoryNodeReference

type HistoryNodeReference struct {
	ID             string         `json:"id"`
	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 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"`
	Observations []ObservationProvenance `json:"observations"`
}

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
	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"`
}

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