Help us shape the future of Go! Take the 2026 Go Developer Survey

tools

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package tools defines tailkeeper's tools. M1 contains the read tools for the Tailscale API and the node's local CLI (spec §6, §18).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(r *registry.Registry)

Register adds every M1 tool to r.

Types

type ACLGetInput

type ACLGetInput struct {
	FromLine int `json:"fromLine,omitempty" jsonschema:"first line of the page, from 1 (default 1); use nextLine from the previous page"`
	MaxBytes int `` /* 212-byte string literal not displayed */
}

ACLGetInput selects a page of the policy.

type ACLGetOutput

type ACLGetOutput struct {
	Policy                string `` /* 228-byte string literal not displayed */
	FromLine              int    `json:"fromLine"`
	ToLine                int    `json:"toLine"`
	Lines                 int    `json:"lines" jsonschema:"lines in the whole policy"`
	NextLine              int    `json:"nextLine" jsonschema:"fromLine of the next page; 0 on the last page"`
	Truncated             bool   `json:"truncated" jsonschema:"more lines follow this page"`
	Masked                bool   `json:"masked" jsonschema:"email addresses on this page were masked"`
	Bytes                 int    `` /* 176-byte string literal not displayed */
	SHA256                string `json:"sha256" jsonschema:"SHA-256 of the whole policy, of the same bytes as bytes"`
	ETag                  string `` /* 147-byte string literal not displayed */
	ExternallyManaged     string `` /* 140-byte string literal not displayed */
	ExternalLink          string `json:"externalLink,omitempty" tk:"untrusted,plain"`
	ExternallyManagedNote string `json:"externallyManagedNote,omitempty" jsonschema:"why externallyManaged is unknown"`
}

ACLGetOutput is a page of the policy and facts about the whole file.

func (ACLGetOutput) Block

func (o ACLGetOutput) Block() (int, string)

Block lets the CLI print the page as a document: these fields first, then the policy lines with their numbers.

type ACLTestInput

type ACLTestInput struct {
	Src    string   `` /* 129-byte string literal not displayed */
	Accept []string `` /* 132-byte string literal not displayed */
	Deny   []string `json:"deny,omitempty" jsonschema:"destinations src must not reach, as host:port"`
	Proto  string   `` /* 126-byte string literal not displayed */
}

ACLTestInput is one test: a source and the destinations it must or must not reach.

type ACLTestOutput

type ACLTestOutput struct {
	Status      string          `json:"status" jsonschema:"pass: every destination matched as asked; fail: at least one did not"`
	Failures    []ACLTestResult `json:"failures,omitempty" tk:"details"`
	Warnings    []string        `json:"warnings,omitempty" tk:"untrusted,emails,details"`
	EvaluatedAt string          `json:"evaluatedAt"`
	Note        string          `json:"note"`
}

ACLTestOutput is the live policy's answer.

func (ACLTestOutput) Details

func (o ACLTestOutput) Details() []string

Details lets the CLI print each reason on its own line instead of one capped cell, after a notice that the reasons are Tailscale's text, not tailkeeper's.

func (ACLTestOutput) ExitCode

func (o ACLTestOutput) ExitCode() int

