feature

package
v1.92.4 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: BSD-3-Clause Imports: 11 Imported by: 4

Documentation

Overview

Package feature tracks which features are linked into the binary.

Index

Constants

View Source
const CanSystemdStatus = runtime.GOOS == "linux" && buildfeatures.HasSDNotify

CanSystemdStatus reports whether the current build has systemd notifications linked in.

It's effectively the same as HookSystemdStatus.IsSet(), but a constant for dead code elimination reasons.

Variables

View Source
var ErrUnavailable = errors.New("feature not included in this build")

Functions

func CanAutoUpdate added in v1.90.0

func CanAutoUpdate() bool

CanAutoUpdate reports whether the current binary is built with auto-update support and, if so, whether the current platform supports it.

func HardwareAttestationAvailable added in v1.90.0

func HardwareAttestationAvailable() bool

HardwareAttestationAvailable reports whether hardware attestation is supported and available (TPM on Windows/Linux, Secure Enclave on macOS|iOS, KeyStore on Android)

func Register

func Register(name string)

Register notes that the named feature is linked into the binary.

func Registered added in v1.90.4

func Registered() map[string]bool

Registered reports the set of registered features.

The returned map should not be modified by the caller, not accessed concurrently with calls to Register.

func SystemdStatus added in v1.90.0

func SystemdStatus(format string, args ...any)

SystemdStatus sends a single line status update to systemd so that information shows up in systemctl output.

It does nothing on non-Linux systems or if the binary was built without the sdnotify feature.

func TPMAvailable added in v1.90.0

func TPMAvailable() bool

TPMAvailable reports whether a TPM device is supported and available.

Types

type Hook

type Hook[Func any] struct {
	// contains filtered or unexported fields
}

Hook is a func that can only be set once.

It is not safe for concurrent use.

var HookCanAutoUpdate Hook[func() bool]

HookCanAutoUpdate is a hook for the clientupdate package to conditionally initialize.

var HookGenerateAttestationKeyIfEmpty Hook[func(p *persist.Persist, logf logger.Logf) (bool, error)]
var HookHardwareAttestationAvailable Hook[func() bool]

HookHardwareAttestationAvailable is a hook that reports whether hardware attestation is supported and available.

var HookProxyFromEnvironment Hook[func(*http.Request) (*url.URL, error)]

HookProxyFromEnvironment is a hook for feature/useproxy to register a function to use as http.ProxyFromEnvironment.

var HookProxyGetAuthHeader Hook[func(*url.URL) (string, error)]

HookProxyGetAuthHeader is a hook for feature/useproxy to register [tshttpproxy.GetAuthHeader].

var HookProxyInvalidateCache Hook[func()]

HookProxyInvalidateCache is a hook for feature/useproxy to register [tshttpproxy.InvalidateCache].

var HookProxySetSelfProxy Hook[func(...string)]

HookProxySetSelfProxy is a hook for feature/useproxy to register [tshttpproxy.SetSelfProxy].

var HookProxySetTransportGetProxyConnectHeader Hook[func(*http.Transport)]

HookProxySetTransportGetProxyConnectHeader is a hook for feature/useproxy to register [tshttpproxy.SetTransportGetProxyConnectHeader].

var HookSystemdReady Hook[func()]

HookSystemdReady sends a readiness to systemd. This will unblock service dependents from starting.

var HookSystemdStatus Hook[func(format string, args ...any)]

HookSystemdStatus holds a func that will send a single line status update to systemd so that information shows up in systemctl output.

var HookTPMAvailable Hook[func() bool]

HookTPMAvailable is a hook that reports whether a TPM device is supported and available.

func (*Hook[Func]) Get

func (h *Hook[Func]) Get() Func

Get returns the hook function, or panics if it hasn't been set. Use IsSet to check if it's been set, or use GetOrNil if you're okay with a nil return value.

func (*Hook[Func]) GetOk added in v1.84.0

func (h *Hook[Func]) GetOk() (f Func, ok bool)

GetOk returns the hook function and true if it has been set, otherwise its zero value and false.

func (*Hook[Func]) GetOrNil added in v1.90.0

func (h *Hook[Func]) GetOrNil() Func

GetOrNil returns the hook function or nil if it hasn't been set.

func (*Hook[Func]) IsSet

func (h *Hook[Func]) IsSet() bool

IsSet reports whether the hook has been set.

func (*Hook[Func]) Set

func (h *Hook[Func]) Set(f Func)

Set sets the hook function, panicking if it's already been set or f is the zero value.

It's meant to be called in init.

func (*Hook[Func]) SetForTest added in v1.92.0

func (h *Hook[Func]) SetForTest(f Func) (restore func())

SetForTest sets the hook function for tests, blowing away any previous value. It will panic if called from non-test code.

It returns a restore function that resets the hook to its previous value.

type Hooks added in v1.84.0

type Hooks[Func any] []Func

Hooks is a slice of funcs.

As opposed to a single Hook, this is meant to be used when multiple parties are able to install the same hook.

func (*Hooks[Func]) Add added in v1.84.0

func (h *Hooks[Func]) Add(f Func)

Add adds a hook to the list of hooks.

Add should only be called during early program startup before Tailscale has started. It is not safe for concurrent use.

Directories

