summaryrefslogtreecommitdiffhomepage
path: root/cmd/tsconnect/common.go
AgeCommit message (Collapse)AuthorFilesLines
2026-03-04go.toolchain.branch: switch to Go 1.26Brad Fitzpatrick1-1/+1
Updates #18682 Change-Id: I1eadfab950e55d004484af880a5d8df6893e85e8 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2026-01-23all: remove AUTHORS file and references to itWill Norris1-1/+1
This file was never truly necessary and has never actually been used in the history of Tailscale's open source releases. A Brief History of AUTHORS files --- The AUTHORS file was a pattern developed at Google, originally for Chromium, then adopted by Go and a bunch of other projects. The problem was that Chromium originally had a copyright line only recognizing Google as the copyright holder. Because Google (and most open source projects) do not require copyright assignemnt for contributions, each contributor maintains their copyright. Some large corporate contributors then tried to add their own name to the copyright line in the LICENSE file or in file headers. This quickly becomes unwieldy, and puts a tremendous burden on anyone building on top of Chromium, since the license requires that they keep all copyright lines intact. The compromise was to create an AUTHORS file that would list all of the copyright holders. The LICENSE file and source file headers would then include that list by reference, listing the copyright holder as "The Chromium Authors". This also become cumbersome to simply keep the file up to date with a high rate of new contributors. Plus it's not always obvious who the copyright holder is. Sometimes it is the individual making the contribution, but many times it may be their employer. There is no way for the proejct maintainer to know. Eventually, Google changed their policy to no longer recommend trying to keep the AUTHORS file up to date proactively, and instead to only add to it when requested: https://opensource.google/docs/releasing/authors. They are also clear that: > Adding contributors to the AUTHORS file is entirely within the > project's discretion and has no implications for copyright ownership. It was primarily added to appease a small number of large contributors that insisted that they be recognized as copyright holders (which was entirely their right to do). But it's not truly necessary, and not even the most accurate way of identifying contributors and/or copyright holders. In practice, we've never added anyone to our AUTHORS file. It only lists Tailscale, so it's not really serving any purpose. It also causes confusion because Tailscalars put the "Tailscale Inc & AUTHORS" header in other open source repos which don't actually have an AUTHORS file, so it's ambiguous what that means. Instead, we just acknowledge that the contributors to Tailscale (whoever they are) are copyright holders for their individual contributions. We also have the benefit of using the DCO (developercertificate.org) which provides some additional certification of their right to make the contribution. The source file changes were purely mechanical with: git ls-files | xargs sed -i -e 's/\(Tailscale Inc &\) AUTHORS/\1 contributors/g' Updates #cleanup Change-Id: Ia101a4a3005adb9118051b3416f5a64a4a45987d Signed-off-by: Will Norris <will@tailscale.com>
2025-02-19go.toolchain.branch: update to Go 1.24 (#15016)Brad Fitzpatrick1-0/+4
* go.toolchain.branch: update to Go 1.24 Updates #15015 Change-Id: I29c934ec17e60c3ac3264f30fbbe68fc21422f4d Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com> * cmd/testwrapper: fix for go1.24 Updates #15015 Signed-off-by: Paul Scott <paul@tailscale.com> * go.mod,Dockerfile: bump to Go 1.24 Also bump golangci-lint to a version that was built with 1.24 Updates #15015 Signed-off-by: Andrew Lytvynov <awly@tailscale.com> --------- Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com> Signed-off-by: Paul Scott <paul@tailscale.com> Signed-off-by: Andrew Lytvynov <awly@tailscale.com> Co-authored-by: Paul Scott <paul@tailscale.com> Co-authored-by: Andrew Lytvynov <awly@tailscale.com>
2024-11-03cmd/tsconnect: block after starting esbuild dev serverBrad Fitzpatrick1-0/+1
Thanks to @davidbuzz for raising the issue in #13973. Fixes #8272 Fixes #13973 Change-Id: Ic413e14d34c82df3c70a97e591b90316b0b4946b Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-09-29go.mod,cmd/tsconnect: bump esbuildJames Tucker1-4/+7
Updates #8043 Signed-off-by: James Tucker <james@tailscale.com>
2023-08-24all: adjust some build tags for plan9Brad Fitzpatrick1-0/+2
I'm not saying it works, but it compiles. Updates #5794 Change-Id: I2f3c99732e67fe57a05edb25b758d083417f083e Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-08-17all: use Go 1.21 slices, maps instead of x/exp/{slices,maps}Brad Fitzpatrick1-1/+1
Updates #8419 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-08-10tool/{node,yarn}: update node and yarn toolsSonia Appasamy1-0/+3
Syncing these up with what we've got in corp. Updates tailscale/corp#13775 Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
2023-03-30cmd/tsconnect: allow root directory to be passed inMihai Parparita1-0/+3
#7339 changed the root directory logic to find the ancestor of the cwd with a go.mod file. This works when running the the binary from this repo directly, but breaks when we're a dependency in another repo. Allow the directory to be passed in via a -rootdir flag (the repo that depends on it can then use `go list -m -f '{{.Dir}}' tailscale.com` or similar to pass in the value). Updates tailscale/corp#10165 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2023-02-22cmd/tsconnect: find the build dir independently of -trimpathDavid Anderson1-4/+23
trimmed builds don't have absolute path information in executable metadata, which leads the runtime.Caller approach failing mysteriously in yarn with complaints about relative package paths. So, instead of using embedded package metadata to find paths, expect that we're being invoked within the tailscale repo, and locate the tsconnect directory that way. Signed-off-by: David Anderson <danderson@tailscale.com>
2023-01-30go.toolchain.rev: update to Go 1.20rc3Brad Fitzpatrick1-1/+1
Updates #7123 Change-Id: Ibdf53530251c120e7e20c24abcf4a05f2ff7ac97 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2023-01-27all: update copyright and license headersWill Norris1-3/+2
This updates all source files to use a new standard header for copyright and license declaration. Notably, copyright no longer includes a date, and we now use the standard SPDX-License-Identifier header. This commit was done almost entirely mechanically with perl, and then some minimal manual fixes. Updates #6865 Signed-off-by: Will Norris <will@tailscale.com>
2022-10-25cmd/tsconnect: run wasm-opt on the generated wasm fileMihai Parparita1-2/+33
Saves about 1.4MB from the generated wasm file. The Brotli size is basically unchanged (it's actually slightly larger, by 40K), suggesting that most of the size delta is due to not inlining and other changes that were easily compressible. However, it still seems worthwhile to have a smaller final binary, to reduce parse time and increase likelihood that we fit in the browser's disk cache. Actual performance appears to be unchanged. Updates #5142 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-10-10all: fix more resource leaks found by staticmajorEmmanuel T Odeke1-0/+5
Updates #5706 Signed-off-by: Emmanuel T Odeke <emmanuel@orijtech.com>
2022-09-15refactor: move from io/ioutil to io and os packagesEng Zer Jun1-2/+1
The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Reference: https://golang.org/doc/go1.16#ioutil Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-09-06cmd/tsconnect: add dev-pkg command for two-sided developmentMihai Parparita1-0/+34
Allows imports of the NPM package added by 1a093ef4822b973ec86d481924690349eddba5cb to be replaced with import("http://localhost:9090/pkg/pkg.js"), so that changes can be made in parallel to both the module and code that uses it (without any need for NPM publishing or even building of the package). Updates #5415 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-08-24cmd/tsconnect: extract NPM package for reusing in other projectsMihai Parparita1-2/+44
`src/` is broken up into several subdirectories: - `lib/` and `types`/ for shared code and type definitions (more code will be moved here) - `app/` for the existing Preact-app - `pkg/` for the new NPM package A new `build-pkg` esbuild-based command is added to generate the files for the NPM package. To generate type definitions (something that esbuild does not do), we set up `dts-bundle-generator`. Includes additional cleanups to the Wasm type definitions (we switch to string literals for enums, since exported const enums are hard to use via packages). Also allows the control URL to be set a runtime (in addition to the current build option), so that we don't have to rebuild the package for dev vs. prod use. Updates #5415 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-08-23cmd/tsconnect: stop writing build artifacts into src/Mihai Parparita1-38/+71
We can't write to src/ when tsconnect is used a dependency in another repo (see also b763a12331d318d2dba52fb5b8ed8a407ba28b00). We therefore need to switch from writing to src/ to using esbuild plugins to handle the requests for wasm_exec.js (the Go JS runtime for Wasm) and the Wasm build of the Go module. This has the benefit of allowing Go/Wasm changes to be picked up without restarting the server when in dev mode (Go compilation is fast enough that we can do this on every request, CSS compilation continues to be the long pole). Fixes #5382 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-08-08cmd/tsconnect: switch UI to PreactMihai Parparita1-0/+1
Reduces the amount of boilerplate to render the UI and makes it easier to respond to state changes (e.g. machine getting authorized, netmap changing, etc.) Preact adds ~13K to our bundle size (5K after Brotli) thus is a neglibible size contribution. We mitigate the delay in rendering the UI by having a static placeholder in the HTML. Required bumping the esbuild version to pick up evanw/esbuild#2349, which makes it easier to support Preact's JSX code generation. Fixes #5137 Fixes #5273 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-08-04tsconnect: add flag to specify control server (#5294)Charlotte Brandhorst-Satzkorn1-0/+5
To improve the local development experience, this change allows a control url to be passed in with the `--dev-control=` flag. If the flag is passed in when not specifying dev, an error is returned. If no flag is passed, the default remains the Tailscale controlled control server set by `ipn.DefaultControlURL`. Co-authored-by: Maisem Ali <maisem@tailscale.com> Signed-off-by: Charlotte Brandhorst-Satzkorn <charlotte@tailscale.com>
2022-08-02cmd/tsconnect: prefetch main.wasm when servingMihai Parparita1-0/+3
Avoids waterfalling of requests from the file (its load is triggered from JavaScript). Also has other cleanups to index.html, adding a <title> and moving the <script> to being loaded sooner (but still not delaying page rendering by using the defer attribute). Fixes #5141 Fixes #5135 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-07-27cmd/tsconnect: lint during build stepMihai Parparita1-1/+5
Ensures that TypeScript checks pass before we deploy. Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-07-27cmd/tsconnect: add Tailwind CSS support and switch to using itMihai Parparita1-0/+34
Integrates Tailwind CSS as an esbuild plugin that invokes the CLI to process the input. It takes ~400ms, so it seems like the easiest option (vs running a separate process for dev mode). Existing minimal look and feel is replicated with Tailwind classes, mostly to prove that the entire system works, including unused class removal. Also fixes yarn warnings about package.json not having a license (which were showing up when invoking any scripts). Fixes #5136 Fixes #5129 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-07-27cmd/tsconnect: switch to TypeScriptMihai Parparita1-1/+1
Continues to use esbuild for development mode and building. Also includes a `yarn lint` script that uses tsc to do full type checking. Fixes #5138 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-07-22cmd/tsconnect: pin yarn and nodeMihai Parparita1-5/+4
Adds a tool/yarn helper script that uses specific versions of yarn and node, downloading them if necessary. Modeled after tool/go (and the yarn and node Redo scripts from the corp repo). Also allows the path to yarn to be overidden (in case the user does not want to use this script) and always pipes yarn output (to make debugging and viewing of process easier). Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-07-20cmd/tsconnect: allow building static resources in a different directoryMihai Parparita1-1/+10
When using tsconnect as a module in another repo, we cannot write to the ./dist directory (modules directories are read-only by default - there is a -modcacherw flag for `go get` but we can't count on it). We add a -distdir flag that is honored by both the build and serve commands for where to place output in. Somewhat tedious because esbuild outputs paths relative to the working directory, so we need to do some extra munging to make them relative to the output directory. Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-07-19cmd/tsconnect: initial scaffolding for Tailscale Connect browser clientMihai Parparita1-0/+105
Runs a Tailscale client in the browser (via a WebAssembly build of the wasm package) and allows SSH access to machines. The wasm package exports a newIPN function, which returns a simple JS object with methods like start(), login(), logout() and ssh(). The golang.org/x/crypto/ssh package is used for the SSH client. Terminal emulation and QR code renedring is done via NPM packages (xterm and qrcode respectively), thus we also need a JS toolchain that can install and bundle them. Yarn is used for installation, and esbuild handles loading them and bundling for production serving. Updates #3157 Signed-off-by: Mihai Parparita <mihai@tailscale.com>