summaryrefslogtreecommitdiffhomepage
path: root/cmd/tsconnect/src
AgeCommit message (Collapse)AuthorFilesLines
2025-06-27ipn/store: make StateStore.All optional (#16409)Andrew Lytvynov2-4/+0
This method is only needed to migrate between store.FileStore and tpm.tpmStore. We can make a runtime type assertion instead of implementing an unused method for every platform. Updates #15830 Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2025-06-26ipn/store: automatically migrate between plaintext and encrypted state (#16318)Andrew Lytvynov2-0/+4
Add a new `--encrypt-state` flag to `cmd/tailscaled`. Based on that flag, migrate the existing state file to/from encrypted format if needed. Updates #15830 Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
2023-11-28scripts/check_license_headers: enforce license on ts/tsx filesSonia Appasamy1-0/+3
Enforcing inclusion of our OSS license at the top of .ts and .tsx files. Also updates any relevant files in the repo that were previously missing the license comment. An additional `@license` comment is added to client/web/src/index.tsx to preserve the license in generated Javascript. Updates #10261 Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
2023-03-06cmd/tsconnect: pop CTA to make everything work with tailnet lockTom DNetto3-3/+23
Signed-off-by: Tom DNetto <tom@tailscale.com>
2023-03-01cmd/tsconnect: update device authorization copySonia Appasamy2-2/+2
"Device Authorization" was recently renamed to "Device Approval" on the control side. This change updates tsconnect to match. Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
2023-01-27all: update copyright and license headersWill Norris12-36/+24
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-17cmd/tsconnect: add progress and connection callbacksMihai Parparita3-5/+20
Allows UI to display slightly more fine-grained progress when the SSH connection is being established. Updates tailscale/corp#7186 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-10-06cmd/tsconnect: close the SSH session an unload event instead of beforeunloadMihai Parparita1-5/+5
The window may not end up getting unloaded (if other beforeunload handlers prevent the event), thus we should only close the SSH session if it's truly getting unloaded. Updates tailscale/corp#7304 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-09-29all: fix spelling mistakesJosh Soref1-2/+2
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-09-21cmd/tsconnect: add error callback for SSH sessionsMihai Parparita2-2/+3
We were just logging them to the console, which is useful for debugging, but we may want to show them in the UI too. Updates tailscale/corp#6939 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-09-19cmd/tsconnect: allow SSH connection timeout to be overriddenMihai Parparita2-0/+5
5 seconds may not be enough if we're still loading the derp map and connecting to a slow machine. Updates #5693 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-09-14cmd/tsconnect: use the parent window for `beforeunload` event listenerMihai Parparita1-6/+4
The SSH session may be rendered in a different window that the one that is executing the script. Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-09-12cmd/tsconnect: allow xterm.js terminal options to be passed inMihai Parparita1-2/+4
Allows clients to use a custom theme and other xterm.js customization options. Fixes #5610 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-09-12cmd/tsconnect: allow hostname to be specifiedMihai Parparita1-0/+1
The auto-generated hostname is nice as a default, but there are cases where the client has a more specific name that it can generate. Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-09-12cmd/tsconnect: fix xterm.js link opening not working when rendered into ↵Mihai Parparita1-1/+3
another window The default WebLinksAddon handler uses window.open(), but that gets blocked by the popup blocker when the event being handled is another window. We instead need to invoke open() on the window that the event was triggered in. Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-09-09cmd/tsconnect: enable web links addon in the terminalMihai Parparita2-0/+12
More user friendly, and as a side-effect we handle SSH check mode better, since the URL that's output is now clickable. Fixes #5247 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-09-08cmd/tsconnect: temporarily switch to xterm.js fork that handles popup windowsMihai Parparita2-19/+70
Allows other work to be unblocked while xtermjs/xterm.js#4069 is worked through. To enable testing the popup window handling, the standalone app allows opening of SSH sessions in new windows by holding down the alt key while pressing the SSH button. Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-08-31cmd/tsconnect: remove debugging codeMihai Parparita1-1/+1
Remove test prefix added to validate the error code from 27f36f77c364562bc1ca660c241291e23606e54d. Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-08-30cmd/tsconnect: output errors to the JS console tooMihai Parparita2-8/+22
We were just outputting them to the terminal, but that's hard to debug because we immediately tear down the terminal when getting an error. Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-08-26cmd/tsconnect: expose runSSHSession in npm packageMihai Parparita3-52/+55
Move it to lib/ so that it can be used in both the app and the package. Updates #5415 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-08-24cmd/tsconnect: extract NPM package for reusing in other projectsMihai Parparita12-40/+83
`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-09tsconnect: pass in authkey in dev mode (#5320)Charlotte Brandhorst-Satzkorn2-0/+9
This change allows for an auth key to be specified as a url query param for use in development mode. If an auth key is specified and valid, it will authorize the client for use immediately. Updates #5144 Signed-off-by: Charlotte Brandhorst-Satzkorn <charlotte@tailscale.com>
2022-08-08cmd/tsconnect: switch UI to PreactMihai Parparita10-283/+386
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-03cmd/tsconnect: make PeerAPI workMihai Parparita1-0/+7
JS -> native nodes worked already, tested by exposing a fetch() method to JS (it's Promise-based to be consistent with the native fetch() API). Native nodes -> JS almost worked, we just needed to set the LocalBackend on the userspace netstack. Fixes #5130 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-08-02cmd/tsconnect: make terminal resizableMihai Parparita6-16/+48
Makes the terminal container DOM node as large as the window (except for the header) via flexbox. The xterm.js terminal is then sized to fit via xterm-addon-fit. Once we have a computed rows/columns size, and we can tell the SSH session of the computed size. Required introducing an IPNSSHSession type to allow the JS to control the SSH session once opened. That alse allows us to programatically close it, which we do when the user closes the window with the session still active. I initially wanted to open the terminal in a new window instead (so that it could be resizable independently of the main window), but xterm.js does not appear to work well in that mode (possibly because it adds an IntersectionObserver to pause rendering when the window is not visible, and it ends up doing that when the parent window is hidden -- see xtermjs/xterm.js@87dca56dee8018a17b5cb22ec844b7013629da63) Fixes #5150 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-07-29cmd/tsconnect: allow SSH username to be specifiedMihai Parparita5-47/+118
Redoes the UI to be a form, with a username field and a host drop-down. Fixes #5139 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-07-27cmd/tsconnect: fix xterm CSS not being importedMihai Parparita1-2/+2
@import rules need to come first, they are (silently) ignored otherwise. Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-07-27cmd/tsconnect: add basic panic handlingMihai Parparita2-2/+31
The go wasm process exiting is a sign of an unhandled panic. Also add a explicit recover() call in the notify callback, that's where most logic bugs are likely to happen (and they may not be fatal). Also fixes the one panic that was encountered (nill pointer dereference when generating the JS view of the netmap). Fixes #5132 Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-07-27cmd/tsconnect: add Tailwind CSS support and switch to using itMihai Parparita3-95/+15
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 Parparita7-40/+126
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-19cmd/tsconnect: initial scaffolding for Tailscale Connect browser clientMihai Parparita6-0/+356
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>