tailscale.comtailscale.com/version Index | Files | Directories

package version

import "tailscale.com/version"

Package version provides the version that the binary was built at.

Index

Functions

func AtLeast

func AtLeast(version string, minimum string) bool

AtLeast returns whether version is at least the specified minimum version.

Version comparison in Tailscale is a little complex, because we switched "styles" a few times, and additionally have a completely separate track of version numbers for OSS-only builds.

AtLeast acts conservatively, returning true only if it's certain that version is at least minimum. As a result, it can produce false negatives, for example when an OSS build supports a given feature, but AtLeast is called with an official release number as the minimum

version and minimum can both be either an official Tailscale version numbers (major.minor.patch-extracommits-extrastring), or an OSS build datestamp (date.YYYYMMDD). For Tailscale version numbers, AtLeast also accepts a prefix of a full version, in which case all missing fields are assumed to be zero.

func CmdName

func CmdName() string

CmdName returns either the base name of the current binary using os.Executable. If os.Executable fails (it shouldn't), then "cmd" is returned.

func IsAppleTV

func IsAppleTV() bool

IsAppleTV reports whether this binary is part of the Tailscale network extension for tvOS. Needed because runtime.GOOS returns "ios" otherwise.

func IsMacAppStore

func IsMacAppStore() bool

IsMacAppStore returns whether this binary is from the App Store version of Tailscale for macOS. Returns true for both the network extension and the GUI app.

func IsMacAppStoreGUI

func IsMacAppStoreGUI() bool

IsMacAppStoreGUI reports whether this binary is the GUI app from the App Store version of Tailscale for macOS.

func IsMacGUIVariant

func IsMacGUIVariant() bool

IsMacGUIVariant reports whether runtime.GOOS=="darwin" and this one of the two GUI variants (that is, not tailscaled-on-macOS). This predicate should not be used to determine sandboxing properties. It's meant for callers to determine whether the NetworkExtension-like auto-netns is in effect.

func IsMacSys

func IsMacSys() bool

IsMacSys reports whether this process is part of the Standalone variant of Tailscale for macOS, either the main GUI process (non-sandboxed) or the system extension (sandboxed).

func IsMacSysExt

func IsMacSysExt() bool

IsMacSysExt reports whether this binary is the system extension shipped as part of the standalone "System Extension" (a.k.a. "macsys") version of Tailscale for macOS.

func IsMacSysGUI

func IsMacSysGUI() bool

IsMacSysGUI reports whether this process is the main, non-sandboxed GUI process that ships with the Standalone variant of Tailscale for macOS.

func IsMobile

func IsMobile() bool

IsMobile reports whether this is a mobile client build.

func IsRace

func IsRace() bool

IsRace reports whether the current binary was built with the Go race detector enabled.

func IsSandboxedMacOS

func IsSandboxedMacOS() bool

IsSandboxedMacOS reports whether this process is a sandboxed macOS process (either the app or the extension). It is true for the Mac App Store and macsys (System Extension) version on macOS, and false for tailscaled-on-macOS.

func IsUnstableBuild

func IsUnstableBuild() bool

IsUnstableBuild reports whether this is an unstable build. That is, whether its minor version number is odd.

func IsWindowsGUI

func IsWindowsGUI() bool

IsWindowsGUI reports whether the current process is the Windows GUI.

func Long

func Long() string

Long returns a full version number for this build, of one of the forms:

func OS

func OS() string

OS returns runtime.GOOS, except instead of returning "darwin" it returns "iOS" or "macOS".

func Short

func Short() string

Short returns a short version number for this build, of the forms:

func String

func String() string

Types

type Meta

type Meta struct {
	// MajorMinorPatch is the "major.minor.patch" version string, without
	// any hyphenated suffix.
	MajorMinorPatch string `json:"majorMinorPatch"`

	// IsDev is whether Short contains a -dev suffix. This is whether the build
	// is a development build (as opposed to an official stable or unstable
	// build stamped in the usual ways). If you just run "go install" or "go
	// build" on a dev branch, this will be true.
	IsDev bool `json:"isDev,omitempty"`

	// Short is MajorMinorPatch but optionally adding "-dev" or "-devYYYYMMDD"
	// for dev builds, depending on how it was build.
	Short string `json:"short"`

	// Long is the full version string, including git commit hash(es) as the
	// suffix.
	Long string `json:"long"`

	// UnstableBranch is whether the build is from an unstable (development)
	// branch. That is, it reports whether the minor version is odd.
	UnstableBranch bool `json:"unstableBranch,omitempty"`

	// GitCommit, if non-empty, is the git commit of the
	// github.com/tailscale/tailscale repository at which Tailscale was
	// built. Its format is the one returned by `git describe --always
	// --exclude "*" --dirty --abbrev=200`.
	GitCommit string `json:"gitCommit,omitempty"`

	// GitDirty is whether Go stamped the binary as having dirty version
	// control changes in the working directory (debug.ReadBuildInfo
	// setting "vcs.modified" was true).
	GitDirty bool `json:"gitDirty,omitempty"`

	// ExtraGitCommit, if non-empty, is the git commit of a "supplemental"
	// repository at which Tailscale was built. Its format is the same as
	// gitCommit.
	//
	// ExtraGitCommit is used to track the source revision when the main
	// Tailscale repository is integrated into and built from another
	// repository (for example, Tailscale's proprietary code, or the
	// Android OSS repository). Together, GitCommit and ExtraGitCommit
	// exactly describe what repositories and commits were used in a
	// build.
	ExtraGitCommit string `json:"extraGitCommit,omitempty"`

	// DaemonLong is the version number from the tailscaled
	// daemon, if requested.
	DaemonLong string `json:"daemonLong,omitempty"`

	// GitCommitTime is the commit time of the git commit in GitCommit.
	GitCommitTime string `json:"gitCommitTime,omitempty"`

	// Cap is the current Tailscale capability version. It's a monotonically
	// incrementing integer that's incremented whenever a new capability is
	// added.
	Cap int `json:"cap"`
}

Meta is a JSON-serializable type that contains all the version information.

func GetMeta

func GetMeta() Meta

GetMeta returns version metadata about the current build.

Source Files

cmdname.go cmp.go print.go prop.go race_off.go version.go

Directories

PathSynopsis
version/distroPackage distro reports which distro we're running on.
version/mkversionPackage mkversion gets version info from git and provides a bunch of differently formatted version strings that get used elsewhere in the build system to embed version numbers into binaries.
Version
v1.84.0 (latest)
Published
May 21, 2025
Platform
linux/amd64
Imports
16 packages
Last checked
1 day ago

Tools for package owners.