ExitCode makes the CLI exit 9 (the spec's tests_failed) for a failed test.

type ACLTestResult

type ACLTestResult struct {
	Src    string   `json:"src" tk:"untrusted,emails"`
	Errors []string `json:"errors" tk:"untrusted,emails"`
}

ACLTestResult is Tailscale's reasons for a failed source.

type Acceptor

type Acceptor struct {
	ID        int64  `json:"id"`
	LoginName string `json:"loginName" tk:"untrusted,personal"`
}

Acceptor is who accepted an invite.

type AuditActor

type AuditActor struct {
	ID          string   `json:"id,omitempty"`
	Type        string   `json:"type,omitempty"`
	LoginName   string   `json:"loginName,omitempty" tk:"untrusted,personal"`
	DisplayName string   `json:"displayName,omitempty" tk:"untrusted,personal"`
	Tags        []string `json:"tags,omitempty" tk:"untrusted"`
}

AuditActor is who made a change.

type AuditEntry

type AuditEntry struct {
	EventTime     string      `json:"eventTime" tk:"col"`
	DeferredAt    string      `json:"deferredAt,omitempty"`
	EventGroupID  string      `json:"eventGroupId,omitempty"`
	Origin        string      `json:"origin" tk:"col"`
	Action        string      `json:"action" tk:"col"`
	Actor         AuditActor  `json:"actor"`
	Target        AuditTarget `json:"target"`
	OldDigest     string      `` /* 214-byte string literal not displayed */
	NewDigest     string      `json:"newDigest,omitempty" jsonschema:"as oldDigest"`
	OldPreview    string      `json:"oldPreview,omitempty" tk:"untrusted,premasked"`
	NewPreview    string      `json:"newPreview,omitempty" tk:"untrusted,premasked"`
	ActionDetails string      `json:"actionDetails,omitempty" tk:"untrusted"`
	Error         string      `json:"error,omitempty" tk:"untrusted"`
}

AuditEntry is one configuration audit-log entry. old/new can hold whole policy files and personal data, so they are returned as a digest and, only on request (includeValues), a short untrusted preview.

type AuditLogInput

type AuditLogInput struct {
	Start         string   `json:"start,omitempty" jsonschema:"RFC 3339 start (default end minus 24h)"`
	End           string   `json:"end,omitempty" jsonschema:"RFC 3339 end (default now); the window may span at most 31 days"`
	Actor         []string `` /* 273-byte string literal not displayed */
	Target        []string `` /* 457-byte string literal not displayed */
	Event         []string `json:"event,omitempty" jsonschema:"event names such as TAILNET.UPDATE.ACL (server-side)"`
	Origin        []string `json:"origin,omitempty" jsonschema:"origins such as ADMIN_CONSOLE or CONFIG_API (client-side)"`
	IncludeValues bool     `` /* 474-byte string literal not displayed */
	Limit         int      `json:"limit,omitempty" jsonschema:"page size, 1-5000 (default 500)"`
	Cursor        string   `` /* 167-byte string literal not displayed */
}

AuditLogInput selects configuration audit-log entries. The API has no pagination: it returns the whole window, and tailkeeper pages over that response.

type AuditLogOutput

type AuditLogOutput struct {
	Entries     []AuditEntry `json:"entries" tk:"rows"`
	Count       int          `json:"count"`
	WindowStart string       `json:"windowStart"`
	WindowEnd   string       `json:"windowEnd"`
	NextCursor  string       `json:"nextCursor,omitempty"`
	Note        string       `json:"note"`
}

AuditLogOutput is one page of entries, oldest first.

type AuditTarget

type AuditTarget struct {
	ID          string `json:"id,omitempty"`
	Name        string `json:"name,omitempty" tk:"untrusted"`
	Type        string `json:"type,omitempty"`
	IsEphemeral bool   `json:"isEphemeral,omitempty"`
	Property    string `json:"property,omitempty" tk:"untrusted"`
}

AuditTarget is what changed.

type AuthKeyCaps

type AuthKeyCaps struct {
	Reusable      bool     `json:"reusable"`
	Ephemeral     bool     `json:"ephemeral"`
	Preauthorized bool     `json:"preauthorized"`
	Tags          []string `json:"tags,omitempty" tk:"untrusted"`
}

AuthKeyCaps are the capabilities of an auth key.

type Connectivity

type Connectivity struct {
	HardNAT            bool     `json:"hardNat" jsonschema:"mappingVariesByDestIP: the NAT maps differently per destination"`
	Supports           Supports `json:"supports"`
	PreferredDERP      string   `json:"preferredDerp,omitempty" tk:"untrusted"`
	PreferredLatencyMs float64  `json:"preferredLatencyMs,omitempty"`
}

Connectivity summarises clientConnectivity without public endpoints.

type Contact

type Contact struct {
	Email             string `json:"email,omitempty" tk:"untrusted,personal"`
	FallbackEmail     string `json:"fallbackEmail,omitempty" tk:"untrusted,personal"`
	NeedsVerification *bool  `json:"needsVerification" jsonschema:"null when the API did not say; only an explicit false counts as verified"`
}

Contact is one tailnet contact.

type ContactsOutput

type ContactsOutput struct {
	Account           *Contact `json:"account,omitempty"`
	Support           *Contact `json:"support,omitempty"`
	Security          *Contact `json:"security,omitempty"`
	SecurityContactOK bool     `` /* 134-byte string literal not displayed */
}

ContactsOutput lists the tailnet's contacts.

type DNSAnswer

type DNSAnswer struct {
	Name string `json:"name" tk:"untrusted,col"`
	Type string `json:"type" tk:"col"`
	TTL  int    `json:"ttl" tk:"col"`
	Body string `json:"body" tk:"untrusted,col,plain"`
}

DNSAnswer is one answer record.

type DNSOutput

type DNSOutput struct {
	Nameservers             []Resolver    `json:"nameservers"`
	SplitDNS                []SplitDomain `json:"splitDns"`
	SearchPaths             []string      `json:"searchPaths" tk:"untrusted"`
	MagicDNS                *bool         `json:"magicDns" jsonschema:"null when the API did not say"`
	OverrideLocalDNS        *bool         `json:"overrideLocalDns" jsonschema:"null when the API did not say"`
	PolicyOverridesAnalysed bool          `` /* 148-byte string literal not displayed */
}

DNSOutput is the tailnet's DNS configuration from /dns/configuration.

type DNSQueryInput

type DNSQueryInput struct {
	Name string `json:"name" jsonschema:"a name under the tailnet's MagicDNS suffix, or allowed by local.dnsQueryAllowlist"`
	Type string `json:"type,omitempty" jsonschema:"A (default), AAAA, CNAME, MX, NS, PTR, SRV or TXT"`
}

DNSQueryInput is a name lookup.

type DNSQueryOutput

type DNSQueryOutput struct {
	Name         string      `json:"name" tk:"untrusted"`
	Type         string      `json:"type"`
	ResponseCode string      `json:"responseCode"`
	Resolvers    []string    `json:"resolvers" tk:"untrusted,plain"`
	Answers      []DNSAnswer `json:"answers" tk:"rows"`
}

DNSQueryOutput is the lookup result.

type Device

type Device struct {
	NodeID                    string        `json:"nodeId" tk:"col"`
	Name                      string        `json:"name" tk:"untrusted,col"`
	Hostname                  string        `json:"hostname" tk:"untrusted"`
	User                      string        `json:"user" tk:"untrusted,col,personal"`
	OS                        string        `json:"os" tk:"untrusted,col"`
	Tags                      []string      `json:"tags,omitempty" tk:"untrusted"`
	Addresses                 []string      `json:"addresses,omitempty"`
	ClientVersion             string        `json:"clientVersion,omitempty" tk:"untrusted"`
	UpdateAvailable           bool          `json:"updateAvailable"`
	Created                   string        `json:"created,omitempty"`
	Expires                   string        `json:"expires,omitempty"`
	LastSeen                  string        `json:"lastSeen,omitempty" tk:"col"`
	ConnectedToControl        bool          `json:"connectedToControl" tk:"col"`
	KeyExpiryDisabled         bool          `json:"keyExpiryDisabled"`
	Authorized                bool          `json:"authorized"`
	IsExternal                bool          `json:"isExternal"`
	IsEphemeral               bool          `json:"isEphemeral"`
	BlocksIncomingConnections bool          `json:"blocksIncomingConnections"`
	TailnetLockError          string        `json:"tailnetLockError,omitempty" tk:"untrusted"`
	MultipleConnections       *bool         `json:"multipleConnections,omitempty"`
	SSHEnabled                *bool         `json:"sshEnabled,omitempty"`
	AdvertisedRoutes          []string      `json:"advertisedRoutes,omitempty" tk:"untrusted,plain"`
	EnabledRoutes             []string      `json:"enabledRoutes,omitempty" tk:"untrusted,plain"`
	Connectivity              *Connectivity `json:"connectivity,omitempty"`
	Distro                    *Distro       `json:"distro,omitempty" tk:"untrusted"`
	Fields                    string        `json:"fields" jsonschema:"default or all: which API field set was requested; fields absent here are unknown, not false"`
}

Device is the device shape tailkeeper returns.

type DeviceInvite

type DeviceInvite struct {
	ID              string    `json:"id" tk:"col"`
	Created         string    `json:"created,omitempty"`
	DeviceID        int64     `json:"deviceId,omitempty"`
	SharerID        int64     `json:"sharerId,omitempty"`
	MultiUse        bool      `json:"multiUse" tk:"col"`
	AllowExitNode   bool      `json:"allowExitNode" tk:"col"`
	Email           string    `json:"email,omitempty" tk:"untrusted,col,personal"`
	LastEmailSentAt string    `json:"lastEmailSentAt,omitempty"`
	Accepted        bool      `json:"accepted" tk:"col"`
	AcceptedBy      *Acceptor `json:"acceptedBy,omitempty"`
}

DeviceInvite is a device-share invite. inviteUrl is a bearer link and is never returned (spec §7.6).

type DeviceInvitesOutput

type DeviceInvitesOutput struct {
	NodeID  string         `json:"nodeId"`
	Invites []DeviceInvite `json:"invites" tk:"rows"`
	Count   int            `json:"count"`
}

DeviceInvitesOutput lists a device's invites.

type DevicePostureOutput

type DevicePostureOutput struct {
	NodeID     string             `json:"nodeId"`
	Attributes []PostureAttribute `json:"attributes" tk:"rows"`
}

DevicePostureOutput lists a device's posture attributes.

type DeviceRef

type DeviceRef struct {
	Device string `` /* 195-byte string literal not displayed */
}

DeviceRef names one device.

type DeviceRoutesInput

type DeviceRoutesInput struct {
	Device    string `` /* 195-byte string literal not displayed */
	IncludeHA bool   `` /* 130-byte string literal not displayed */
}

DeviceRoutesInput selects a device and optionally computes HA peers.

type DeviceRoutesOutput

type DeviceRoutesOutput struct {
	NodeID             string      `json:"nodeId"`
	Advertised         []string    `json:"advertised" tk:"untrusted,plain"`
	Enabled            []string    `json:"enabled" tk:"untrusted,plain"`
	Pending            []string    `json:"pending" jsonschema:"advertised but not approved" tk:"untrusted,plain"`
	Latent             []string    `json:"latent" jsonschema:"approved but not advertised: activates if this identity ever advertises it" tk:"untrusted,plain"`
	ExitNodeAdvertised bool        `json:"exitNodeAdvertised"`
	ExitNodeEnabled    bool        `json:"exitNodeEnabled"`
	HAPeers            []RoutePeer `json:"haPeers,omitempty"`
}

DeviceRoutesOutput shows route approval state.

type DevicesListInput

type DevicesListInput struct {
	Tags         []string `json:"tags,omitempty" jsonschema:"devices must carry all of these tags (server-side, exact)"`
	OS           string   `json:"os,omitempty" jsonschema:"exact OS name, for example linux, macOS, windows (server-side)"`
	Hostname     string   `` /* 162-byte string literal not displayed */
	User         string   `` /* 213-byte string literal not displayed */
	Ephemeral    *bool    `json:"ephemeral,omitempty" jsonschema:"filter on isEphemeral (server-side)"`
	Authorized   *bool    `json:"authorized,omitempty" jsonschema:"filter on authorized (server-side)"`
	Online       *bool    `json:"online,omitempty" jsonschema:"filter on connectedToControl (server-side)"`
	NameContains string   `` /* 202-byte string literal not displayed */
	StaleDays    int      `json:"staleDays,omitempty" jsonschema:"only devices not connected and last seen more than this many days ago (client-side)"`
	AllFields    bool     `json:"allFields,omitempty" jsonschema:"request fields=all: routes, connectivity, SSH, cloned-state flag"`
}

DevicesListInput filters devices. Server-side filters are exact matches.

type DevicesListOutput

type DevicesListOutput struct {
	Devices       []Device `json:"devices" tk:"rows"`
	Count         int      `json:"count"`
	Fields        string   `json:"fields"`
	ServerFilters []string `json:"serverFilters"`
	ClientFilters []string `json:"clientFilters"`
}

DevicesListOutput lists devices.

type Distro

type Distro struct {
	Name     string `json:"name,omitempty"`
	Version  string `json:"version,omitempty"`
	CodeName string `json:"codeName,omitempty"`
}

Distro is the reported OS distribution.

type Flow

type Flow struct {
	Kind    string `json:"kind" jsonschema:"virtual, subnet, exit or physical"`
	Proto   string `json:"proto" tk:"untrusted"`
	Src     string `json:"src" tk:"untrusted"`
	Dst     string `json:"dst" tk:"untrusted"`
	TxPkts  int64  `json:"txPkts"`
	TxBytes int64  `json:"txBytes"`
	RxPkts  int64  `json:"rxPkts"`
	RxBytes int64  `json:"rxBytes"`
}

Flow is one traffic counter in a flow-log record.

type FlowLogsInput

type FlowLogsInput struct {
	Start      string `json:"start,omitempty" jsonschema:"RFC 3339 start (default end minus 15m)"`
	End        string `json:"end,omitempty" jsonschema:"RFC 3339 end (default now); the window may span at most 1h"`
	Node       string `json:"node,omitempty" jsonschema:"only records logged by this node ID (client-side)"`
	MaxRecords int    `json:"maxRecords,omitempty" jsonschema:"1-10000 (default 1000)"`
}

FlowLogsInput selects a short window of network flow logs.

type FlowLogsOutput

type FlowLogsOutput struct {
	Status          string       `json:"status" jsonschema:"ok, not_enabled (flow logging is off) or not_available (not on this plan)"`
	LoggingEnabled  string       `` /* 131-byte string literal not displayed */
	Records         []FlowRecord `json:"records"`
	Count           int          `json:"count"`
	Truncated       bool         `json:"truncated"`
	AsOf            string       `json:"asOf"`
	MayBeIncomplete bool         `json:"mayBeIncomplete"`
	Note            string       `json:"note"`
}

FlowLogsOutput reports flow records or why there are none.

type FlowRecord

type FlowRecord struct {
	NodeID string `json:"nodeId"`
	Logged string `json:"logged"`
	Start  string `json:"start" tk:"untrusted"`
	End    string `json:"end" tk:"untrusted"`
	Flows  []Flow `json:"flows"`
}

FlowRecord is one node's 5-second window.

type IDRef

type IDRef struct {
	ID string `json:"id" jsonschema:"object ID"`
}

IDRef names an object by ID.

type InviteRef

type InviteRef struct {
	ID string `json:"id" jsonschema:"invite ID"`
}

InviteRef names one invite.

type Key

type Key struct {
	ID                  string            `json:"id" tk:"col"`
	KeyType             string            `json:"keyType" tk:"col"`
	Description         string            `json:"description,omitempty" tk:"untrusted,col"`
	Created             string            `json:"created,omitempty"`
	Updated             string            `json:"updated,omitempty"`
	Expires             string            `json:"expires,omitempty" tk:"col"`
	Revoked             string            `json:"revoked,omitempty"`
	Invalid             bool              `json:"invalid" tk:"col"`
	Scopes              []string          `json:"scopes,omitempty"`
	Tags                []string          `json:"tags,omitempty" tk:"untrusted"`
	AuthKeyCapabilities *AuthKeyCaps      `json:"authKeyCapabilities,omitempty"`
	UserID              string            `json:"userId,omitempty"`
	Issuer              string            `json:"issuer,omitempty" tk:"untrusted"`
	Subject             string            `json:"subject,omitempty" tk:"untrusted"`
	Audience            string            `json:"audience,omitempty" tk:"untrusted"`
	CustomClaimRules    map[string]string `json:"customClaimRules,omitempty" tk:"untrusted"`
}

Key is a key's metadata. The key material itself is never returned.

type KeyRef

type KeyRef struct {
	ID string `json:"id" jsonschema:"key ID"`
}

KeyRef names one key.

type KeysListOutput

type KeysListOutput struct {
	Keys     []Key             `json:"keys" tk:"rows"`
	Count    int               `json:"count"`
	Coverage map[string]string `json:"coverage" jsonschema:"per key type: visible, not_visible or unknown"`
	Complete *bool             `json:"complete,omitempty" jsonschema:"true only when every key type was visible; absent when unknown"`
}

KeysListOutput lists keys with an honest statement of what could be seen.

type LocalDNSStatusOutput

type LocalDNSStatusOutput struct {
	TailscaleDNS      bool          `json:"tailscaleDns" jsonschema:"the node accepts the tailnet DNS configuration (--accept-dns)"`
	MagicDNSEnabled   bool          `json:"magicDnsEnabled"`
	MagicDNSSuffix    string        `json:"magicDnsSuffix,omitempty" tk:"untrusted"`
	SelfDNSName       string        `json:"selfDnsName,omitempty" tk:"untrusted"`
	Resolvers         []string      `json:"resolvers" tk:"untrusted,plain" jsonschema:"the tailnet's resolvers in preference order; empty means system defaults"`
	SplitDNS          []SplitDomain `json:"splitDns"`
	SearchDomains     []string      `json:"searchDomains" tk:"untrusted"`
	SystemNameservers []string      `json:"systemNameservers" tk:"untrusted,plain"`
	SystemDNSError    string        `json:"systemDnsError,omitempty" tk:"untrusted"`
}

LocalDNSStatusOutput is the node's DNS view.

type LocalIPInput

type LocalIPInput struct {
	Peer   string `json:"peer,omitempty" jsonschema:"a peer's tailnet IP (default: this node)"`
	Family string `json:"family,omitempty" jsonschema:"4, 6 or 1 (first address only); default all"`
}

LocalIPInput selects which addresses local_ip prints.

type LocalIPOutput

type LocalIPOutput struct {
	Addresses []string `json:"addresses"`
}

LocalIPOutput lists addresses.

type LocalIdentity

type LocalIdentity struct {
	NodeID            string   `json:"nodeId"`
	Name              string   `json:"name" tk:"untrusted"`
	Addresses         []string `json:"addresses"`
	Tags              []string `json:"tags,omitempty" tk:"untrusted"`
	MachineAuthorized bool     `json:"machineAuthorized"`
	LoginName         string   `json:"loginName,omitempty" tk:"untrusted,personal"`
	DisplayName       string   `json:"displayName,omitempty" tk:"untrusted,personal"`
	Capabilities      []string `` /* 159-byte string literal not displayed */
}

LocalIdentity is a node and its user.

type LocalPeer

type LocalPeer struct {
	NodeID         string   `json:"nodeId" tk:"col"`
	HostName       string   `json:"hostName" tk:"untrusted,col"`
	DNSName        string   `json:"dnsName" tk:"untrusted"`
	OS             string   `json:"os,omitempty" tk:"untrusted,col"`
	TailscaleIPs   []string `json:"tailscaleIps"`
	Tags           []string `json:"tags,omitempty" tk:"untrusted"`
	Online         bool     `json:"online" tk:"col"`
	Active         bool     `json:"active"`
	Path           string   `json:"path,omitempty" tk:"col" jsonschema:"direct, peer-relay, derp or none (peers only)"`
	Relay          string   `json:"relay,omitempty" tk:"untrusted" jsonschema:"home DERP region code"`
	ExitNode       bool     `json:"exitNode"`
	ExitNodeOption bool     `json:"exitNodeOption"`
	LastHandshake  string   `json:"lastHandshake,omitempty"`
	KeyExpiry      string   `json:"keyExpiry,omitempty"`
}

LocalPeer is a node as the local daemon sees it.

type LocalStatusInput

type LocalStatusInput struct {
	Peers  bool `json:"peers,omitempty" jsonschema:"include peers"`
	Active bool `json:"active,omitempty" jsonschema:"include only peers with active sessions (implies peers)"`
}

LocalStatusInput selects what local_status includes.

type LocalStatusOutput

type LocalStatusOutput struct {
	BackendState    string      `json:"backendState"`
	NeedsLogin      bool        `json:"needsLogin"`
	Version         string      `json:"version" tk:"untrusted"`
	Self            *LocalPeer  `json:"self,omitempty"`
	Tailnet         string      `` /* 139-byte string literal not displayed */
	MagicDNSSuffix  string      `json:"magicDnsSuffix,omitempty" tk:"untrusted"`
	MagicDNSEnabled bool        `json:"magicDnsEnabled"`
	Health          []string    `json:"health" tk:"untrusted"`
	Peers           []LocalPeer `json:"peers,omitempty" tk:"rows"`
	PeerCount       int         `json:"peerCount"`
	PeerScope       string      `` /* 132-byte string literal not displayed */
}

LocalStatusOutput is this node's status.

type LockStatusOutput

type LockStatusOutput struct {
	Enabled          bool   `json:"enabled"`
	PublicKey        string `json:"publicKey,omitempty" jsonschema:"this node's Tailnet Lock public key" tk:"untrusted"`
	NodeKey          string `json:"nodeKey,omitempty" jsonschema:"this node's public node key" tk:"untrusted"`
	NodeKeySigned    *bool  `json:"nodeKeySigned,omitempty" jsonschema:"absent when Tailnet Lock is off"`
	TrustedKeyCount  int    `json:"trustedKeyCount"`
	VisiblePeerCount int    `json:"visiblePeerCount"`
	LockedOutPeers   int    `json:"lockedOutPeers" jsonschema:"peers filtered out because their node key is not signed"`
}

LockStatusOutput is Tailnet Lock as this node sees it.

type LogStreamConfig

type LogStreamConfig struct {
	DestinationType      string   `json:"destinationType,omitempty"`
	URL                  string   `json:"url,omitempty" tk:"untrusted,plain" jsonschema:"scheme and host only"`
	URLPathHash          string   `json:"urlPathSha256,omitempty" jsonschema:"SHA-256 of the URL's path and query, which can carry a collector token"`
	User                 string   `json:"user,omitempty" tk:"untrusted,personal"`
	UploadPeriodMinutes  int      `json:"uploadPeriodMinutes,omitempty"`
	CompressionFormat    string   `json:"compressionFormat,omitempty"`
	S3Bucket             string   `json:"s3Bucket,omitempty" tk:"untrusted"`
	S3Region             string   `json:"s3Region,omitempty" tk:"untrusted"`
	S3KeyPrefix          string   `json:"s3KeyPrefix,omitempty" tk:"untrusted"`
	S3AuthenticationType string   `json:"s3AuthenticationType,omitempty"`
	S3AccessKeyID        string   `json:"s3AccessKeyId,omitempty" tk:"untrusted"`
	S3RoleARN            string   `json:"s3RoleArn,omitempty" tk:"untrusted"`
	S3ExternalID         string   `json:"s3ExternalId,omitempty" tk:"untrusted"`
	GCSBucket            string   `json:"gcsBucket,omitempty" tk:"untrusted"`
	GCSKeyPrefix         string   `json:"gcsKeyPrefix,omitempty" tk:"untrusted"`
	GCSScopes            []string `json:"gcsScopes,omitempty" tk:"untrusted"`
}

LogStreamConfig is a destination without its secrets (token, S3 secret key and GCS credentials are never returned).

type LogStreamInput

type LogStreamInput struct {
	LogType string `json:"logType" jsonschema:"configuration or network"`
}

LogStreamInput names a log type.

type LogStreamOutput

type LogStreamOutput struct {
	LogType       string           `json:"logType"`
	Status        string           `json:"status" jsonschema:"configured or not_configured"`
	Configuration *LogStreamConfig `json:"configuration,omitempty"`
	Health        *LogStreamStatus `json:"health,omitempty"`
	HealthError   string           `json:"healthError,omitempty" jsonschema:"error code when delivery health could not be read"`
	Findings      []string         `json:"findings"`
}

LogStreamOutput describes one log stream.

type LogStreamStatus

type LogStreamStatus struct {
	LastActivity       string  `json:"lastActivity,omitempty"`
	LastError          string  `json:"lastError,omitempty" tk:"untrusted"`
	NumBytesSent       int64   `json:"numBytesSent"`
	NumEntriesSent     int64   `json:"numEntriesSent"`
	NumSpoofedEntries  int64   `json:"numSpoofedEntries"`
	NumTotalRequests   int64   `json:"numTotalRequests"`
	NumFailedRequests  int64   `json:"numFailedRequests"`
	RateFailedRequests float64 `json:"rateFailedRequests"`
}

LogStreamStatus is delivery health.

type Metric

type Metric struct {
	Name   string            `json:"name" tk:"col"`
	Labels map[string]string `json:"labels,omitempty" tk:"untrusted"`
	Value  float64           `json:"value" tk:"col"`
}

Metric is one sample.

type MetricsOutput

type MetricsOutput struct {
	Metrics []Metric `json:"metrics" tk:"rows"`
	Dropped int      `json:"dropped" jsonschema:"samples with undocumented names, not shown"`
}

MetricsOutput lists documented metrics.

func ParseMetrics

func ParseMetrics(text []byte) MetricsOutput

ParseMetrics parses Prometheus text, keeping documented metric names only.

type NetcheckOutput

type NetcheckOutput struct {
	UDP                   bool               `json:"udp"`
	IPv4                  bool               `json:"ipv4"`
	IPv6                  bool               `json:"ipv6"`
	IPv4CanSend           bool               `json:"ipv4CanSend"`
	IPv6CanSend           bool               `json:"ipv6CanSend"`
	OSHasIPv6             bool               `json:"osHasIpv6"`
	ICMPv4                bool               `json:"icmpv4"`
	MappingVariesByDestIP *bool              `json:"mappingVariesByDestIp,omitempty" jsonschema:"hard NAT when true; absent when unknown"`
	UPnP                  *bool              `json:"upnp,omitempty" jsonschema:"absent when unknown"`
	PMP                   *bool              `json:"pmp,omitempty" jsonschema:"absent when unknown"`
	PCP                   *bool              `json:"pcp,omitempty" jsonschema:"absent when unknown"`
	CaptivePortal         *bool              `json:"captivePortal,omitempty" jsonschema:"absent when unknown"`
	PreferredDERP         int                `json:"preferredDerp" jsonschema:"region ID; 0 when unknown"`
	RegionLatencyMs       map[string]float64 `json:"regionLatencyMs" jsonschema:"keyed by DERP region ID"`
}

NetcheckOutput is the local network report without public IP addresses.

type NoInput

type NoInput struct{}

NoInput is the input of tools without parameters.

type OAuthApp

type OAuthApp struct {
	ID                    string   `json:"id" tk:"col"`
	Name                  string   `json:"name" tk:"untrusted,col"`
	Description           string   `json:"description,omitempty" tk:"untrusted"`
	RedirectURIs          []string `json:"redirectURIs,omitempty" tk:"untrusted,plain"`
	Scopes                []string `json:"scopes,omitempty" tk:"col"`
	AllowedNodeAttributes []string `json:"allowedNodeAttributes,omitempty" tk:"untrusted"`
	Created               string   `json:"created,omitempty"`
	Updated               string   `json:"updated,omitempty"`
}

OAuthApp is an OAuth app without its client secret.

type OAuthAppsOutput

type OAuthAppsOutput struct {
	Apps  []OAuthApp `json:"apps" tk:"rows"`
	Count int        `json:"count"`
}

OAuthAppsOutput lists OAuth apps.

type PingInput

type PingInput struct {
	Target         string `json:"target" jsonschema:"literal tailnet IP of the peer"`
	Count          int    `json:"count,omitempty" jsonschema:"1-10 (default 3)"`
	TimeoutSeconds int    `json:"timeoutSeconds,omitempty" jsonschema:"per ping, 1-8 (default 5)"`
	Mode           string `json:"mode,omitempty" jsonschema:"disco (default), tsmp, icmp or peerapi"`
	AllPings       bool   `json:"allPings,omitempty" jsonschema:"send every ping; by default (like the CLI) disco pings stop at the first direct reply"`
}

PingInput configures local_ping.

type PingOutput

type PingOutput struct {
	Target               string      `json:"target"`
	Mode                 string      `json:"mode"`
	Replies              []PingReply `json:"replies" tk:"rows"`
	Timeouts             int         `json:"timeouts"`
	DirectEstablished    bool        `json:"directEstablished"`
	DirectNotEstablished bool        `json:"directNotEstablished" jsonschema:"the CLI gave up waiting for a direct path"`
	NoReply              bool        `json:"noReply" jsonschema:"no ping was answered"`
	UnparsedLines        int         `json:"unparsedLines"`
	Note                 string      `json:"note"`
}

PingOutput summarises a ping run.

type PingReply

type PingReply struct {
	Via       string  `json:"via" tk:"col" jsonschema:"direct, derp, peer-relay, icmp, tsmp or peerapi"`
	Region    string  `json:"region,omitempty" tk:"untrusted,col" jsonschema:"DERP region code, for derp replies"`
	LatencyMs float64 `json:"latencyMs" tk:"col"`
}

PingReply is one parsed reply line.

type PingResult

type PingResult struct {
	Replies  []PingReply
	Timeouts int
	Direct   bool
	Unparsed int
}

PingResult is what ParsePing extracts from the CLI's stdout.

func ParsePing

func ParsePing(out []byte) PingResult

ParsePing parses `tailscale ping` stdout. Formats are those printed by cmd/tailscale/cli/ping.go; latencies are Go durations ("0s", "12ms", "1.2s").

type Policy

type Policy struct {
	Name   string `json:"name" tk:"untrusted,col"`
	Value  string `json:"value" tk:"untrusted,col"`
	Origin string `json:"origin,omitempty" tk:"untrusted,col"`
	Error  string `json:"error,omitempty" tk:"untrusted"`
}

Policy is one effective system policy.

type PostureAttribute

type PostureAttribute struct {
	Attribute string `json:"attribute" tk:"untrusted,col"`
	Value     string `json:"value" tk:"untrusted,col"`
	Type      string `json:"type" tk:"col"`
	Expiry    string `json:"expiry,omitempty" tk:"col"`
}

PostureAttribute is one device posture attribute.

type PostureIntegration

type PostureIntegration struct {
	ID            string         `json:"id" tk:"col"`
	Provider      string         `json:"provider" tk:"col"`
	CloudID       string         `json:"cloudId,omitempty" tk:"untrusted"`
	ClientID      string         `json:"clientId,omitempty" tk:"untrusted"`
	TenantID      string         `json:"tenantId,omitempty" tk:"untrusted"`
	ConfigUpdated string         `json:"configUpdated,omitempty"`
	Status        *PostureStatus `json:"status,omitempty"`
}

PostureIntegration is an EDR/MDM integration without its client secret.

type PostureIntegrationsOutput

type PostureIntegrationsOutput struct {
	Integrations []PostureIntegration `json:"integrations" tk:"rows"`
	Count        int                  `json:"count"`
}

PostureIntegrationsOutput lists integrations.

type PostureStatus

type PostureStatus struct {
	LastSync             string `json:"lastSync,omitempty"`
	Error                string `json:"error,omitempty" tk:"untrusted"`
	ProviderHostCount    int    `json:"providerHostCount"`
	MatchedCount         int    `json:"matchedCount"`
	PossibleMatchedCount int    `json:"possibleMatchedCount"`
}

PostureStatus is the integration's sync health.

type Pref

type Pref struct {
	Name  string `json:"name" tk:"col"`
	Value string `json:"value" tk:"untrusted,col,plain"`
}

Pref is one client preference.

type PrefsOutput

type PrefsOutput struct {
	Prefs []Pref `json:"prefs" tk:"rows"`
}

PrefsOutput lists preferences.

type Resolver

type Resolver struct {
	Address         string `json:"address" tk:"untrusted,plain"`
	UseWithExitNode bool   `json:"useWithExitNode"`
}

Resolver is one DNS resolver.

type RoutePeer

type RoutePeer struct {
	Prefix string `json:"prefix" tk:"untrusted,plain"`
	NodeID string `json:"nodeId"`
	Name   string `json:"name" tk:"untrusted"`
}

RoutePeer is another device serving the same prefix.

type ServeEntry

type ServeEntry struct {
	Source   string   `json:"source" tk:"col" jsonschema:"background, foreground or service"`
	Service  string   `json:"service,omitempty" tk:"untrusted,col" jsonschema:"Tailscale Service name, for source service"`
	Listener string   `json:"listener" tk:"untrusted,col" jsonschema:"host:port for web listeners, port for TCP"`
	Kind     string   `json:"kind" tk:"col" jsonschema:"web, https, http, tcp-forward or tun"`
	Paths    []string `json:"paths,omitempty" tk:"untrusted,col"`
	Handlers []string `json:"handlers,omitempty" tk:"col" jsonschema:"handler kinds: proxy, path, text or redirect"`
	Funnel   bool     `json:"funnel" tk:"col" jsonschema:"exposed to the public internet"`
}

ServeEntry is one served endpoint. Targets (local ports, file paths, URLs, text) are reduced to their kind.

type ServeOutput

type ServeOutput struct {
	Entries []ServeEntry `json:"entries" tk:"rows"`
	Count   int          `json:"count"`
}

ServeOutput lists served endpoints.

func ServeStatus

func ServeStatus(c cliServe, funnelOnly bool) ServeOutput

ServeStatus flattens a serve config: background, then foreground sessions, then Services. Funnel applies to the node's own listeners, not to Services.

type Service

type Service struct {
	Name        string   `json:"name" tk:"untrusted,col"`
	DisplayName string   `json:"displayName,omitempty" tk:"untrusted"`
	Addrs       []string `json:"addrs,omitempty" tk:"col"`
	Comment     string   `json:"comment,omitempty" tk:"untrusted"`
	Ports       []string `json:"ports,omitempty" tk:"untrusted,col"`
	Tags        []string `json:"tags,omitempty" tk:"untrusted"`
}

Service is a Tailscale Service.

type ServiceRef

type ServiceRef struct {
	Name string `json:"name" jsonschema:"service name, for example svc:web"`
}

ServiceRef names one service.

type ServicesOutput

type ServicesOutput struct {
	Services []Service `json:"services" tk:"rows"`
	Count    int       `json:"count"`
}

ServicesOutput lists services.

type Settings

type Settings struct {
	DevicesApprovalOn                      *bool   `json:"devicesApprovalOn,omitempty"`
	DevicesAutoUpdatesOn                   *bool   `json:"devicesAutoUpdatesOn,omitempty"`
	DevicesKeyDurationDays                 *int    `json:"devicesKeyDurationDays,omitempty"`
	UsersApprovalOn                        *bool   `json:"usersApprovalOn,omitempty"`
	UsersRoleAllowedToJoinExternalTailnets *string `json:"usersRoleAllowedToJoinExternalTailnets,omitempty"`
	NetworkFlowLoggingOn                   *bool   `json:"networkFlowLoggingOn,omitempty"`
	RegionalRoutingOn                      *bool   `json:"regionalRoutingOn,omitempty"`
	RouteSelection                         *string `json:"routeSelection,omitempty"`
	PostureIdentityCollectionOn            *bool   `json:"postureIdentityCollectionOn,omitempty"`
	HTTPSEnabled                           *bool   `json:"httpsEnabled,omitempty"`
	ACLsExternallyManagedOn                *bool   `json:"aclsExternallyManagedOn,omitempty"`
	ACLsExternalLink                       *string `json:"aclsExternalLink,omitempty" tk:"untrusted,plain"`
}

Settings mirrors the API's TailnetSettings. Every field is a pointer: a field the read credential cannot see is absent, and absent must never read as false.

type SettingsOutput

type SettingsOutput struct {
	Settings          Settings `json:"settings"`
	Unreadable        []string `` /* 150-byte string literal not displayed */
	ExternallyManaged string   `json:"externallyManaged" jsonschema:"true, false or unknown"`
}

SettingsOutput reports the settings, which fields could not be read, and the GitOps lock state (spec §11.1).

type SplitDomain

type SplitDomain struct {
	Domain    string     `json:"domain" tk:"untrusted"`
	Resolvers []Resolver `json:"resolvers"`
}

SplitDomain is a split-DNS route.

type Supports

type Supports struct {
	IPv6 *bool `json:"ipv6,omitempty"`
	PCP  *bool `json:"pcp,omitempty"`
	PMP  *bool `json:"pmp,omitempty"`
	UDP  *bool `json:"udp,omitempty"`
	UPnP *bool `json:"upnp,omitempty"`
}

Supports reports NAT traversal features (nil = unknown).

type SyspolicyOutput

type SyspolicyOutput struct {
	Scope    string   `json:"scope,omitempty" tk:"untrusted"`
	Policies []Policy `json:"policies" tk:"rows"`
}

SyspolicyOutput lists effective policies.

type User

type User struct {
	ID                 string `json:"id" tk:"col"`
	LoginName          string `json:"loginName" tk:"untrusted,col,personal"`
	DisplayName        string `json:"displayName,omitempty" tk:"untrusted,personal"`
	TailnetID          string `json:"tailnetId,omitempty" tk:"personal"`
	Created            string `json:"created,omitempty"`
	Type               string `json:"type" tk:"col"`
	Role               string `json:"role" tk:"col"`
	Status             string `json:"status" tk:"col"`
	DeviceCount        int    `json:"deviceCount" tk:"col"`
	LastSeen           string `json:"lastSeen,omitempty"`
	CurrentlyConnected bool   `json:"currentlyConnected"`
}

User is a tailnet user.

type UserInvite

type UserInvite struct {
	ID              string `json:"id" tk:"col"`
	Role            string `json:"role" tk:"col"`
	InviterID       int64  `json:"inviterId,omitempty"`
	Email           string `json:"email,omitempty" tk:"untrusted,col,personal"`
	LastEmailSentAt string `json:"lastEmailSentAt,omitempty" tk:"col"`
}

UserInvite is a user invite. inviteUrl is never returned.

type UserInvitesOutput

type UserInvitesOutput struct {
	Invites []UserInvite `json:"invites" tk:"rows"`
	Count   int          `json:"count"`
}

UserInvitesOutput lists open user invites.

type UserRef

type UserRef struct {
	ID string `json:"id" jsonschema:"user ID"`
}

UserRef names one user.

type UsersListInput

type UsersListInput struct {
	Type string `json:"type,omitempty" jsonschema:"member, shared or all (default all; the API's own default hides shared users)"`
	Role string `json:"role,omitempty" jsonschema:"owner, member, admin, it-admin, network-admin, billing-admin, auditor or all (default all)"`
}

UsersListInput filters users. Unlike the API, type defaults to all.

type UsersListOutput

type UsersListOutput struct {
	Users []User `json:"users" tk:"rows"`
	Count int    `json:"count"`
	Type  string `json:"type"`
}

UsersListOutput lists users.

type VersionOutput

type VersionOutput struct {
	CLI       string   `json:"cli" tk:"untrusted"`
	Daemon    string   `json:"daemon,omitempty" tk:"untrusted"`
	OSVariant string   `json:"osVariant,omitempty" tk:"untrusted"`
	Skew      bool     `json:"skew" jsonschema:"CLI and daemon release versions differ"`
	Warnings  []string `json:"warnings" tk:"untrusted"`
}

VersionOutput reports CLI and daemon versions.

type Webhook

type Webhook struct {
	EndpointID       string   `json:"endpointId" tk:"col"`
	EndpointHost     string   `json:"endpointHost" tk:"untrusted,col,plain"`
	EndpointPathHash string   `json:"endpointPathSha256,omitempty"`
	ProviderType     string   `json:"providerType,omitempty" tk:"col"`
	CreatorLoginName string   `json:"creatorLoginName,omitempty" tk:"untrusted,personal"`
	Created          string   `json:"created,omitempty"`
	LastModified     string   `json:"lastModified,omitempty"`
	Subscriptions    []string `json:"subscriptions"`
}

Webhook is a webhook endpoint. The secret is never returned, and the endpoint URL is reduced to scheme and host plus a hash of the path, because chat-provider webhook URLs carry a bearer token in the path.

type WebhookRef

type WebhookRef struct {
	ID string `json:"id" jsonschema:"webhook endpoint ID"`
}

WebhookRef names one webhook.

type WebhooksOutput

type WebhooksOutput struct {
	Webhooks []Webhook `json:"webhooks" tk:"rows"`
	Count    int       `json:"count"`
}

WebhooksOutput lists webhooks.

type WhoisInput

type WhoisInput struct {
	Address string `json:"address" jsonschema:"tailnet IP, or IP:port"`
	Proto   string `json:"proto,omitempty" jsonschema:"tcp or udp (with a port); empty means both"`
}

WhoisInput names a tailnet address, optionally with a port.

Jump to

Keyboard shortcuts

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