The easiest, most secure way to use WireGuard and 2FA.
Go to file
James Tucker 35c7cd24f6
util/eventbus: unify Subscriber/SubscriberFunc cores; structural symmetry
Brings Subscriber[T] in line with the same non-generic-core
pattern already applied to SubscriberFunc[T] and Publisher[T]:

  - Renames subscriberFuncCore to subscriberCore and shares it
    between Subscriber[T] and SubscriberFunc[T]. Both typed
    facades hold a *subscriberCore plus their respective per-T
    delivery state (Subscriber: chan T; SubscriberFunc: nothing,
    the user callback is captured in the dispatch closure).

  - The bus's outputs map and subscriber-interface itab key on
    *subscriberCore for both subscriber kinds, so adding a new
    Subscribe[T] call site no longer pays a per-T itab,
    dictionary, or equality function for the subscriber-interface
    side.

  - Subscribe[T] now hoists the non-generic constructor portion
    into newSubscriberCore (timer setup, core allocation, cached
    type/typeName, unregister closure), matching SubscribeFunc.

The dispatch loop is intentionally NOT extracted to a non-generic
helper for Subscriber[T], unlike SubscriberFunc[T]. The reason is
the typed channel send 'case s.read <- t:' must appear lexically
inside the select; the only way to lift it into a non-generic
loop is to bridge typed and untyped via a per-event goroutine,
which costs ~2.7x throughput on BenchmarkBasicThroughput. We keep
dispatchTyped on the generic facade and accept the per-shape
stencil cost (~600 bytes per shape) as the cheaper alternative.

Symbol-level effect on tailscaled (linux/amd64):

  (*Subscriber[T]).dispatch           2,285 B  (6 instances) ->
  (*Subscriber[T]).dispatchTyped       1,260 B (2 instances)
                                       -1,025 B
  (*Subscriber[T]).Close                 369 B (6 instances) ->
                                          0 B   forwards to core.Close
                                       -369 B
  + smaller savings on Subscribe[T] and newSubscriber[T] bodies

Stripped tailscaled (linux/amd64): -8,192 B vs the prior commit.
arm64 stays page-quantized at the same boundary.

Cumulative reduction from baseline (5167ff412):
    linux/amd64:  -118,784 bytes (-0.420%)
    linux/arm64:  -131,072 bytes (-0.499%)

Behavior is unchanged:
  BenchmarkBasicThroughput: 2018 -> 2006 ns/op (within noise)
  All eventbus tests pass with -race.

Updates #12614

