tsd
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
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¶
- type LocalBackend
- type NetstackImpl
- type SubSystem
- type System
- func (s *System) ControlKnobs() *controlknobs.Knobs
- func (s *System) IsNetstack() bool
- func (s *System) IsNetstackRouter() bool
- func (s *System) PolicyClientOrDefault() policyclient.Client
- func (s *System) ProxyMapper() *proxymap.Mapper
- func (s *System) Set(v any)
- func (s *System) UserMetricsRegistry() *usermetric.Registry
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeLocalBackend¶added inv1.90.0
type LocalBackend =any
LocalBackend is a fake name for *ipnlocal.LocalBackend to avoid an import cycle.
typeNetstackImpl¶added 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.
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.
funcNewSystem¶added inv1.84.0
func NewSystem() *System
NewSystem constructs a new otherwise-emptySystem with afreshly-constructed event bus populated.
funcNewSystemWithBus¶added inv1.90.0
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)ControlKnobs¶added inv1.50.0
func (s *System) ControlKnobs() *controlknobs.Knobs
ControlKnobs returns the control knobs for this node.
func (*System)IsNetstack¶
IsNetstack reports whether Tailscale is running as a netstack-based TUN-free engine.
func (*System)IsNetstackRouter¶
IsNetstackRouter reports whether Tailscale is either fully netstack based(without TUN) or is at least using netstack for routing.
func (*System)PolicyClientOrDefault¶added 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)ProxyMapper¶added inv1.50.0
ProxyMapper returns the ephemeral ip:port mapper.
func (*System)Set¶
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)UserMetricsRegistry¶added inv1.76.0
func (s *System) UserMetricsRegistry() *usermetric.Registry
UserMetricsRegistry returns the system usermetrics.