Path Synopsis
Package ace registers support for Alternate Connectivity Endpoints (ACE).
Package ace registers support for Alternate Connectivity Endpoints (ACE).
Package appconnectors registers support for Tailscale App Connectors.
Package appconnectors registers support for Tailscale App Connectors.
The buildfeatures package contains boolean constants indicating which features were included in the binary (via build tags), for use in dead code elimination when using separate build tag protected files is impractical or undesirable.
The buildfeatures package contains boolean constants indicating which features were included in the binary (via build tags), for use in dead code elimination when using separate build tag protected files is impractical or undesirable.
Package c2n registers support for C2N (Control-to-Node) communications.
Package c2n registers support for C2N (Control-to-Node) communications.
Package capture formats packet logging into a debug pcap stream.
Package capture formats packet logging into a debug pcap stream.
dissector
Package dissector contains the Lua dissector for Tailscale packets.
Package dissector contains the Lua dissector for Tailscale packets.
Package clientupdate enables the client update feature.
Package clientupdate enables the client update feature.
condlite
expvar
Package expvar contains type aliases for expvar types, to allow conditionally excluding the package from builds.
Package expvar contains type aliases for expvar types, to allow conditionally excluding the package from builds.
The condregister package registers all conditional features guarded by build tags.
The condregister package registers all conditional features guarded by build tags.
identityfederation
Package identityfederation registers support for authkey resolution via identity federation if it's not disabled by the ts_omit_identityfederation build tag.
Package identityfederation registers support for authkey resolution via identity federation if it's not disabled by the ts_omit_identityfederation build tag.
oauthkey
Package oauthkey registers support for OAuth key resolution if it's not disabled via the ts_omit_oauthkey build tag.
Package oauthkey registers support for OAuth key resolution if it's not disabled via the ts_omit_oauthkey build tag.
portmapper
Package portmapper registers support for portmapper if it's not disabled via the ts_omit_portmapper build tag.
Package portmapper registers support for portmapper if it's not disabled via the ts_omit_portmapper build tag.
useproxy
Package useproxy registers support for using proxies if it's not disabled via the ts_omit_useproxy build tag.
Package useproxy registers support for using proxies if it's not disabled via the ts_omit_useproxy build tag.
Package debugportmapper registers support for debugging Tailscale's portmapping support.
Package debugportmapper registers support for debugging Tailscale's portmapping support.
The doctor package registers the "doctor" problem diagnosis support into the rest of Tailscale.
The doctor package registers the "doctor" problem diagnosis support into the rest of Tailscale.
Package drive registers the Taildrive (file server) feature.
Package drive registers the Taildrive (file server) feature.
The featuretags package is a registry of all the ts_omit-able build tags.
The featuretags package is a registry of all the ts_omit-able build tags.
Package identityfederation registers support for using ID tokens to automatically request authkeys for logging in.
Package identityfederation registers support for using ID tokens to automatically request authkeys for logging in.
Package linkspeed registers support for setting the TUN link speed on Linux, to better integrate with system monitoring tools.
Package linkspeed registers support for setting the TUN link speed on Linux, to better integrate with system monitoring tools.
Package linuxdnsfight provides Linux support for detecting DNS fights (inotify watching of /etc/resolv.conf).
Package linuxdnsfight provides Linux support for detecting DNS fights (inotify watching of /etc/resolv.conf).
Package oauthkey registers support for using OAuth client secrets to automatically request authkeys for logging in.
Package oauthkey registers support for using OAuth client secrets to automatically request authkeys for logging in.
Package portlist contains code to poll the local system for open ports and report them to the control plane, if enabled on the tailnet.
Package portlist contains code to poll the local system for open ports and report them to the control plane, if enabled on the tailnet.
Package portmapper registers support for NAT-PMP, PCP, and UPnP port mapping protocols to help get direction connections through NATs.
Package portmapper registers support for NAT-PMP, PCP, and UPnP port mapping protocols to help get direction connections through NATs.
Package posture registers support for device posture checking, reporting machine-specific information to the control plane when enabled by the user and tailnet.
Package posture registers support for device posture checking, reporting machine-specific information to the control plane when enabled by the user and tailnet.
Package relayserver registers the relay server feature and implements its associated ipnext.Extension.
Package relayserver registers the relay server feature and implements its associated ipnext.Extension.
Package sdnotify contains a minimal wrapper around systemd-notify to enable applications to signal readiness and status to systemd.
Package sdnotify contains a minimal wrapper around systemd-notify to enable applications to signal readiness and status to systemd.
Package syspolicy provides an interface for system-wide policy management.
Package syspolicy provides an interface for system-wide policy management.
Package taildrop registers the taildrop (file sending) feature.
Package taildrop registers the taildrop (file sending) feature.
Package tap registers Tailscale's experimental (demo) Linux TAP (Layer 2) support.
Package tap registers Tailscale's experimental (demo) Linux TAP (Layer 2) support.
Package tpm implements support for TPM 2.0 devices.
Package tpm implements support for TPM 2.0 devices.
Package useproxy registers support for using system proxies.
Package useproxy registers support for using system proxies.
Package wakeonlan registers the Wake-on-LAN feature.
Package wakeonlan registers the Wake-on-LAN feature.

Jump to

Keyboard shortcuts

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