Change-Id: I97918ec68bd2cdb15958bbfd7687592b39663efe
Signed-off-by: James Tucker <james@tailscale.com>
2026-05-05 15:52:30 -07:00
.bencher
.github tool/updateflakes, cmd/nardump: replace update-flake.sh with Go tool 2026-04-28 10:18:32 -07:00
appc appc, feature/conn25: handle exact and wildcard domains correctly (#19202) 2026-05-01 17:33:21 -04:00
atomicfile
chirp
client client/systray: fix recommended exit node not showing as selected (#19627) 2026-05-05 10:49:38 -03:00
clientupdate feature/clientupdate: windows update should use tailscale.exe update (#19438) 2026-04-17 10:28:35 -07:00
cmd cmd/tailscale/cli: unhide --report posture flag in up 2026-05-05 10:12:36 +01:00
control wgengine, all: remove LazyWG, use wireguard-go callback API for on-demand peers 2026-04-29 19:46:19 -07:00
derp derp/derpserver: remove global rate limiter 2026-05-04 09:41:14 -07:00
disco disco: remove experimental label from BindUDPRelayHandshakeState 2026-03-24 11:04:11 -07:00
docs misc: add install-git-hooks.go and git hook for Change-Id tracking 2026-04-08 15:10:53 -07:00
doctor
drive cmd/vet/lowerell, drive/driveimpl: forbid variables named "l" or "I" 2026-05-04 14:03:28 -07:00
envknob envknob/logknob: remove unused package (#19515) 2026-04-24 15:48:06 -07:00
feature appc, feature/conn25: handle exact and wildcard domains correctly (#19202) 2026-05-01 17:33:21 -04:00
gokrazy go.mod, gokrazy: bump to fork of gokrazy/gokrazy init process for syslog change 2026-04-29 11:27:41 -07:00
health cmd/vet: add subtestnames analyzer; fix all existing violations 2026-04-05 15:52:51 -07:00
hostinfo all: use Go 1.26 things, run most gofix modernizers 2026-03-06 13:32:03 -08:00
internal
ipn client/local, ipn/localapi, ipn/ipnlocal: add PeerByID 2026-05-01 06:20:46 -07:00
jsondb
k8s-operator cmd/k8s-operator: add nodeSelector to DNSConfig resource (#19429) 2026-04-29 15:56:33 +01:00
kube all: migrate code off Notify.NetMap to Notify.SelfChange 2026-05-01 06:51:40 -07:00
licenses licenses: update license notices 2026-05-04 10:34:27 -07:00
log cmd/vet: add subtestnames analyzer; fix all existing violations 2026-04-05 15:52:51 -07:00
logpolicy
logtail logtail: run HTTP tests in-memory with memnet + synctest 2026-04-20 13:33:10 -07:00
metrics cmd/vet/lowerell, drive/driveimpl: forbid variables named "l" or "I" 2026-05-04 14:03:28 -07:00
misc misc/git_hook: propagate shared HOOK_VERSION (#19476) 2026-05-04 12:38:28 -04:00
net wgengine/netstack, net/ping: stop using pro-bing and use our net/ping instead 2026-05-04 14:05:24 -07:00
omit
packages/deb
paths
portlist
posture posture: add HealthTracker for serial number retrieval (#19181) 2026-04-25 15:42:47 -03:00
prober all: use Go 1.26 things, run most gofix modernizers 2026-03-06 13:32:03 -08:00
proxymap
release release/dist/qnap: preserve .codesigning files as build artifacts 2026-04-28 12:29:56 +01:00
safesocket safesocket, ipn/ipnserver: use PeerCreds on solaris and illumos 2026-03-23 07:45:35 -07:00
safeweb safeweb: add CSRF token helpers and set cookie path to root (#19265) 2026-04-06 12:52:36 -04:00
scripts
sessionrecording cmd/vet: add subtestnames analyzer; fix all existing violations 2026-04-05 15:52:51 -07:00
ssh/tailssh ipn/ipnlocal, all: split LocalBackend.NetMap into NetMapNoPeers / NetMapWithPeers 2026-04-30 11:14:06 -07:00
syncs cmd/vet: add subtestnames analyzer; fix all existing violations 2026-04-05 15:52:51 -07:00
tailcfg tailcfg: add node capability for services in desktop clients (#19605) 2026-05-01 12:07:33 -07:00
tempfork misc/genreadme,tempfork/pkgdoc,tsnet: generate README.md files from godoc 2026-04-22 15:13:09 -07:00
tka tka: clarify that this limit is on disablement *values* not *secrets* 2026-05-01 18:25:39 +01:00
tool tool/updateflakes, cmd/nardump: replace update-flake.sh with Go tool 2026-04-28 10:18:32 -07:00
tsconsensus all: migrate code off Notify.NetMap to Notify.SelfChange 2026-05-01 06:51:40 -07:00
tsconst
tsd tsd, all: add Sys.ExtraRootCAs, plumb through TLS dial paths 2026-04-07 18:10:54 -07:00
tsnet wgengine/netstack, net/ping: stop using pro-bing and use our net/ping instead 2026-05-04 14:05:24 -07:00
tstest wgengine/netstack, net/ping: stop using pro-bing and use our net/ping instead 2026-05-04 14:05:24 -07:00
tstime
tsweb all: fix six tests that failed with -count=2 2026-04-13 18:52:57 -07:00
types wgengine, all: remove LazyWG, use wireguard-go callback API for on-demand peers 2026-04-29 19:46:19 -07:00
util util/eventbus: unify Subscriber/SubscriberFunc cores; structural symmetry 2026-05-05 15:52:30 -07:00
version version: use debug.ReadBuildInfo in CmdName on non-Windows 2026-04-24 09:48:11 -07:00
wf
wgengine wgengine/netstack, net/ping: stop using pro-bing and use our net/ping instead 2026-05-04 14:05:24 -07:00
wif wif: add AWS ecs for autogenerated OIDC tokens 2026-03-25 14:41:41 -06:00
words Add 'fish' to the list of scales 2026-03-27 08:41:33 +00:00
.gitattributes
.gitignore .gitignore: explicitly include tool/go.exe 2026-04-13 18:44:59 -07:00
.golangci.yml .golangci.yml: enforce gliderssh import alias via importas linter 2026-04-07 11:59:38 +01:00
.stignore
ALPINE.txt
api.md
assert_ts_toolchain_match.go
build_dist.sh
build_docker.sh docker: add riscv64 to container image architectures 2026-03-29 07:47:39 -07:00
cache_key_test.go tailscaleroot: add test that tsgo rev is in Go build cache keys 2026-04-13 10:17:22 -07:00
CODE_OF_CONDUCT.md
CODEOWNERS
Dockerfile
Dockerfile.base
flake.lock nix: update flakes to get a nixpkgs version with go 1.26 2026-03-06 04:06:57 -08:00
flake.nix wgengine/netstack, net/ping: stop using pro-bing and use our net/ping instead 2026-05-04 14:05:24 -07:00
flakehashes.json wgengine/netstack, net/ping: stop using pro-bing and use our net/ping instead 2026-05-04 14:05:24 -07:00
go.mod wgengine/netstack, net/ping: stop using pro-bing and use our net/ping instead 2026-05-04 14:05:24 -07:00
go.sum wgengine/netstack, net/ping: stop using pro-bing and use our net/ping instead 2026-05-04 14:05:24 -07:00
go.toolchain.branch
go.toolchain.next.branch
go.toolchain.next.rev go.toolchain.rev: update to Go 1.26.2 2026-04-07 17:09:56 -07:00
go.toolchain.rev go.toolchain.rev: update to Go 1.26.2 2026-04-07 17:09:56 -07:00
go.toolchain.version go.toolchain.rev: update to Go 1.26.2 2026-04-07 17:09:56 -07:00
gomod_test.go
header.txt
LICENSE
license_test.go
Makefile tool/updateflakes, cmd/nardump: replace update-flake.sh with Go tool 2026-04-28 10:18:32 -07:00
PATENTS
pkgdoc_test.go cmd/vet/lowerell, drive/driveimpl: forbid variables named "l" or "I" 2026-05-04 14:03:28 -07:00
pull-toolchain.sh tool/updateflakes, cmd/nardump: replace update-flake.sh with Go tool 2026-04-28 10:18:32 -07:00
README.md README: update the version of Go in the README (#19168) 2026-03-28 22:21:41 -03:00
SECURITY.md
shell.nix wgengine/netstack, net/ping: stop using pro-bing and use our net/ping instead 2026-05-04 14:05:24 -07:00
staticcheck.conf
version_tailscale_test.go
version_test.go
version-embed.go
VERSION.txt VERSION.txt: this is v1.99.0 (#19645) 2026-05-05 15:07:20 -04:00

Tailscale

https://tailscale.com

Private WireGuard® networks made easy

Overview

This repository contains the majority of Tailscale's open source code. Notably, it includes the tailscaled daemon and the tailscale CLI tool. The tailscaled daemon runs on Linux, Windows, macOS, and to varying degrees on FreeBSD and OpenBSD. The Tailscale iOS and Android apps use this repo's code, but this repo doesn't contain the mobile GUI code.

Other Tailscale repos of note:

For background on which parts of Tailscale are open source and why, see https://tailscale.com/opensource/.

Using

We serve packages for a variety of distros and platforms at https://pkgs.tailscale.com.

Other clients

The macOS, iOS, and Windows clients use the code in this repository but additionally include small GUI wrappers. The GUI wrappers on non-open source platforms are themselves not open source.

Building

We always require the latest Go release, currently Go 1.26. (While we build releases with our Go fork, its use is not required.)

go install tailscale.com/cmd/tailscale{,d}

If you're packaging Tailscale for distribution, use build_dist.sh instead, to burn commit IDs and version info into the binaries:

./build_dist.sh tailscale.com/cmd/tailscale
./build_dist.sh tailscale.com/cmd/tailscaled

If your distro has conventions that preclude the use of build_dist.sh, please do the equivalent of what it does in your distro's way, so that bug reports contain useful version information.

Bugs

Please file any issues about this code or the hosted service on the issue tracker.

Contributing

PRs welcome! But please file bugs. Commit messages should reference bugs.

We require Developer Certificate of Origin Signed-off-by lines in commits.

See commit-messages.md (or skim git log) for our commit message style.

About Us

Tailscale is primarily developed by the people at https://github.com/orgs/tailscale/people. For other contributors, see:

WireGuard is a registered trademark of Jason A. Donenfeld.