Update
This commit is contained in:
1 parent
3530afb854
commit
6903fcff27
2146 files changed
+112256
-190703
No files matched your search
+55
-20
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// Copyright (c) Tailscale Inc & contributors
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
// Package ipnstate captures the entire state of the Tailscale network.
|
||||
@@ -18,9 +18,9 @@ import (
|
||||
"time"
|
||||
|
||||
"tailscale.com/tailcfg"
|
||||
"tailscale.com/tailcfg/nodecap"
|
||||
"tailscale.com/tka"
|
||||
"tailscale.com/types/key"
|
||||
"tailscale.com/types/ptr"
|
||||
"tailscale.com/types/views"
|
||||
"tailscale.com/util/dnsname"
|
||||
"tailscale.com/version"
|
||||
@@ -74,6 +74,9 @@ type Status struct {
|
||||
// trailing periods, and without any "_acme-challenge." prefix.
|
||||
CertDomains []string
|
||||
|
||||
// ExtraRecords contains extra DNS records to add to the DNS resolver.
|
||||
ExtraRecords []tailcfg.DNSRecord
|
||||
|
||||
// Peer is the state of each peer, keyed by each peer's current public key.
|
||||
Peer map[key.NodePublic]*PeerStatus
|
||||
|
||||
@@ -87,7 +90,7 @@ type Status struct {
|
||||
ClientVersion *tailcfg.ClientVersion
|
||||
}
|
||||
|
||||
// TKAKey describes a key trusted by network lock.
|
||||
// TKAKey describes a key trusted by tailnet lock.
|
||||
type TKAKey struct {
|
||||
Kind string
|
||||
Key key.NLPublic
|
||||
@@ -95,7 +98,7 @@ type TKAKey struct {
|
||||
Votes uint
|
||||
}
|
||||
|
||||
// TKAPeer describes a peer and its network lock details.
|
||||
// TKAPeer describes a peer and its tailnet lock details.
|
||||
type TKAPeer struct {
|
||||
Name string // DNS
|
||||
ID tailcfg.NodeID
|
||||
@@ -105,18 +108,18 @@ type TKAPeer struct {
|
||||
NodeKeySignature tka.NodeKeySignature
|
||||
}
|
||||
|
||||
// NetworkLockStatus represents whether network-lock is enabled,
|
||||
// TailnetLockStatus represents whether tailnet-lock is enabled,
|
||||
// along with details about the locally-known state of the tailnet
|
||||
// key authority.
|
||||
type NetworkLockStatus struct {
|
||||
// Enabled is true if network lock is enabled.
|
||||
type TailnetLockStatus struct {
|
||||
// Enabled is true if tailnet lock is enabled.
|
||||
Enabled bool
|
||||
|
||||
// Head describes the AUM hash of the leaf AUM. Head is nil
|
||||
// if network lock is not enabled.
|
||||
// if tailnet lock is not enabled.
|
||||
Head *[32]byte
|
||||
|
||||
// PublicKey describes the node's network-lock public key.
|
||||
// PublicKey describes the node's tailnet-lock public key.
|
||||
// It may be zero if the node has not logged in.
|
||||
PublicKey key.NLPublic
|
||||
|
||||
@@ -124,18 +127,18 @@ type NetworkLockStatus struct {
|
||||
// populated if the node is not operating (i.e. waiting for a login).
|
||||
NodeKey *key.NodePublic
|
||||
|
||||
// NodeKeySigned is true if our node is authorized by network-lock.
|
||||
// NodeKeySigned is true if our node is authorized by tailnet-lock.
|
||||
NodeKeySigned bool
|
||||
|
||||
// NodeKeySignature is the current signature of this node's key.
|
||||
NodeKeySignature *tka.NodeKeySignature
|
||||
|
||||
// TrustedKeys describes the keys currently trusted to make changes
|
||||
// to network-lock.
|
||||
// to tailnet-lock.
|
||||
TrustedKeys []TKAKey
|
||||
|
||||
// VisiblePeers describes peers which are visible in the netmap that
|
||||
// have valid Tailnet Lock signatures signatures.
|
||||
// have valid Tailnet Lock signatures.
|
||||
VisiblePeers []*TKAPeer
|
||||
|
||||
// FilteredPeers describes peers which were removed from the netmap
|
||||
@@ -143,14 +146,17 @@ type NetworkLockStatus struct {
|
||||
// checks.
|
||||
FilteredPeers []*TKAPeer
|
||||
|
||||
// StateID is a nonce associated with the network lock authority,
|
||||
// StateID is a nonce associated with the tailnet lock authority,
|
||||
// generated upon enablement. This field is not populated if the
|
||||
// network lock is disabled.
|
||||
// tailnet lock is disabled.
|
||||
StateID uint64
|
||||
}
|
||||
|
||||
// NetworkLockUpdate describes a change to network-lock state.
|
||||
type NetworkLockUpdate struct {
|
||||
// Deprecated: use [TailnetLockStatus] instead.
|
||||
type NetworkLockStatus = TailnetLockStatus
|
||||
|
||||
// TailnetLockUpdate describes a change to tailnet-lock state.
|
||||
type TailnetLockUpdate struct {
|
||||
Hash [32]byte
|
||||
Change string // values of tka.AUMKind.String()
|
||||
|
||||
@@ -159,11 +165,18 @@ type NetworkLockUpdate struct {
|
||||
Raw []byte
|
||||
}
|
||||
|
||||
// Deprecated: use [TailnetLockUpdate] instead.
|
||||
type NetworkLockUpdate = TailnetLockUpdate
|
||||
|
||||
// TailnetStatus is information about a Tailscale network ("tailnet").
|
||||
type TailnetStatus struct {
|
||||
// Name is the name of the network that's currently in use.
|
||||
Name string
|
||||
|
||||
// StableID is the stable, unique identifier of the tailnet, as used to
|
||||
// identify the tailnet in the Tailscale API.
|
||||
StableID tailcfg.StableTailnetID
|
||||
|
||||
// MagicDNSSuffix is the network's MagicDNS suffix for nodes
|
||||
// in the network such as "userfoo.tailscale.net".
|
||||
// There are no surrounding dots.
|
||||
@@ -224,6 +237,7 @@ type PeerStatusLite struct {
|
||||
// inconsistencies or lost data in the peer status.
|
||||
type PeerStatus struct {
|
||||
ID tailcfg.StableNodeID
|
||||
NodeID tailcfg.NodeID
|
||||
PublicKey key.NodePublic
|
||||
HostName string // HostInfo's Hostname (not a DNS name or necessarily unique)
|
||||
|
||||
@@ -293,7 +307,7 @@ type PeerStatus struct {
|
||||
// Deprecated: use CapMap instead. See https://github.com/tailscale/tailscale/issues/11508
|
||||
// Every value is Capabilities is also a key in CapMap, even if it
|
||||
// has no values in that map.
|
||||
Capabilities []tailcfg.NodeCapability `json:",omitempty"`
|
||||
Capabilities []nodecap.Cap `json:",omitempty"`
|
||||
|
||||
// CapMap is a map of capabilities to their values.
|
||||
CapMap tailcfg.NodeCapMap `json:",omitempty"`
|
||||
@@ -347,10 +361,28 @@ const (
|
||||
)
|
||||
|
||||
// HasCap reports whether ps has the given capability.
|
||||
func (ps *PeerStatus) HasCap(cap tailcfg.NodeCapability) bool {
|
||||
func (ps *PeerStatus) HasCap(cap nodecap.Cap) bool {
|
||||
return ps.CapMap.Contains(cap)
|
||||
}
|
||||
|
||||
// IsRouter reports whether ps describes a router:
|
||||
// a node that routes addresses besides its own.
|
||||
// Examples: an exit node, a subnet router, an app connector, etc.
|
||||
// It is the analogue of [tailcfg.Node.IsRouter].
|
||||
func (ps *PeerStatus) IsRouter() bool {
|
||||
// TODO(sfllaw): Keep this aligned with dbx.Node.IsSubnetRouter.
|
||||
if ps.AllowedIPs == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, r := range ps.AllowedIPs.All() {
|
||||
if !r.IsSingleIP() || !slices.Contains(ps.TailscaleIPs, r.Addr()) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// IsTagged reports whether ps is tagged.
|
||||
func (ps *PeerStatus) IsTagged() bool {
|
||||
return ps.Tags != nil && ps.Tags.Len() > 0
|
||||
@@ -444,6 +476,9 @@ func (sb *StatusBuilder) AddPeer(peer key.NodePublic, st *PeerStatus) {
|
||||
if v := st.ID; v != "" {
|
||||
e.ID = v
|
||||
}
|
||||
if v := st.NodeID; v != 0 {
|
||||
e.NodeID = v
|
||||
}
|
||||
if v := st.HostName; v != "" {
|
||||
e.HostName = v
|
||||
}
|
||||
@@ -535,7 +570,7 @@ func (sb *StatusBuilder) AddPeer(peer key.NodePublic, st *PeerStatus) {
|
||||
e.Expired = true
|
||||
}
|
||||
if t := st.KeyExpiry; t != nil {
|
||||
e.KeyExpiry = ptr.To(*t)
|
||||
e.KeyExpiry = new(*t)
|
||||
}
|
||||
if v := st.CapMap; v != nil {
|
||||
e.CapMap = v
|
||||
@@ -715,7 +750,7 @@ type PingResult struct {
|
||||
|
||||
// DERPRegionID is non-zero DERP region ID if DERP was used.
|
||||
// It is not currently set for TSMP pings.
|
||||
DERPRegionID int
|
||||
DERPRegionID tailcfg.DERPRegionID
|
||||
|
||||
// DERPRegionCode is the three-letter region code
|
||||
// corresponding to DERPRegionID.
|
||||
|
||||
Reference in new issue
Block a user