Documentation ¶
Overview ¶
Package ipnstate captures the entire state of the Tailscale network.
It's a leaf package so ipn, wgengine, and magicsock can all depend on it.
Index ¶
- func SortPeers(peers []*PeerStatus)
- type DebugDERPRegionReport
- type ExitNodeStatus
- type NetworkLockStatus
- type NetworkLockUpdate
- type PeerStatus
- type PeerStatusLite
- type PingResult
- type Status
- type StatusBuilder
- func (sb *StatusBuilder) AddPeer(peer key.NodePublic, st *PeerStatus)
- func (sb *StatusBuilder) AddTailscaleIP(ip netip.Addr)
- func (sb *StatusBuilder) AddUser(id tailcfg.UserID, up tailcfg.UserProfile)
- func (sb *StatusBuilder) MutateSelfStatus(f func(*PeerStatus))
- func (sb *StatusBuilder) MutateStatus(f func(*Status))
- func (sb *StatusBuilder) Status() *Status
- type StatusUpdater
- type TKAFilteredPeer
- type TKAKey
- type TailnetStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SortPeers ¶ added in v1.4.0
func SortPeers(peers []*PeerStatus)
Types ¶
type DebugDERPRegionReport ¶ added in v1.34.0
DebugDERPRegionReport is the result of a "tailscale debug derp" command, to let people debug a custom DERP setup.
type ExitNodeStatus ¶ added in v1.28.0
type ExitNodeStatus struct { // ID is the exit node's ID. ID tailcfg.StableNodeID // Online is whether the exit node is alive. Online bool // TailscaleIPs are the exit node's IP addresses assigned to the node. TailscaleIPs []netip.Prefix }
ExitNodeStatus describes the current exit node.
type NetworkLockStatus ¶ added in v1.30.0
type NetworkLockStatus struct { // Enabled is true if network lock is enabled. Enabled bool // Head describes the AUM hash of the leaf AUM. Head is nil // if network lock is not enabled. Head *[32]byte // PublicKey describes the node's network-lock public key. // It may be zero if the node has not logged in. PublicKey key.NLPublic // NodeKey describes the node's current node-key. This field is not // 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 bool // TrustedKeys describes the keys currently trusted to make changes // to network-lock. TrustedKeys []TKAKey // FilteredPeers describes peers which were removed from the netmap // (i.e. no connectivity) because they failed tailnet lock // checks. FilteredPeers []*TKAFilteredPeer }
NetworkLockStatus represents whether network-lock is enabled, along with details about the locally-known state of the tailnet key authority.
type NetworkLockUpdate ¶ added in v1.34.0
type NetworkLockUpdate struct { Hash [32]byte Change string // values of tka.AUMKind.String() // Raw contains the serialized AUM. The AUM is sent in serialized // form to avoid transitive dependences bloating this package. Raw []byte }
NetworkLockUpdate describes a change to network-lock state.
type PeerStatus ¶
type PeerStatus struct { ID tailcfg.StableNodeID PublicKey key.NodePublic HostName string // HostInfo's Hostname (not a DNS name or necessarily unique) DNSName string OS string // HostInfo.OS UserID tailcfg.UserID TailscaleIPs []netip.Addr // Tailscale IP(s) assigned to this node // Tags are the list of ACL tags applied to this node. // See tailscale.com/tailcfg#Node.Tags for more information. Tags *views.Slice[string] `json:",omitempty"` // PrimaryRoutes are the routes this node is currently the primary // subnet router for, as determined by the control plane. It does // not include the IPs in TailscaleIPs. PrimaryRoutes *views.IPPrefixSlice `json:",omitempty"` // Endpoints: Addrs []string CurAddr string // one of Addrs, or unique if roaming Relay string // DERP region RxBytes int64 TxBytes int64 Created time.Time // time registered with tailcontrol LastWrite time.Time // time last packet sent LastSeen time.Time // last seen to tailcontrol; only present if offline LastHandshake time.Time // with local wireguard Online bool // whether node is connected to the control plane KeepAlive bool ExitNode bool // true if this is the currently selected exit node. ExitNodeOption bool // true if this node can be an exit node (offered && approved) // Active is whether the node was recently active. The // definition is somewhat undefined but has historically and // currently means that there was some packet sent to this // peer in the past two minutes. That definition is subject to // change. Active bool PeerAPIURL []string Capabilities []string `json:",omitempty"` // SSH_HostKeys are the node's SSH host keys, if known. SSH_HostKeys []string `json:"sshHostKeys,omitempty"` // it's owned by a shared-to user and that node might connect // to us. These nodes should be hidden by "tailscale status" // etc by default. ShareeNode bool `json:",omitempty"` // InNetworkMap means that this peer was seen in our latest network map. // In theory, all of InNetworkMap and InMagicSock and InEngine should all be true. InNetworkMap bool // InMagicSock means that this peer is being tracked by magicsock. // In theory, all of InNetworkMap and InMagicSock and InEngine should all be true. InMagicSock bool // InEngine means that this peer is tracked by the wireguard engine. // In theory, all of InNetworkMap and InMagicSock and InEngine should all be true. InEngine bool }
type PeerStatusLite ¶ added in v1.6.0
type PeerStatusLite struct {
// TxBytes/RxBytes is the total number of bytes transmitted to/received from this peer.
TxBytes, RxBytes int64
// LastHandshake is the last time a handshake succeeded with this peer.
// (Or we got key confirmation via the first data message,
// which is approximately the same thing.)
LastHandshake time.Time
// NodeKey is this peer's public node key.
NodeKey key.NodePublic
}
type PingResult ¶ added in v1.2.0
type PingResult struct { IP string // ping destination NodeIP string // Tailscale IP of node handling IP (different for subnet routers) NodeName string // DNS name base or (possibly not unique) hostname Err string LatencySeconds float64 // Endpoint is the ip:port if direct UDP was used. // It is not currently set for TSMP pings. Endpoint string // DERPRegionID is non-zero DERP region ID if DERP was used. // It is not currently set for TSMP pings. DERPRegionID int // DERPRegionCode is the three-letter region code // corresponding to DERPRegionID. // It is not currently set for TSMP pings. DERPRegionCode string // PeerAPIPort is set by TSMP ping responses for peers that // are running a peerapi server. This is the port they're // running the server on. PeerAPIPort uint16 `json:",omitempty"` // PeerAPIURL is the URL that was hit for pings of type "peerapi" (tailcfg.PingPeerAPI). // It's of the form "http://ip:port" (or [ip]:port for IPv6). PeerAPIURL string `json:",omitempty"` // IsLocalIP is whether the ping request error is due to it being // a ping to the local node. IsLocalIP bool `json:",omitempty"` }
PingResult contains response information for the "tailscale ping" subcommand, saying how Tailscale can reach a Tailscale IP or subnet-routed IP. See tailcfg.PingResponse for a related response that is sent back to control for remote diagnostic pings.
func (*PingResult) ToPingResponse ¶ added in v1.24.0
func (pr *PingResult) ToPingResponse(pingType tailcfg.PingType) *tailcfg.PingResponse
type Status ¶
type Status struct { // Version is the daemon's long version (see version.Long). Version string // BackendState is an ipn.State string value: // "NoState", "NeedsLogin", "NeedsMachineAuth", "Stopped", // "Starting", "Running". BackendState string AuthURL string // current URL provided by control to authorize client TailscaleIPs []netip.Addr // Tailscale IP(s) assigned to this node Self *PeerStatus // ExitNodeStatus describes the current exit node. // If nil, an exit node is not in use. ExitNodeStatus *ExitNodeStatus `json:"ExitNodeStatus,omitempty"` // Health contains health check problems. // Empty means everything is good. (or at least that no known // problems are detected) Health []string // This field is the legacy name of CurrentTailnet.MagicDNSSuffix. // // Deprecated: use CurrentTailnet.MagicDNSSuffix instead. MagicDNSSuffix string // CurrentTailnet is information about the tailnet that the node // is currently connected to. When not connected, this field is nil. CurrentTailnet *TailnetStatus // CertDomains are the set of DNS names for which the control // plane server will assist with provisioning TLS // certificates. See SetDNSRequest for dns-01 ACME challenges // for e.g. LetsEncrypt. These names are FQDNs without // trailing periods, and without any "_acme-challenge." prefix. CertDomains []string Peer map[key.NodePublic]*PeerStatus User map[tailcfg.UserID]tailcfg.UserProfile }
Status represents the entire state of the IPN network.
func (*Status) Peers ¶
func (s *Status) Peers() []key.NodePublic
type StatusBuilder ¶
type StatusBuilder struct {
// contains filtered or unexported fields
}
func (*StatusBuilder) AddPeer ¶
func (sb *StatusBuilder) AddPeer(peer key.NodePublic, st *PeerStatus)
AddPeer adds a peer node to the status.
Its PeerStatus is mixed with any previous status already added.
func (*StatusBuilder) AddTailscaleIP ¶ added in v1.0.0
func (sb *StatusBuilder) AddTailscaleIP(ip netip.Addr)
AddIP adds a Tailscale IP address to the status.
func (*StatusBuilder) AddUser ¶
func (sb *StatusBuilder) AddUser(id tailcfg.UserID, up tailcfg.UserProfile)
AddUser adds a user profile to the status.
func (*StatusBuilder) MutateSelfStatus ¶ added in v1.8.0
func (sb *StatusBuilder) MutateSelfStatus(f func(*PeerStatus))
MutateSelfStatus calls f with the PeerStatus of our own node to mutate.
It may not assume other fields of status are already populated, and may not retain or write to the Status after f returns.
MutateStatus acquires a lock so f must not call back into sb.
func (*StatusBuilder) MutateStatus ¶ added in v1.8.0
func (sb *StatusBuilder) MutateStatus(f func(*Status))
MutateStatus calls f with the status to mutate.
It may not assume other fields of status are already populated, and may not retain or write to the Status after f returns.
MutateStatus acquires a lock so f must not call back into sb.
func (*StatusBuilder) Status ¶
func (sb *StatusBuilder) Status() *Status
type StatusUpdater ¶
type StatusUpdater interface {
UpdateStatus(*StatusBuilder)
}
type TKAFilteredPeer ¶ added in v1.34.0
type TKAFilteredPeer struct { Name string // DNS ID tailcfg.NodeID StableID tailcfg.StableNodeID TailscaleIPs []netip.Addr // Tailscale IP(s) assigned to this node }
TKAFilteredPeer describes a peer which was removed from the netmap (i.e. no connectivity) because it failed tailnet lock checks.
func (*TKAFilteredPeer) Clone ¶ added in v1.34.0
func (src *TKAFilteredPeer) Clone() *TKAFilteredPeer
Clone makes a deep copy of TKAFilteredPeer. The result aliases no memory with the original.
type TailnetStatus ¶ added in v1.22.0
type TailnetStatus struct { // Name is the name of the network that's currently in use. Name string // MagicDNSSuffix is the network's MagicDNS suffix for nodes // in the network such as "userfoo.tailscale.net". // There are no surrounding dots. // MagicDNSSuffix should be populated regardless of whether a domain // has MagicDNS enabled. MagicDNSSuffix string // MagicDNSEnabled is whether or not the network has MagicDNS enabled. // Note that the current device may still not support MagicDNS if // `--accept-dns=false` was used. MagicDNSEnabled bool }
TailnetStatus is information about a Tailscale network ("tailnet").