tailscale/tailcfg
Brad Fitzpatrick 82cfea90ca
Some checks are pending
checklocks / checklocks (push) Waiting to run
CodeQL / Analyze (go) (push) Waiting to run
Dockerfile build / deploy (push) Waiting to run
test installer.sh / test (curl ca-certificates, kalilinux/kali-dev) (push) Waiting to run
test installer.sh / test (curl ca-certificates, kalilinux/kali-rolling) (push) Waiting to run
test installer.sh / test (curl, alpine:3.21) (push) Waiting to run
test installer.sh / test (curl, alpine:edge) (push) Waiting to run
test installer.sh / test (curl, alpine:latest) (push) Waiting to run
test installer.sh / test (curl, amazonlinux:latest) (push) Waiting to run
test installer.sh / test (curl, archlinux:latest) (push) Waiting to run
test installer.sh / test (curl, debian:oldstable-slim) (push) Waiting to run
test installer.sh / test (curl, debian:sid-slim) (push) Waiting to run
test installer.sh / test (curl, debian:stable-slim, 1.80.0) (push) Waiting to run
test installer.sh / test (curl, debian:testing-slim) (push) Waiting to run
test installer.sh / test (curl, elementary/docker:stable) (push) Waiting to run
test installer.sh / test (curl, elementary/docker:unstable) (push) Waiting to run
test installer.sh / test (curl, fedora:latest, 1.80.0) (push) Waiting to run
test installer.sh / test (curl, opensuse/leap:latest) (push) Waiting to run
test installer.sh / test (curl, opensuse/tumbleweed:latest) (push) Waiting to run
test installer.sh / test (curl, oraclelinux:8) (push) Waiting to run
test installer.sh / test (curl, oraclelinux:9) (push) Waiting to run
test installer.sh / test (curl, parrotsec/core:latest) (push) Waiting to run
test installer.sh / test (curl, rockylinux:8.7) (push) Waiting to run
test installer.sh / test (curl, rockylinux:9) (push) Waiting to run
test installer.sh / test (curl, ubuntu:20.04) (push) Waiting to run
test installer.sh / test (curl, ubuntu:22.04) (push) Waiting to run
test installer.sh / test (curl, ubuntu:24.04, 1.80.0) (push) Waiting to run
test installer.sh / test (wget, debian:oldstable-slim) (push) Waiting to run
test installer.sh / test (wget, debian:sid-slim) (push) Waiting to run
test installer.sh / notify-slack (push) Blocked by required conditions
natlab-basic / EasyEasy (push) Waiting to run
CI / gomod-cache (push) Waiting to run
CI / race-root-integration (1/4) (push) Blocked by required conditions
CI / race-root-integration (2/4) (push) Blocked by required conditions
CI / race-root-integration (3/4) (push) Blocked by required conditions
CI / race-root-integration (4/4) (push) Blocked by required conditions
CI / test (-race, amd64, 1/3) (push) Blocked by required conditions
CI / test (-race, amd64, 2/3) (push) Blocked by required conditions
CI / test (-race, amd64, 3/3) (push) Blocked by required conditions
CI / test (386) (push) Blocked by required conditions
CI / test (amd64) (push) Blocked by required conditions
CI / Windows (${{ matrix.name || matrix.shard}}) (win-bench, benchmarks) (push) Blocked by required conditions
CI / Windows (${{ matrix.name || matrix.shard}}) (win-shard-1-2, 1/2) (push) Blocked by required conditions
CI / Windows (${{ matrix.name || matrix.shard}}) (win-shard-2-2, 2/2) (push) Blocked by required conditions
CI / macos (push) Blocked by required conditions
CI / privileged (push) Blocked by required conditions
CI / cross (386, linux) (push) Blocked by required conditions
CI / cross (amd64, darwin) (push) Blocked by required conditions
CI / cross (amd64, freebsd) (push) Blocked by required conditions
CI / cross (amd64, openbsd) (push) Blocked by required conditions
CI / cross (amd64, windows) (push) Blocked by required conditions
CI / cross (arm, 5, linux) (push) Blocked by required conditions
CI / cross (arm, 7, linux) (push) Blocked by required conditions
CI / cross (arm64, darwin) (push) Blocked by required conditions
CI / cross (arm64, linux) (push) Blocked by required conditions
CI / cross (arm64, windows) (push) Blocked by required conditions
CI / cross (loong64, linux) (push) Blocked by required conditions
CI / ios (push) Blocked by required conditions
CI / crossmin (amd64, illumos) (push) Blocked by required conditions
CI / crossmin (amd64, plan9) (push) Blocked by required conditions
CI / crossmin (amd64, solaris) (push) Blocked by required conditions
CI / crossmin (ppc64, aix) (push) Blocked by required conditions
CI / android (push) Blocked by required conditions
CI / wasm (push) Blocked by required conditions
CI / tailscale_go (push) Blocked by required conditions
CI / fuzz (push) Waiting to run
CI / depaware (push) Blocked by required conditions
CI / go_generate (push) Blocked by required conditions
CI / make_tidy (push) Blocked by required conditions
CI / licenses (push) Blocked by required conditions
CI / staticcheck (${{ matrix.name }}) (--with-tags-all=darwin, arm64, darwin, macOS) (push) Blocked by required conditions
CI / staticcheck (${{ matrix.name }}) (--with-tags-all=linux, amd64, linux, Linux) (push) Blocked by required conditions
CI / staticcheck (${{ matrix.name }}) (--with-tags-all=windows, amd64, windows, Windows) (push) Blocked by required conditions
CI / staticcheck (${{ matrix.name }}) (--without-tags-any=windows,darwin,linux --shard=1/4, amd64, linux, Portable (1/4)) (push) Blocked by required conditions
CI / staticcheck (${{ matrix.name }}) (--without-tags-any=windows,darwin,linux --shard=2/4, amd64, linux, Portable (2/4)) (push) Blocked by required conditions
CI / staticcheck (${{ matrix.name }}) (--without-tags-any=windows,darwin,linux --shard=3/4, amd64, linux, Portable (3/4)) (push) Blocked by required conditions
CI / staticcheck (${{ matrix.name }}) (--without-tags-any=windows,darwin,linux --shard=4/4, amd64, linux, Portable (4/4)) (push) Blocked by required conditions
CI / notify_slack (push) Blocked by required conditions
CI / merge_blocker (push) Blocked by required conditions
CI / check_mergeability_strict (push) Blocked by required conditions
CI / check_mergeability (push) Blocked by required conditions
tailscale.com/cmd/vet / vet (push) Waiting to run
all: fix JSON serialization under Go 1.27's finalized encoding/json/v2
Go 1.27 enables GOEXPERIMENT=jsonv2 by default: encoding/json is now
backed by the json/v2 machinery, and github.com/go-json-experiment/json
compiles as a thin alias of the standard library's encoding/json/v2.
Several tag options and behaviors we relied on did not make the cut for
the final Go 1.27 API, breaking tailscaled at runtime and four packages'
tests. This change adapts to the final API while keeping the wire format
byte-for-byte identical on all Go versions.

