Movatterモバイル変換


[0]ホーム

URL:


tsd

package
v1.92.2Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License:BSD-3-ClauseImports:19Imported by:16

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package tsd (short for "Tailscale Daemon") contains a System type thatcontaining all the subsystems a Tailscale node (tailscaled or platformequivalent) uses.

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

This package depends on nearly all parts of Tailscale, so it should not beimported by (or thus passed to) any package that does not want to depend onthe 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

typeLocalBackendadded inv1.90.0

type LocalBackend =any

LocalBackend is a fake name for *ipnlocal.LocalBackend to avoid an import cycle.

typeNetstackImpladded inv1.50.0

type NetstackImpl interface {Start(LocalBackend)errorUpdateNetstackIPs(*netmap.NetworkMap)}

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

typeSubSystem

type SubSystem[Tany] 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 subsystemvalue tracks whether it's been set and, once set, doesn't allow the value tochange.

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, okbool)

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.

typeSystem

type System struct {BusSubSystem[*eventbus.Bus]DialerSubSystem[*tsdial.Dialer]DNSManagerSubSystem[*dns.Manager]// can get its *resolver.Resolver from DNSManager.ResolverEngineSubSystem[wgengine.Engine]NetMonSubSystem[*netmon.Monitor]MagicSockSubSystem[*magicsock.Conn]NetstackRouterSubSystem[bool]// using Netstack at all (either entirely or at least for subnets)RouterSubSystem[router.Router]TunSubSystem[*tstun.Wrapper]StateStoreSubSystem[ipn.StateStore]NetstackSubSystem[NetstackImpl]// actually a *netstack.ImplDriveForLocalSubSystem[drive.FileSystemForLocal]DriveForRemoteSubSystem[drive.FileSystemForRemote]PolicyClientSubSystem[policyclient.Client]HealthTrackerSubSystem[*health.Tracker]// 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.)

A valid System value must always have a non-nil Bus populated. Callers mustensure this before using the value further. CallNewSystem to obtain avalue ready to use.

funcNewSystemadded inv1.84.0

func NewSystem() *System

NewSystem constructs a new otherwise-emptySystem with afreshly-constructed event bus populated.

funcNewSystemWithBusadded inv1.90.0

func NewSystemWithBus(bus *eventbus.Bus) *System

NewSystemWithBus constructs a new otherwise-emptySystem with aneventbus provided by the caller. The provided bus must not be nil.This is mainly intended for testing; for production use call [NewBus].

func (*System)ControlKnobsadded inv1.50.0

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

ControlKnobs returns the control knobs for this node.

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)PolicyClientOrDefaultadded inv1.88.0

func (s *System) PolicyClientOrDefault()policyclient.Client

PolicyClientOrDefault returns the policy client if set or a no-op defaultotherwise. It always returns a non-nil value.

func (*System)ProxyMapperadded inv1.50.0

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

ProxyMapper returns the ephemeral ip:port mapper.

func (*System)Set

func (s *System) Set(vany)

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

func (*System)UserMetricsRegistryadded inv1.76.0

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

UserMetricsRegistry returns the system usermetrics.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp