tsd

package
v1.78.3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: BSD-3-Clause Imports: 17 Imported by: 13

Documentation

Overview

Package tsd (short for "Tailscale Daemon") contains a System type that containing all the subsystems a Tailscale node (tailscaled or platform equivalent) uses.

The goal of this package (as of 2023-05-03) is to eventually unify initialization across tailscaled, tailscaled as a Windows services, the mac GUI, tsnet, wasm, tests, and other places that wire up all the subsystems. And doing so without weird optional interface accessors on some subsystems that return other subsystems. It's all a work in progress.

This package depends on nearly all parts of Tailscale, so it should not be imported by (or thus passed to) any package that does not want to depend on the world. In practice this means that only things like cmd/tailscaled, ipn/ipnlocal, and ipn/ipnserver should import this package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NetstackImpl added in v1.50.0

type NetstackImpl interface {
	UpdateNetstackIPs(*netmap.NetworkMap)
}

NetstackImpl is the interface that *netstack.Impl implements. It's an interface for circular dependency reasons: netstack.Impl references LocalBackend, and LocalBackend has a tsd.System.

type SubSystem

type SubSystem[T any] struct {
	// contains filtered or unexported fields
}

SubSystem represents some subsystem of the Tailscale node daemon.

A subsystem can be set to a value, and then later retrieved. A subsystem value tracks whether it's been set and, once set, doesn't allow the value to change.

func (*SubSystem[T]) Get

func (p *SubSystem[T]) Get() T

Get returns the value of p, panicking if it hasn't been set.

func (*SubSystem[T]) GetOK

func (p *SubSystem[T]) GetOK() (_ T, ok bool)

GetOK returns the value of p (if any) and whether it's been set.

func (*SubSystem[T]) Set

func (p *SubSystem[T]) Set(v T)

Set sets p to v.

It panics if p is already set to a different value.

Set must not be called concurrently with other Sets or Gets.

type System

type System struct {
	Dialer         SubSystem[*tsdial.Dialer]
	DNSManager     SubSystem[*dns.Manager] // can get its *resolver.Resolver from DNSManager.Resolver
	Engine         SubSystem[wgengine.Engine]
	NetMon         SubSystem[*netmon.Monitor]
	MagicSock      SubSystem[*magicsock.Conn]
	NetstackRouter SubSystem[bool] // using Netstack at all (either entirely or at least for subnets)
	Router         SubSystem[router.Router]
	Tun            SubSystem[*tstun.Wrapper]
	StateStore     SubSystem[ipn.StateStore]
	Netstack       SubSystem[NetstackImpl] // actually a *netstack.Impl
	DriveForLocal  SubSystem[drive.FileSystemForLocal]
	DriveForRemote SubSystem[drive.FileSystemForRemote]

	// InitialConfig is initial server config, if any.
	// It is nil if the node is not in declarative mode.
	// This value is never updated after startup.
	// LocalBackend tracks the current config after any reloads.
	InitialConfig *conffile.Config
	// contains filtered or unexported fields
}

System contains all the subsystems of a Tailscale node (tailscaled, etc.)

func (*System) ControlKnobs added in v1.50.0

func (s *System) ControlKnobs() *controlknobs.Knobs

ControlKnobs returns the control knobs for this node.

func (*System) HealthTracker added in v1.66.0

func (s *System) HealthTracker() *health.Tracker

HealthTracker returns the system health tracker.

func (*System) IsNetstack

func (s *System) IsNetstack() bool

IsNetstack reports whether Tailscale is running as a netstack-based TUN-free engine.

func (*System) IsNetstackRouter

func (s *System) IsNetstackRouter() bool

IsNetstackRouter reports whether Tailscale is either fully netstack based (without TUN) or is at least using netstack for routing.

func (*System) ProxyMapper added in v1.50.0

func (s *System) ProxyMapper() *proxymap.Mapper

ProxyMapper returns the ephemeral ip:port mapper.

func (*System) Set

func (s *System) Set(v any)

Set is a convenience method to set a subsystem value. It panics if the type is unknown or has that type has already been set.

func (*System) UserMetricsRegistry added in v1.76.0

func (s *System) UserMetricsRegistry() *usermetric.Registry

UserMetricsRegistry returns the system usermetrics.

Jump to

Keyboard shortcuts

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