Documentation
¶
Overview ¶
Package feature tracks which features are linked into the binary.
Index ¶
- Constants
- Variables
- func CanAutoUpdate() bool
- func Disabled(name string) bool
- func EnvDisabled() []string
- func HardwareAttestationAvailable() bool
- func IsRegistered(name string) bool
- func Register(name string) bool
- func Registered() map[string]bool
- func SystemdStatus(format string, args ...any)
- func TPMAvailable() bool
- type Hook
- type Hooks
Constants ¶
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 ¶
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 Disabled ¶ added in v1.104.0
Disabled reports whether the named feature has been disabled for this process via the TS_DISABLE_FEATURE environment variable. A disabled feature behaves as if it had not been linked in: Register reports false, and hooks and extensions registered by its package are ignored.
func EnvDisabled ¶ added in v1.104.0
func EnvDisabled() []string
EnvDisabled returns the sorted feature names listed in the TS_DISABLE_FEATURE environment variable, whether or not they name features that this build contains. It is for diagnostics, such as the debug-features LocalAPI endpoint.
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 IsRegistered ¶ added in v1.102.0
IsRegistered reports whether the named feature package's init function has run and registered itself via Register in this binary. It is distinct from the compile-time buildfeatures constants: a feature package can be present in the binary but not imported (e.g. tsnet deliberately does not import many features), in which case its init does not run.
func Register ¶
Register notes that the named feature is linked into the binary and reports whether it should initialize itself. It reports false if the feature was disabled via the TS_DISABLE_FEATURE environment variable, in which case the feature is not recorded as registered and the caller should skip the rest of its registration, such as setting hooks and registering extensions and handlers. The typical use is at the top of a feature package's init:
func init() {
if !feature.Register("foo") {
return
}
// ... set hooks, register extensions and handlers ...
}
A feature package with more than one init that registers things puts this gate in one of them and guards the others with Disabled, or better, consolidates them into a single init.
Register panics if the feature is already registered.
func Registered ¶ added in v1.90.4
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
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.
HookCanAutoUpdate is a hook for the clientupdate package to conditionally initialize.
HookGetSSHHostKeyPublicStrings is a hook for the ssh/hostkeys package to provide SSH host key public strings to ipn/ipnlocal without ipnlocal needing to import golang.org/x/crypto/ssh.
HookHardwareAttestationAvailable is a hook that reports whether hardware attestation is supported and available.
HookLogSink is a hook for the syslog feature to redirect the process's logs to an alternate sink. If set, tailscaled calls it once early in main, after flag parsing; on that first call, if the user requested an alternate sink, it points the standard library's default logger at that sink. It returns the sink, or nil if logs are not being redirected. Later callers (such as logpolicy, which otherwise writes its console copy of logs to stderr) use the returned writer to send their logs to the same place.
HookProxyFromEnvironment is a hook for feature/useproxy to register a function to use as http.ProxyFromEnvironment.
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].
HookProxySetSelfProxy is a hook for feature/useproxy to register [tshttpproxy.SetSelfProxy].
HookProxySetTransportGetProxyConnectHeader is a hook for feature/useproxy to register [tshttpproxy.SetTransportGetProxyConnectHeader].
var HookRegisterLogSinkFlags Hook[func()]
HookRegisterLogSinkFlags is a hook for the syslog feature to register its flags (such as tailscaled's --syslog) with the process's default flag set. If set, tailscaled calls it before flag parsing.
var HookSystemdReady Hook[func()]
HookSystemdReady sends a readiness to systemd. This will unblock service dependents from starting.
HookSystemdStatus holds a func that will send a single line status update to systemd so that information shows up in systemctl output.
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
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]) 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.
As a backstop for feature packages that forget to consult Register, if the caller is a package under tailscale.com/feature/ whose feature was disabled via TS_DISABLE_FEATURE, the call is silently ignored and the hook is left unset.
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.
Like Hook.Set, it is silently ignored if the calling feature package was disabled via TS_DISABLE_FEATURE.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package ace registers support for Alternate Connectivity Endpoints (ACE).
|
Package ace registers support for Alternate Connectivity Endpoints (ACE). |
|
Package acme registers the ACME/TLS-cert feature and implements its associated ipnext.Extension.
|
Package acme registers the ACME/TLS-cert feature and implements its associated ipnext.Extension. |
|
Package androidbin makes Tailscale binaries work when run as raw (non-GUI app) executables on Android, such as under Termux, adb, or a rooted shell.
|
Package androidbin makes Tailscale binaries work when run as raw (non-GUI app) executables on Android, such as under Termux, adb, or a rooted shell. |
|
Package androiddns resolves DNS names on Android by speaking the dnsproxyd protocol to the system DNS resolver daemon over its unix socket, the same mechanism bionic libc's getaddrinfo uses.
|
Package androiddns resolves DNS names on Android by speaking the dnsproxyd protocol to the system DNS resolver daemon over its unix socket, the same mechanism bionic libc's getaddrinfo uses. |
|
Package appconnectors registers support for Tailscale App Connectors.
|
Package appconnectors registers support for Tailscale App Connectors. |
|
Package awsparamstore registers support for fetching secret values from AWS Parameter Store.
|
Package awsparamstore registers support for fetching secret values from AWS Parameter Store. |
|
Package bird integrates Tailscale with the BIRD Internet Routing Daemon: it enables the "tailscale" protocol in BIRD while this node is a primary subnet router and disables it otherwise.
|
Package bird integrates Tailscale with the BIRD Internet Routing Daemon: it enables the "tailscale" protocol in BIRD while this node is a primary subnet router and disables it otherwise. |
|
Package buildfeatures 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 buildfeatures 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 captiveportal provides optional captive portal detection, warning the user via the health tracker when their network requires a browser login before traffic can flow.
|
Package captiveportal provides optional captive portal detection, warning the user via the health tracker when their network requires a browser login before traffic can flow. |
|
netcheckhook
Package netcheckhook makes netcheck probe for captive portals during full reports.
|
Package netcheckhook makes netcheck probe for captive portals during full reports. |
|
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. |
|
Package condregister registers all conditional features guarded by build tags.
|
Package condregister registers all conditional features guarded by build tags. |
|
awsparamstore
Package awsparamstore conditionally registers the awsparamstore feature for resolving secrets from AWS Parameter Store.
|
Package awsparamstore conditionally registers the awsparamstore feature for resolving secrets from AWS Parameter Store. |
|
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. |
|
netlog
Package netlog registers support for network flow logging if it's not disabled via the ts_omit_netlog or ts_omit_logtail build tags.
|
Package netlog registers support for network flow logging if it's not disabled via the ts_omit_netlog or ts_omit_logtail build tags. |
|
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 conn25 registers the conn25 feature and implements its associated ipnext.Extension.
|
Package conn25 registers the conn25 feature and implements its associated ipnext.Extension. |
|
Package connreject registers the connection-rejection diagnostics feature.
|
Package connreject registers the connection-rejection diagnostics feature. |
|
Package debugportmapper registers support for debugging Tailscale's portmapping support.
|
Package debugportmapper registers support for debugging Tailscale's portmapping support. |
|
Package dnsresolvecache persists successful DNS resolutions from net/dnscache to disk, one JSON file per hostname, so that a later tailscaled boot with misconfigured DNS can still find last-known-good IPs for critical hostnames such as the control plane.
|
Package dnsresolvecache persists successful DNS resolutions from net/dnscache to disk, one JSON file per hostname, so that a later tailscaled boot with misconfigured DNS can still find last-known-good IPs for critical hostnames such as the control plane. |
|
Package doctor registers the "doctor" problem diagnosis support into the rest of Tailscale.
|
Package doctor 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. |
|
Package favorites stores the user's locally-pinned favorites (devices, exit nodes, and services) in a file per login profile.
|
Package favorites stores the user's locally-pinned favorites (devices, exit nodes, and services) in a file per login profile. |
|
pintype
Package pintype holds the types for locally-pinned favorites (devices, exit nodes, and services).
|
Package pintype holds the types for locally-pinned favorites (devices, exit nodes, and services). |
|
Package featuretags is a registry of all the ts_omit-able build tags.
|
Package featuretags 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 netlog registers the network flow logging feature and wires it into the WireGuard engine.
|
Package netlog registers the network flow logging feature and wires it into the WireGuard engine. |
|
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 remoteconfig registers a c2n endpoint that lets the control plane invoke this node's LocalAPI when Prefs.RemoteConfig is true.
|
Package remoteconfig registers a c2n endpoint that lets the control plane invoke this node's LocalAPI when Prefs.RemoteConfig is true. |
|
Package routecheck registers support for RouteCheck, which checks the reachability of overlapping routers.
|
Package routecheck registers support for RouteCheck, which checks the reachability of overlapping routers. |
|
Package runtimemetrics exports select runtime/metrics as tailscale.com/util/clientmetric's.
|
Package runtimemetrics exports select runtime/metrics as tailscale.com/util/clientmetric's. |
|
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 serviceclientprefs stores the desktop clients' saved service launch preferences, in a file per login profile.
|
Package serviceclientprefs stores the desktop clients' saved service launch preferences, in a file per login profile. |
|
serviceclient
Package serviceclient holds the types for the desktop clients' saved service launch preferences.
|
Package serviceclient holds the types for the desktop clients' saved service launch preferences. |
|
Package ssh registers the Tailscale SSH feature, including host key management and the SSH server.
|
Package ssh registers the Tailscale SSH feature, including host key management and the SSH server. |
|
Package syslog provides the tailscaled --syslog flag, which sends the daemon's logs to the system syslog daemon instead of stderr.
|
Package syslog provides the tailscaled --syslog flag, which sends the daemon's logs to the system syslog daemon instead of stderr. |
|
Package syspolicy provides an interface for system-wide policy management.
|
Package syspolicy provides an interface for system-wide policy management. |
|
Package taildrop contains the implementation of the Taildrop functionality including sending and retrieving files.
|
Package taildrop contains the implementation of the Taildrop functionality including sending and retrieving files. |
|
Package tailnetlock registers the tailnet lock debug C2N handler.
|
Package tailnetlock registers the tailnet lock debug C2N handler. |
|
tslockjsonv1
Package tslockjsonv1 provides converters for internal data structures to the JSON output returned by the CLI, in a stable "v1" format, defined in the tailscale.com/cmd/tailscale/tslockjsonv1 package.
|
Package tslockjsonv1 provides converters for internal data structures to the JSON output returned by the CLI, in a stable "v1" format, defined in the tailscale.com/cmd/tailscale/tslockjsonv1 package. |
|
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 tundevstats provides a mechanism for exposing TUN device statistics via clientmetrics.
|
Package tundevstats provides a mechanism for exposing TUN device statistics via clientmetrics. |
|
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. |