tailscale

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tailscale is the `tailscale` command as an adapter: this computer's own tailnet addresses and name, the lookup of a connecting device by its address, and the ports Tailscale's own Serve or Funnel configuration names (spc-2610040741034208, decision D3).

abcd does not speak Tailscale's local API itself: how to reach it differs between the macOS app, the macOS standalone build and Linux, and the command already knows. The adapter runs three read-only commands and no other: `status --json --peers=false`, `whois --json <address>` and `serve status --json`. It never asks for a certificate and never changes Tailscale's state (decisions 21 and 23 of itd-2610032150577708), which TestTheAdapterNeverAsksForACertificateOrChangesTailscale holds.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotInstalled: no `tailscale` command on PATH and no app bundle.
	ErrNotInstalled = errors.New("the tailscale command is not installed")
	// ErrUnsafeCommand: the command found sits where someone else could
	// replace it.
	ErrUnsafeCommand = errors.New("the tailscale command found is not safe to run")
	// ErrNotRunning: Tailscale is not running, not logged in, or names no
	// address or name for this computer.
	ErrNotRunning = errors.New("Tailscale is not running on this computer")
	// ErrVersionBelowFloor: the installed release is older than VersionFloor.
	ErrVersionBelowFloor = errors.New("the installed Tailscale is older than this abcd reads")
)

The adapter's refusals, each a sentinel a caller can test with errors.Is.

View Source
var BundledCommands = []string{"/Applications/Tailscale.app/Contents/MacOS/Tailscale"}

BundledCommands are the places the macOS app keeps its command, tried in order when PATH names none. The app's own wrapper on PATH execs the first.

View Source
var VersionFloor = [2]int{1, 102}

VersionFloor is the oldest Tailscale release whose command output this adapter has been shown to read, as major and minor. Source: the dated live receipt of 2026-10-05 (spc-2610040741034208 step 1, kept in the local tier), which ran `status --json --peers=false` and `whois --json` against 1.102.4 on macOS and recorded the keys parsed here; the status JSON's own help warns that the format changes between releases, so an older release is refused rather than read on trust.

Functions

func Resolve

func Resolve(lookPath func(string) (string, error), bundled []string, tree string) (string, error)

Resolve finds the command once: on PATH through lookPath, then at the first of bundled that exists. It refuses, with ErrUnsafeCommand, a command that is not an absolute path, that sits inside the working tree (tree), in a world-writable folder, or that is itself world-writable: the conditions the plugin hooks refuse for abcd's own binary, because whoever can replace the command decides who the dashboard lets in.

Types

type Client

type Client struct {
	// Path is the resolved command (Resolve).
	Path string
	// contains filtered or unexported fields
}

Client runs the resolved command.

func New

func New(path string) *Client

New is a client for the command at path.

func (*Client) ServedPorts

func (c *Client) ServedPorts(ctx context.Context) ([]uint16, error)

ServedPorts lists every port Tailscale's own Serve or Funnel configuration names, sorted, so the dashboard never takes one. An answer that is not JSON is an error, never read as no configuration.

func (*Client) Status

func (c *Client) Status(ctx context.Context) (Self, error)

Status reads this computer's name and addresses. It refuses with ErrNotRunning when the backend is not running or names no address or name, and with ErrVersionBelowFloor below VersionFloor.

func (*Client) WhoIs

func (c *Client) WhoIs(ctx context.Context, addr netip.Addr) (Identity, error)

WhoIs asks Tailscale who is at addr. A failing lookup, or one naming no device or no person, is an error: the caller refuses the connection.

type Identity

type Identity struct {
	// Node is the device's stable id, the key a device is counted by.
	Node string `json:"node"`
	// Device is the device's name on the tailnet.
	Device string `json:"device"`
	// Login is the person's login name.
	Login string `json:"login"`
	// Person is the person's display name.
	Person string `json:"person"`
	// Tagged is set when the device carries a tag: it names a machine, not
	// a person.
	Tagged bool `json:"tagged"`
	// Shared is set when the device was shared into this tailnet from
	// another account: it belongs to someone else.
	Shared bool `json:"shared"`
}

Identity is what Tailscale's lookup says about a connecting address.

type Self

type Self struct {
	// Name is the computer's MagicDNS name, without the trailing dot.
	Name string
	// Addrs are the computer's own Tailscale addresses, in the order
	// Tailscale lists them.
	Addrs []netip.Addr
	// Version is the release string Tailscale reports.
	Version string
}

Self is this computer as Tailscale names it.

Jump to

Keyboard shortcuts

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