First, the `format` tag option was demoted to experimental. Its mere
presence in a struct tag now makes marshaling and unmarshaling fail at
runtime. tailcfg.SSHAction.SessionDuration had `format:nano` (added in
a2dc517d7 to pin the v1 representation), so on Go 1.27 any netmap
containing an SSH policy failed to decode, breaking every PollNetMap.
Remove the option here and in net/speedtest; time.Duration still
marshals as int64 nanoseconds under encoding/json on all Go versions
(Go 1.27's v1 mode sets FormatDurationAsNano by default), so old
clients and servers are unaffected. Add a regression test locking in
the exact wire format.

Consequently, invert the cmd/vet jsontags rule: it previously required
an explicit `format` tag on time.Duration fields, which is now exactly
wrong. It now rejects any `format` tag option, which would have caught
this bug in CI.

Second, the `inline` tag option was renamed to `embed`. The standard
library silently ignores `inline`, while the pinned go-json-experiment
module (used on Go 1.26) only knows `inline`. Specify both options in
types/prefs and logtail; each implementation ignores the option it does
not know, producing identical output. Drop `inline` once we require
Go 1.27.

Third, encoding/json (v1) now dispatches to MarshalJSONTo and
UnmarshalJSONFrom methods and its v1 options flow into nested
jsonv2.MarshalEncode calls. Types whose v1 methods deliberately
routed through jsonv2 for v2 semantics (types/opt.Value, the
types/prefs preference types) would silently change wire format
(e.g. nil slices becoming null). Pin jsonv2.DefaultOptionsV2 in
their jsonv2 methods so the representation is the same regardless
of the entry point.

Finally, json.Marshal costs one more allocation under Go 1.27,
tripping the types/logger.AsJSON alloc test. Switch its fmt.Formatter
to jsonv2.MarshalWrite with explicit v1 options, which writes directly
to the fmt.State: one allocation on both toolchains with unchanged
output. Depaware files pick up the go-json-experiment/json/v1 options
shim as a new dependency of types/logger.

With this change, go test ./... passes with both Go 1.26.5 and
go1.27rc2.

Updates #20220
Fixes #20528
Fixes #20254

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Change-Id: I694c7d57fd81e55a579c579e9be10032bca569d4
2026-07-19 09:58:50 -07:00
..
c2ntypes.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
derpmap.go all: remove AUTHORS file and references to it 2026-01-23 15:49:45 -08:00
proto_port_range_test.go cmd/vet: add subtestnames analyzer; fix all existing violations 2026-04-05 15:52:51 -07:00
proto_port_range.go all: fix more typos caused by unnecessary repetition 2026-07-06 10:36:17 +01:00
tailcfg_clone.go cmd/tailscale, ipn, feature/remoteconfig: add remote-config support 2026-07-07 12:10:34 -07:00
tailcfg_test.go all: fix JSON serialization under Go 1.27's finalized encoding/json/v2 2026-07-19 09:58:50 -07:00
tailcfg_view.go all: fix JSON serialization under Go 1.27's finalized encoding/json/v2 2026-07-19 09:58:50 -07:00
tailcfg.go all: fix JSON serialization under Go 1.27's finalized encoding/json/v2 2026-07-19 09:58:50 -07:00
tka.go all: update a few more references to network/tailnet lock 2026-05-28 16:44:16 +01:00