The easiest, most secure way to use WireGuard and 2FA.
Go to file
Brad Fitzpatrick 6aa10576c9 wgengine/magicsock: deflake TestTwoDevicePing compare-metrics-stats
The compare-metrics-stats subtest reset two independent counting
systems (physical connection counters and expvar.Int user metrics)
non-atomically. Background WireGuard keepalives arriving between the
resets could increment one system but not the other, causing
off-by-one packet/byte mismatches in either direction.

Replace the reset-then-compare pattern with snapshot-and-delta:
snapshot both systems before pings, snapshot again after, and compare
the deltas. This eliminates the non-atomic reset window entirely.
As a belt-and-suspenders safety net, tolerate a difference of exactly
one packet (and corresponding bytes) from a stray keepalive that
could still arrive in the narrow window between the two snapshots.

flakestress passes with ~5900 runs (~2800 without -race, ~3100 with
-race) but it also passed previously too. This is an annoying one to
repro.

Fixes #11762

Change-Id: I3447ad67e71c8146e85eed38b7a665033ef9e284
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2026-04-14 06:57:24 -07:00
.bencher
.github tstest/integration/nat, tstest/natlab/vnet: fix natlab test flake 2026-04-13 16:34:15 -07:00
appc all: fix six tests that failed with -count=2 2026-04-13 18:52:57 -07:00
atomicfile
chirp
client
clientupdate
cmd all: fix six tests that failed with -count=2 2026-04-13 18:52:57 -07:00
control control/controlclient: improve filter on netmap updates (#19308) 2026-04-14 08:43:07 -04:00
derp derp/derpserver: increase minimum token bucket size 2026-04-13 19:30:31 -07:00
disco
docs
doctor
drive
envknob
feature
gokrazy
health
hostinfo
internal
ipn all: fix six tests that failed with -count=2 2026-04-13 18:52:57 -07:00
jsondb
k8s-operator
kube
licenses licenses: update license notices 2026-04-13 12:47:58 -07:00
log
logpolicy
logtail
maths
metrics
misc
net net/dns: fix TestDNSTrampleRecovery failure under flakestress 2026-04-14 06:55:35 -07:00
omit
packages/deb
paths
portlist
posture
prober
proxymap
release
safesocket
safeweb
scripts
sessionrecording
ssh/tailssh ssh/tailssh: speed up SSH integration tests 2026-04-13 14:18:27 -07:00
syncs
tailcfg types/netmap,tailcfg: update documentation for Services cap 2026-04-13 14:36:48 -07:00
tempfork
tka
tool
tsconsensus
tsconst
tsd
tsnet
tstest tstest/integration: clear SSH_CLIENT env to prevent false positive detection 2026-04-13 18:53:07 -07:00
tstime
tsweb all: fix six tests that failed with -count=2 2026-04-13 18:52:57 -07:00
types types/netmap,tailcfg: update documentation for Services cap 2026-04-13 14:36:48 -07:00
util all: fix six tests that failed with -count=2 2026-04-13 18:52:57 -07:00
version version: show tailscale/go toolchain git hash in version output 2026-04-13 15:20:56 -07:00
wf
wgengine wgengine/magicsock: deflake TestTwoDevicePing compare-metrics-stats 2026-04-14 06:57:24 -07:00
wif
words
.gitattributes
.gitignore .gitignore: explicitly include tool/go.exe 2026-04-13 18:44:59 -07:00
.golangci.yml
.stignore
ALPINE.txt
api.md
assert_ts_toolchain_match.go
build_dist.sh
build_docker.sh
cache_key_test.go
CODE_OF_CONDUCT.md
CODEOWNERS
Dockerfile
Dockerfile.base
flake.lock
flake.nix go.mod: upgrade go-git to v5.17.1 2026-04-13 21:10:57 -07:00
go.mod go.mod: upgrade go-git to v5.17.1 2026-04-13 21:10:57 -07:00
go.mod.sri go.mod: upgrade go-git to v5.17.1 2026-04-13 21:10:57 -07:00
go.sum go.mod: upgrade go-git to v5.17.1 2026-04-13 21:10:57 -07:00
go.toolchain.branch
go.toolchain.next.branch
go.toolchain.next.rev
go.toolchain.rev
go.toolchain.rev.sri
go.toolchain.version
gomod_test.go
header.txt
LICENSE
license_test.go
Makefile ssh/tailssh: speed up SSH integration tests 2026-04-13 14:18:27 -07:00
PATENTS
pkgdoc_test.go
pull-toolchain.sh
README.md
SECURITY.md
shell.nix go.mod: upgrade go-git to v5.17.1 2026-04-13 21:10:57 -07:00
staticcheck.conf
update-flake.sh
version_tailscale_test.go
version_test.go
version-embed.go
VERSION.txt

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.