diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 480362d2c..75eff2028 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -194,6 +194,9 @@ jobs: goarch: amd64 - goos: openbsd goarch: amd64 + # Plan9 + - goos: plan9 + goarch: amd64 runs-on: ubuntu-22.04 steps: diff --git a/Makefile b/Makefile index 4a9acb0b4..c4391b90a 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,9 @@ buildlinuxarm: ## Build tailscale CLI for linux/arm buildwasm: ## Build tailscale CLI for js/wasm GOOS=js GOARCH=wasm ./tool/go install ./cmd/tsconnect/wasm ./cmd/tailscale/cli +buildplan9: + GOOS=plan9 GOARCH=amd64 ./tool/go install ./cmd/tailscale ./cmd/tailscaled + buildlinuxloong64: ## Build tailscale CLI for linux/loong64 GOOS=linux GOARCH=loong64 ./tool/go install tailscale.com/cmd/tailscale tailscale.com/cmd/tailscaled diff --git a/cmd/k8s-operator/operator.go b/cmd/k8s-operator/operator.go index fd2a8b09c..213634780 100644 --- a/cmd/k8s-operator/operator.go +++ b/cmd/k8s-operator/operator.go @@ -1,6 +1,8 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause +//go:build !plan9 + // tailscale-operator provides a way to expose services running in a Kubernetes // cluster to your Tailnet. package main diff --git a/cmd/k8s-operator/operator_test.go b/cmd/k8s-operator/operator_test.go index 49210507e..cbf915df3 100644 --- a/cmd/k8s-operator/operator_test.go +++ b/cmd/k8s-operator/operator_test.go @@ -1,6 +1,8 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause +//go:build !plan9 + package main import ( diff --git a/cmd/k8s-operator/proxy.go b/cmd/k8s-operator/proxy.go index f794e3a98..799cbb033 100644 --- a/cmd/k8s-operator/proxy.go +++ b/cmd/k8s-operator/proxy.go @@ -1,6 +1,8 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause +//go:build !plan9 + package main import ( diff --git a/cmd/k8s-operator/proxy_test.go b/cmd/k8s-operator/proxy_test.go index aed21134b..741c1fe85 100644 --- a/cmd/k8s-operator/proxy_test.go +++ b/cmd/k8s-operator/proxy_test.go @@ -1,6 +1,8 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause +//go:build !plan9 + package main import ( diff --git a/cmd/k8s-operator/sts.go b/cmd/k8s-operator/sts.go index 1cf0b61a9..3d53c1a6e 100644 --- a/cmd/k8s-operator/sts.go +++ b/cmd/k8s-operator/sts.go @@ -1,6 +1,8 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause +//go:build !plan9 + package main import ( diff --git a/cmd/k8s-operator/svc.go b/cmd/k8s-operator/svc.go index a72421080..ee65b8b48 100644 --- a/cmd/k8s-operator/svc.go +++ b/cmd/k8s-operator/svc.go @@ -1,6 +1,8 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause +//go:build !plan9 + package main import ( diff --git a/cmd/sync-containers/main.go b/cmd/sync-containers/main.go index 94864ff27..6317b4943 100644 --- a/cmd/sync-containers/main.go +++ b/cmd/sync-containers/main.go @@ -1,6 +1,8 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause +//go:build !plan9 + // The sync-containers command synchronizes container image tags from one // registry to another. // diff --git a/cmd/tailscaled/sigpipe.go b/cmd/tailscaled/sigpipe.go new file mode 100644 index 000000000..2fcdab2a4 --- /dev/null +++ b/cmd/tailscaled/sigpipe.go @@ -0,0 +1,12 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + +//go:build go1.21 && !plan9 + +package main + +import "syscall" + +func init() { + sigPipe = syscall.SIGPIPE +} diff --git a/cmd/tailscaled/tailscaled.go b/cmd/tailscaled/tailscaled.go index 45f2afc3e..e97139078 100644 --- a/cmd/tailscaled/tailscaled.go +++ b/cmd/tailscaled/tailscaled.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -//go:build go1.19 +//go:build go1.21 // The tailscaled program is the Tailscale client daemon. It's configured // and controlled via the tailscale CLI program. @@ -394,6 +394,8 @@ func run() error { return startIPNServer(context.Background(), logf, pol.PublicID, sys) } +var sigPipe os.Signal // set by sigpipe.go + func startIPNServer(ctx context.Context, logf logger.Logf, logID logid.PublicID, sys *tsd.System) error { ln, err := safesocket.Listen(args.socketpath) if err != nil { @@ -409,7 +411,9 @@ func startIPNServer(ctx context.Context, logf logger.Logf, logID logid.PublicID, // SIGPIPE sometimes gets generated when CLIs disconnect from // tailscaled. The default action is to terminate the process, we // want to keep running. - signal.Ignore(syscall.SIGPIPE) + if sigPipe != nil { + signal.Ignore(sigPipe) + } go func() { select { case s := <-interrupt: diff --git a/cmd/tsconnect/build-pkg.go b/cmd/tsconnect/build-pkg.go index 1b93e5ba0..047504858 100644 --- a/cmd/tsconnect/build-pkg.go +++ b/cmd/tsconnect/build-pkg.go @@ -1,6 +1,8 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause +//go:build !plan9 + package main import ( diff --git a/cmd/tsconnect/build.go b/cmd/tsconnect/build.go index 6178ddb9b..e3384b664 100644 --- a/cmd/tsconnect/build.go +++ b/cmd/tsconnect/build.go @@ -1,6 +1,8 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause +//go:build !plan9 + package main import ( diff --git a/cmd/tsconnect/common.go b/cmd/tsconnect/common.go index 902768589..dae8b73a2 100644 --- a/cmd/tsconnect/common.go +++ b/cmd/tsconnect/common.go @@ -1,6 +1,8 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause +//go:build !plan9 + package main import ( diff --git a/cmd/tsconnect/dev-pkg.go b/cmd/tsconnect/dev-pkg.go index b23e323e4..de534c3b2 100644 --- a/cmd/tsconnect/dev-pkg.go +++ b/cmd/tsconnect/dev-pkg.go @@ -1,6 +1,8 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause +//go:build !plan9 + package main import ( diff --git a/cmd/tsconnect/dev.go b/cmd/tsconnect/dev.go index 60e747270..87b10adaf 100644 --- a/cmd/tsconnect/dev.go +++ b/cmd/tsconnect/dev.go @@ -1,6 +1,8 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause +//go:build !plan9 + package main import ( diff --git a/cmd/tsconnect/serve.go b/cmd/tsconnect/serve.go index 49e7d3135..d780bdd57 100644 --- a/cmd/tsconnect/serve.go +++ b/cmd/tsconnect/serve.go @@ -1,6 +1,8 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause +//go:build !plan9 + package main import ( diff --git a/cmd/tsconnect/tsconnect.go b/cmd/tsconnect/tsconnect.go index 1e91e47ee..4c8a0a52e 100644 --- a/cmd/tsconnect/tsconnect.go +++ b/cmd/tsconnect/tsconnect.go @@ -1,6 +1,8 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause +//go:build !plan9 + // The tsconnect command builds and serves the static site that is generated for // the Tailscale Connect JS/WASM client. Can be run in 3 modes: // - dev: builds the site and serves it. JS and CSS changes can be picked up diff --git a/go.mod b/go.mod index 1b319b9e0..91399e77a 100644 --- a/go.mod +++ b/go.mod @@ -64,7 +64,7 @@ require ( github.com/tailscale/hujson v0.0.0-20221223112325-20486734a56a github.com/tailscale/mkctr v0.0.0-20220601142259-c0b937af2e89 github.com/tailscale/netlink v1.1.1-0.20211101221916-cabfb018fe85 - github.com/tailscale/wireguard-go v0.0.0-20230710185534-bb2c8f22eccf + github.com/tailscale/wireguard-go v0.0.0-20230824215414-93bd5cbf7fd8 github.com/tc-hib/winres v0.2.0 github.com/tcnksm/go-httpstat v0.2.0 github.com/toqueteos/webbrowser v1.2.0 diff --git a/go.sum b/go.sum index bf88160a4..f9e62235f 100644 --- a/go.sum +++ b/go.sum @@ -878,8 +878,8 @@ github.com/tailscale/mkctr v0.0.0-20220601142259-c0b937af2e89 h1:7xU7AFQE83h0wz/ github.com/tailscale/mkctr v0.0.0-20220601142259-c0b937af2e89/go.mod h1:OGMqrTzDqmJkGumUTtOv44Rp3/4xS+QFbE8Rn0AGlaU= github.com/tailscale/netlink v1.1.1-0.20211101221916-cabfb018fe85 h1:zrsUcqrG2uQSPhaUPjUQwozcRdDdSxxqhNgNZ3drZFk= github.com/tailscale/netlink v1.1.1-0.20211101221916-cabfb018fe85/go.mod h1:NzVQi3Mleb+qzq8VmcWpSkcSYxXIg0DkI6XDzpVkhJ0= -github.com/tailscale/wireguard-go v0.0.0-20230710185534-bb2c8f22eccf h1:bHQHwIHId353jAF2Lm0cGDjJpse/PYS0I0DTtihL9Ls= -github.com/tailscale/wireguard-go v0.0.0-20230710185534-bb2c8f22eccf/go.mod h1:QRIcq2+DbdIC5sKh/gcAZhuqu6WT6L6G8/ALPN5wqYw= +github.com/tailscale/wireguard-go v0.0.0-20230824215414-93bd5cbf7fd8 h1:V9kSpiTzFp7OTgJinu/kSJlsI6EfRs8wJgQ+Q+5a8v4= +github.com/tailscale/wireguard-go v0.0.0-20230824215414-93bd5cbf7fd8/go.mod h1:QRIcq2+DbdIC5sKh/gcAZhuqu6WT6L6G8/ALPN5wqYw= github.com/tc-hib/winres v0.2.0 h1:gly/ivDWGvlhl7ENtEmA7wPQ6dWab1LlLq/DgcZECKE= github.com/tc-hib/winres v0.2.0/go.mod h1:uG6S5M2Q0/kThoqsCSYvGJODUQP9O9R0SNxUPmFIegw= github.com/tcnksm/go-httpstat v0.2.0 h1:rP7T5e5U2HfmOBmZzGgGZjBQ5/GluWUylujl0tJ04I0= diff --git a/logtail/filch/filch_wasm.go b/logtail/filch/filch_stub.go similarity index 91% rename from logtail/filch/filch_wasm.go rename to logtail/filch/filch_stub.go index 019ee4e14..e69ce74cb 100644 --- a/logtail/filch/filch_wasm.go +++ b/logtail/filch/filch_stub.go @@ -1,6 +1,8 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause +//go:build wasm || plan9 + package filch import ( diff --git a/logtail/filch/filch_unix.go b/logtail/filch/filch_unix.go index 34cce59b4..5c4552dec 100644 --- a/logtail/filch/filch_unix.go +++ b/logtail/filch/filch_unix.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -//go:build !windows && !wasm +//go:build !windows && !wasm && !plan9 package filch diff --git a/net/tstun/tstun_plan9.go b/net/tstun/tstun_plan9.go new file mode 100644 index 000000000..4472a7a5d --- /dev/null +++ b/net/tstun/tstun_plan9.go @@ -0,0 +1,17 @@ +// Copyright (c) Tailscale Inc & AUTHORS +// SPDX-License-Identifier: BSD-3-Clause + +package tstun + +import ( + "github.com/tailscale/wireguard-go/tun" + "tailscale.com/types/logger" +) + +func New(logf logger.Logf, tunName string) (tun.Device, string, error) { + panic("not implemented") +} + +func Diagnose(logf logger.Logf, tunName string, err error) { + panic("not implemented") +} diff --git a/net/tstun/tun.go b/net/tstun/tun.go index b31ffa7ca..079a10b42 100644 --- a/net/tstun/tun.go +++ b/net/tstun/tun.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -//go:build !wasm +//go:build !wasm && !plan9 // Package tun creates a tuntap device, working around OS-specific // quirks if necessary. diff --git a/tstest/integration/vms/harness_test.go b/tstest/integration/vms/harness_test.go index a72de15ac..1e080414d 100644 --- a/tstest/integration/vms/harness_test.go +++ b/tstest/integration/vms/harness_test.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -//go:build !windows +//go:build !windows && !plan9 package vms diff --git a/tstest/integration/vms/nixos_test.go b/tstest/integration/vms/nixos_test.go index 54402ca13..c2998ff3c 100644 --- a/tstest/integration/vms/nixos_test.go +++ b/tstest/integration/vms/nixos_test.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -//go:build !windows +//go:build !windows && !plan9 package vms diff --git a/tstest/integration/vms/top_level_test.go b/tstest/integration/vms/top_level_test.go index d282a2290..c107fd89c 100644 --- a/tstest/integration/vms/top_level_test.go +++ b/tstest/integration/vms/top_level_test.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -//go:build !windows +//go:build !windows && !plan9 package vms diff --git a/tstest/integration/vms/vm_setup_test.go b/tstest/integration/vms/vm_setup_test.go index 87320fb53..0695df268 100644 --- a/tstest/integration/vms/vm_setup_test.go +++ b/tstest/integration/vms/vm_setup_test.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -//go:build !windows +//go:build !windows && !plan9 package vms diff --git a/tstest/integration/vms/vms_steps_test.go b/tstest/integration/vms/vms_steps_test.go index a776d72d1..89e99c16c 100644 --- a/tstest/integration/vms/vms_steps_test.go +++ b/tstest/integration/vms/vms_steps_test.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -//go:build !windows +//go:build !windows && !plan9 package vms diff --git a/tstest/integration/vms/vms_test.go b/tstest/integration/vms/vms_test.go index bf650b9db..e7167c2b8 100644 --- a/tstest/integration/vms/vms_test.go +++ b/tstest/integration/vms/vms_test.go @@ -1,7 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -//go:build !windows +//go:build !windows && !plan9 package vms diff --git a/wgengine/magicsock/endpoint_default.go b/wgengine/magicsock/endpoint_default.go index fc3037808..1ed6e5e0e 100644 --- a/wgengine/magicsock/endpoint_default.go +++ b/wgengine/magicsock/endpoint_default.go @@ -1,8 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -//go:build !js && !wasm -// +build !js,!wasm +//go:build !js && !wasm && !plan9 package magicsock diff --git a/wgengine/magicsock/endpoint_js.go b/wgengine/magicsock/endpoint_stub.go similarity index 88% rename from wgengine/magicsock/endpoint_js.go rename to wgengine/magicsock/endpoint_stub.go index 005571edf..a209c352b 100644 --- a/wgengine/magicsock/endpoint_js.go +++ b/wgengine/magicsock/endpoint_stub.go @@ -1,8 +1,7 @@ // Copyright (c) Tailscale Inc & AUTHORS // SPDX-License-Identifier: BSD-3-Clause -//go:build js || wasm -// +build js wasm +//go:build wasm || plan9 package magicsock