An open source, self-hosted implementation of the Tailscale control server
Find a file
Kristoffer Dalby ab4e205ce7 hscontrol/servertest: expand issue tests to 24 scenarios, surface 4 issues
Split TestIssues into 7 focused test functions to stay under cyclomatic
complexity limits while testing more aggressively.

Issues surfaced (4 failing tests):

1. initial_map_should_include_peer_online_status: Initial MapResponse
   has Online=nil for peers. Online status only arrives later via
   PeersChangedPatch.

2. disco_key_should_propagate_to_peers: DiscoPublicKey set by client
   is not visible to peers. Peers see zero disco key.

3. approved_route_without_announcement_is_visible: Server-side route
   approval without client-side announcement silently produces empty
   SubnetRoutes (intersection of empty announced + approved = empty).

4. nodestore_correct_after_rapid_reconnect: After 5 rapid reconnect
   cycles, NodeStore reports node as offline despite having an active
   poll session. The connect/disconnect grace period interleaving
   leaves IsOnline in an incorrect state.

Passing tests (20) verify:
- IP uniqueness across 10 nodes
- IP stability across reconnect
- New peers have addresses immediately
- Node rename propagates to peers
- Node delete removes from all peer lists
- Hostinfo changes (OS field) propagate
- NodeStore/DB consistency after route mutations
- Grace period timing (8-20s window)
- Ephemeral node deletion (not just offline)
- 10-node simultaneous connect convergence
- Rapid sequential node additions
- Reconnect produces complete map
- Cross-user visibility with default policy
- Same-user multiple nodes get distinct IDs
- Same-hostname nodes get unique GivenNames
- Policy change during connect still converges
- DERP region references are valid
- User profiles present for self and peers
- Self-update arrives after route approval
- Route advertisement stored as AnnouncedRoutes
2026-03-19 07:05:58 +01:00
.claude/agents docs: update integration testing docs for concurrent execution 2026-01-09 12:34:16 +01:00
.github ci: regenerate test-integration.yaml for TestSSHLocalpart 2026-02-28 05:14:11 -08:00
cmd all: update Go to 1.26.1 2026-03-11 03:18:14 -07:00
docs Update docs for auth-id changes 2026-03-01 13:38:22 +01:00
gen gen: regenerate from auth proto changes 2026-02-25 21:28:05 +01:00
hscontrol hscontrol/servertest: expand issue tests to 24 scenarios, surface 4 issues 2026-03-19 07:05:58 +01:00
integration integration/acl: replace custom entrypoints with WithPackages 2026-03-16 03:57:05 -07:00
nix nix: disable external DERP URL fetch in VM test 2026-03-06 05:18:44 -08:00
packaging Drop syslog.target and systemd-managed /var/run 2025-05-21 15:40:32 +02:00
proto proto: add AuthRegister and AuthApprove RPCs 2026-02-25 21:28:05 +01:00
tools/capver tools/capver: regenerate from docker tags 2025-12-18 10:02:23 +01:00
.dockerignore mapper: produce map before poll (#2628) 2025-07-28 11:15:53 +02:00
.editorconfig editorconfig: add basic editor config 2025-12-16 10:12:36 +01:00
.envrc Add direnv flake support 2022-03-19 09:23:03 +00:00
.gitignore capver: update latest (#2774) 2025-11-12 20:26:54 +01:00
.golangci.yaml all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00
.goreleaser.yml Simplify upgrade snippet with a link to the upgrade guide 2026-02-19 17:16:40 +01:00
.mcp.json add pre-commit hooks, move claude to agents. (#2877) 2025-11-11 20:35:23 +01:00
.mdformat.toml Switch to mdformat to format docs 2026-03-01 09:24:52 +01:00
.pre-commit-config.yaml Switch to mdformat to format docs 2026-03-01 09:24:52 +01:00
.prettierignore Switch to mdformat to format docs 2026-03-01 09:24:52 +01:00
AGENTS.md docs: update integration testing docs for concurrent execution 2026-01-09 12:34:16 +01:00
buf.gen.yaml Create an initial gRPC service 2021-10-26 20:37:37 +00:00
CHANGELOG.md Update docs for auth-id changes 2026-03-01 13:38:22 +01:00
CLAUDE.md add pre-commit hooks, move claude to agents. (#2877) 2025-11-11 20:35:23 +01:00
CODE_OF_CONDUCT.md Use discord server invite link (#2235) 2024-11-16 07:06:15 +01:00
config-example.yaml Document oidc.email_verification_required 2026-01-16 14:54:04 +01:00
CONTRIBUTING.md update godeps (#2098) 2024-09-04 07:55:16 +02:00
derp-example.yaml add pre-commit hooks, move claude to agents. (#2877) 2025-11-11 20:35:23 +01:00
Dockerfile.derper all: update Go to 1.26.1 2026-03-11 03:18:14 -07:00
Dockerfile.integration all: update Go to 1.26.1 2026-03-11 03:18:14 -07:00
Dockerfile.integration-ci Dockerfile: align packages 2025-12-16 10:12:36 +01:00
Dockerfile.tailscale-HEAD all: update Go to 1.26.1 2026-03-11 03:18:14 -07:00
flake.lock nix: update flake inputs 2026-03-11 03:18:14 -07:00
flake.nix go.mod: add stress tool dependency 2026-03-14 02:52:28 -07:00
go.mod go.mod: add stress tool dependency 2026-03-14 02:52:28 -07:00
go.sum go.mod: add stress tool dependency 2026-03-14 02:52:28 -07:00
LICENSE Initial commit 2020-06-21 11:21:07 +02:00
Makefile Switch to mdformat to format docs 2026-03-01 09:24:52 +01:00
mkdocs.yml Fix version in mkdocs 2026-02-05 08:01:02 +01:00
README.md Switch to mdformat to format docs 2026-03-01 09:24:52 +01:00
swagger.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00

headscale logo

ci

An open source, self-hosted implementation of the Tailscale control server.

Join our Discord server for a chat.

Note: Always select the same GitHub tag as the released version you use to ensure you have the correct example configuration. The main branch might contain unreleased changes. The documentation is available for stable and development versions:

What is Tailscale

Tailscale is a modern VPN built on top of Wireguard. It works like an overlay network between the computers of your networks - using NAT traversal.

Everything in Tailscale is Open Source, except the GUI clients for proprietary OS (Windows and macOS/iOS), and the control server.

The control server works as an exchange point of Wireguard public keys for the nodes in the Tailscale network. It assigns the IP addresses of the clients, creates the boundaries between each user, enables sharing machines between users, and exposes the advertised routes of your nodes.

A Tailscale network (tailnet) is private network which Tailscale assigns to a user in terms of private users or an organisation.

Design goal

Headscale aims to implement a self-hosted, open source alternative to the Tailscale control server. Headscale's goal is to provide self-hosters and hobbyists with an open-source server they can use for their projects and labs. It implements a narrow scope, a single Tailscale network (tailnet), suitable for a personal use, or a small open-source organisation.

Supporting Headscale

If you like headscale and find it useful, there is a sponsorship and donation buttons available in the repo.

Features

Please see "Features" in the documentation.

Client OS support

Please see "Client and operating system support" in the documentation.

Running headscale

Please note that we do not support nor encourage the use of reverse proxies and container to run Headscale.

Please have a look at the documentation.

For NixOS users, a module is available in nix/.

Talks

Disclaimer

This project is not associated with Tailscale Inc.

However, one of the active maintainers for Headscale is employed by Tailscale and he is allowed to spend work hours contributing to the project. Contributions from this maintainer are reviewed by other maintainers.

The maintainers work together on setting the direction for the project. The underlying principle is to serve the community of self-hosters, enthusiasts and hobbyists - while having a sustainable project.

Contributing

Please read the CONTRIBUTING.md file.

Requirements

To contribute to headscale you would need the latest version of Go and Buf (Protobuf generator).

We recommend using Nix to setup a development environment. This can be done with nix develop, which will install the tools and give you a shell. This guarantees that you will have the same dev env as headscale maintainers.

Code style

To ensure we have some consistency with a growing number of contributions, this project has adopted linting and style/formatting rules:

The Go code is linted with golangci-lint and formatted with golines (width 88) and gofumpt. Please configure your editor to run the tools while developing and make sure to run make lint and make fmt before committing any code.

The Proto code is linted with buf and formatted with clang-format.

The docs are formatted with mdformat.

The rest (Markdown, YAML, etc) is formatted with prettier.

Check out the .golangci.yaml and Makefile to see the specific configuration.

Install development tools

  • Go
  • Buf
  • Protobuf tools

Install and activate:

nix develop

Testing and building

Some parts of the project require the generation of Go code from Protobuf (if changes are made in proto/) and it must be (re-)generated with:

make generate

Note: Please check in changes from gen/ in a separate commit to make it easier to review.

To run the tests:

make test

To build the program:

make build

Development workflow

We recommend using Nix for dependency management to ensure you have all required tools. If you prefer to manage dependencies yourself, you can use Make directly:

With Nix (recommended):

nix develop
make test
make build

With your own dependencies:

make test
make build

The Makefile will warn you if any required tools are missing and suggest running nix develop. Run make help to see all available targets.

Contributors

Made with contrib.rocks.