summaryrefslogtreecommitdiffhomepage
path: root/ipn/backend.go
AgeCommit message (Collapse)AuthorFilesLines
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-11-16types/netmap: remove PrivateKey from NetworkMapBrad Fitzpatrick1-1/+1
It's an unnecessary nuisance having it. We go out of our way to redact it in so many places when we don't even need it there anyway. Updates #12639 Change-Id: I5fc72e19e9cf36caeb42cf80ba430873f67167c3 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-09-16ipn: fix the string representation of an empty ipn.NotifyAlex Chan1-1/+5
Before: `ipn.Notify}` After: `ipn.Notify{}` Updates #cleanup Signed-off-by: Alex Chan <alexc@tailscale.com>
2025-08-27ipn/local: add the suggested exit node to the ipn bus (#16748)Jonathan Nobels1-7/+17
fixes tailscale/corp#26369 The suggested exit node is currently only calculated during a localAPI request. For older UIs, this wasn't a bad choice - we could just fetch it on-demand when a menu presented itself. For newer incarnations however, this is an always-visible field that needs to react to changes in the suggested exit node's value. This change recalculates the suggested exit node ID on netmap updates and broadcasts it on the IPN bus. The localAPI version of this remains intact for the time being. Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
2025-06-04ipn: add watch opt to include actions in health messagesJames Sanderson1-0/+2
Updates tailscale/corp#27759 Signed-off-by: James Sanderson <jsanderson@tailscale.com>
2025-01-04ipn: declare NotifyWatchOpt consts without using iotaBrad Fitzpatrick1-9/+15
Updates #cleanup Updates #1909 (noticed while working on that) Change-Id: I505001e5294287ad2a937b4db61d9e67de70fa14 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2025-01-03ipn: update reference to Notify's Swift definitionBrad Fitzpatrick1-1/+1
Updates #cleanup Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-11-18ipn/ipnlocal: add IPN Bus NotifyRateLimit watch bit NotifyRateLimitBrad Fitzpatrick1-0/+2
Limit spamming GUIs with boring updates to once in 3 seconds, unless the notification is relatively interesting and the GUI should update immediately. This is basically @barnstar's #14119 but with the logic moved to be per-watch-session (since the bit is per session), rather than globally. And this distinguishes notable Notify messages (such as state changes) and makes them send immediately. Updates tailscale/corp#24553 Change-Id: I79cac52cce85280ce351e65e76ea11e107b00b49 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-11-18ipn: remove unused Notify.BackendLogIDBrad Fitzpatrick1-4/+0
Updates #14129 Change-Id: I13b5df8765e786a4a919d6b2e72afe987000b2d1 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-10-08util/syspolicy, ipn: add "tailscale debug component-logs" supportNick Khyl1-0/+1
Fixes #13313 Fixes #12687 Signed-off-by: Nick Khyl <nickk@tailscale.com>
2024-06-14health: begin work to use structured health warnings instead of strings, ↵Andrea Gottardo1-0/+11
pipe changes into ipn.Notify (#12406) Updates tailscale/tailscale#4136 This PR is the first round of work to move from encoding health warnings as strings and use structured data instead. The current health package revolves around the idea of Subsystems. Each subsystem can have (or not have) a Go error associated with it. The overall health of the backend is given by the concatenation of all these errors. This PR polishes the concept of Warnable introduced by @bradfitz a few weeks ago. Each Warnable is a component of the backend (for instance, things like 'dns' or 'magicsock' are Warnables). Each Warnable has a unique identifying code. A Warnable is an entity we can warn the user about, by setting (or unsetting) a WarningState for it. Warnables have: - an identifying Code, so that the GUI can track them as their WarningStates come and go - a Title, which the GUIs can use to tell the user what component of the backend is broken - a Text, which is a function that is called with a set of Args to generate a more detailed error message to explain the unhappy state Additionally, this PR also begins to send Warnables and their WarningStates through LocalAPI to the clients, using ipn.Notify messages. An ipn.Notify is only issued when a warning is added or removed from the Tracker. In a next PR, we'll get rid of subsystems entirely, and we'll start using structured warnings for all errors affecting the backend functionality. Signed-off-by: Andrea Gottardo <andrea@gottardo.me>
2024-04-15ipn: remove unused Options.LegacyMigrationPrefsBrad Fitzpatrick1-10/+3
I'm on a mission to simplify LocalBackend.Start and its locking and deflake some tests. I noticed this hasn't been used since March 2023 when it was removed from the Windows client in corp 66be796d33c. So, delete. Updates #11649 Change-Id: I40f2cb75fb3f43baf23558007655f65a8ec5e1b2 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-04-14ipn/ipnlocal: remove some dead code (legacyBackend methods) from LocalBackendBrad Fitzpatrick1-1/+1
Nothing used it. Updates #11649 Change-Id: Ic1c331d947974cd7d4738ff3aafe9c498853689e Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-04-03tailscale: update tailfs functions and vars to use drive naming (#11597)Charlotte Brandhorst-Satzkorn1-3/+3
This change updates all tailfs functions and the majority of the tailfs variables to use the new drive naming. Updates tailscale/corp#16827 Signed-off-by: Charlotte Brandhorst-Satzkorn <charlotte@tailscale.com>
2024-04-02tailscale: update tailfs file and package names (#11590)Charlotte Brandhorst-Satzkorn1-2/+2
This change updates the tailfs file and package names to their new naming convention. Updates #tailscale/corp#16827 Signed-off-by: Charlotte Brandhorst-Satzkorn <charlotte@tailscale.com>
2024-03-27ipn/localapi: add support for multipart POST to file-putPercy Wegmann1-2/+2
This allows sending multiple files via Taildrop in one request. Progress is tracked via ipn.Notify. Updates tailscale/corp#18202 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-03-27ipn/localapi: add support for multipart POST to file-putPercy Wegmann1-3/+21
This allows sending multiple files via Taildrop in one request. Progress is tracked via ipn.Notify. Updates tailscale/corp#18202 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-03-08ipn,tailfs: tie TailFS share configuration to user profilePercy Wegmann1-6/+7
Previously, the configuration of which folders to share persisted across profile changes. Now, it is tied to the user's profile. Updates tailscale/corp#16827 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-02-29ipn: include full tailfs shares in ipn notificationsPercy Wegmann1-3/+5
This allows the Mac application to regain access to restricted folders after restarts. Updates tailscale/corp#16827 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-02-09tailfs: clean up naming and package structurePercy Wegmann1-6/+7
- Restyles tailfs -> tailFS - Defines interfaces for main TailFS types - Moves implemenatation of TailFS into tailfsimpl package Updates tailscale/corp#16827 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-02-09tailfs: initial implementationPercy Wegmann1-1/+8
Add a WebDAV-based folder sharing mechanism that is exposed to local clients at 100.100.100.100:8080 and to remote peers via a new peerapi endpoint at /v0/tailfs. Add the ability to manage folder sharing via the new 'share' CLI sub-command. Updates tailscale/corp#16827 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-01-09taildrop: remove breaking abstraction layers for apple (#10728)Rhea Ghosh1-0/+1
Removes the avoidFinalRename logic and all associated code as it is no longer required by the Apple clients. Enables resume logic to be usable for Apple clients. Fixes tailscale/corp#14772 Signed-off-by: Rhea Ghosh <rhea@tailscale.com>
2023-10-03cmd/tailscale,ipn/ipnlocal: print debug component namesVal1-0/+7
Make the 'tailscale debug component-logs' command print the component names for which extra logging can be turned on, for easier discoverability of debug functions. Updates #cleanup Co-authored-by: Paul Scott <paul@tailscale.com> Signed-off-by: Val <valerie@tailscale.com>
2023-09-05ipn, ipn/ipnlocal: add session identifier for WatchIPNBusMarwan Sulaiman1-1/+7
This PR adds a SessionID field to the ipn.Notify struct so that ipn buses can identify a session and register deferred clean up code in the future. The first use case this is for is to be able to tie foreground serve configs to a specific watch session and ensure its clean up when a connection is closed. Updates #8489 Signed-off-by: Marwan Sulaiman <marwan@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>
2023-01-03cmd/tailscale/cli: redact private key in debug netmap output by defaultDavid Anderson1-0/+2
This makes `tailscale debug watch-ipn` safe to use for troubleshooting user issues, in addition to local debugging during development. Signed-off-by: David Anderson <danderson@tailscale.com>
2022-12-02ipn: update comments that refer to Options.PrefsMihai Parparita1-15/+6
Things are slightly less tangled now that we've migrated prefs to the backend (and renamed the field to LegacyMigrationPrefs). Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2022-11-30ipn{,/ipnlocal}: add ipn.NotifyInitial* flags to WatchIPNBusBrad Fitzpatrick1-0/+4
To simplify clients getting the initial state when they subscribe. Change-Id: I2490a5ab2411253717c74265a46a98012b80db82 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-11-28ipn: remove unused Backend interfaceBrad Fitzpatrick1-32/+0
Only the macOS/iOS clients care about it still, so we'll move it to their repo. But keep a test that makes sure that LocalBackend continues to implement it so we get an early warning sign before we break macOS/iOS. Change-Id: I56392b740fe55b4d28468b77124c821b5c46c22b Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-11-26ipn: add a WatchIPNBus option bit to subscribe to EngineStatus changesBrad Fitzpatrick1-0/+11
So GUI clients don't need to poll for it. We still poll internally (for now!) but that's still cheaper. And will get much cheaper later, without having to modify clients once they start sending this bit. Change-Id: I36647b701c8d1fe197677e5eb76f6894e8ff79f7 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-11-23tailcfg, ipn, controlclient: add MapResponse.ClientVersion, plumb to IPN busBrad Fitzpatrick1-0/+4
Updates #6480 Change-Id: I6321071425cd091148d8140d1eb24dd536bb7984 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-11-22ipn{,/ipnlocal}, client/tailscale: move Taildrop recv notifications to ↵Brad Fitzpatrick1-0/+4
LocalAPI HTTP method Updates #6417 Change-Id: Iec544c477a0e5e9f1c6bf23555afec06255e2e22 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-11-11ipn/ipnlocal: add support for multiple user profilesMaisem Ali1-37/+13
Signed-off-by: Maisem Ali <maisem@tailscale.com>
2022-11-04ipn: add missing check for nil Notify.PrefsMaisem Ali1-1/+1
This was missed in 6afe26575cf155bd0baba8e4770bc49c0d55e2c1 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2022-11-04ipn: make Notify.Prefs be a *ipn.PrefsViewMaisem Ali1-1/+1
It is currently a `ipn.PrefsView` which means when we do a JSON roundtrip, we go from an invalid Prefs to a valid one. This makes it a pointer, which fixes the JSON roundtrip. This was introduced in 0957bc5af2a544f7d197ea1e743696e8ba103b9f. Signed-off-by: Maisem Ali <maisem@tailscale.com>
2022-10-24ipn/ipnlocal: use ipn.PrefsViewMaisem Ali1-2/+2
Signed-off-by: Maisem Ali <maisem@tailscale.com>
2022-10-04wgengine/magicsock: make debug-level stuff not logged by defaultBrad Fitzpatrick1-0/+5
And add a CLI/localapi and c2n mechanism to enable it for a fixed amount of time. Updates #1548 Change-Id: I71674aaf959a9c6761ff33bbf4a417ffd42195a7 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-09-29all: fix spelling mistakesJosh Soref1-1/+1
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-08-02all: gofmt for Go 1.19Brad Fitzpatrick1-6/+6
Updates #5210 Change-Id: Ib02cd5e43d0a8db60c1f09755a8ac7b140b670be Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-05-03ipn/ipnlocal: move Ping method from IPN bus to LocalBackend (HTTP)Brad Fitzpatrick1-15/+7
Change-Id: I61759f1dae8d9d446353db54c8b1e13bfffb3287 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-05-03wgengine, net/packet, cmd/tailscale: add ICMP echoJames Tucker1-1/+1
Updates tailscale/corp#754 Signed-off-by: James Tucker <james@tailscale.com>
2022-04-29ipn: remove FakeExpireAfter Backend functionMihai Parparita1-5/+0
No callers remain (last one was removed with tailscale/corp@1c095ae08fcc21362db65035a117672a71b4a081), and it's pretty esoteric. Signed-off-by: Mihai Parparita <mihai@tailscale.com>
2021-11-01ipn: use key.NodePublic instead of tailcfg.NodeKeyDavid Anderson1-1/+2
Updates #3206 Signed-off-by: David Anderson <danderson@tailscale.com>
2021-05-04ipnlocal: accept a new opts.UpdatePrefs field.Avery Pennarun1-0/+22
This is needed because the original opts.Prefs field was at some point subverted for use in frontend->backend state migration for backward compatibility on some platforms. We still need that feature, but we also need the feature of providing the full set of prefs from `tailscale up`, *not* including overwriting the prefs.Persist keys, so we can't use the original field from `tailscale up`. `tailscale up` had attempted to compensate for that by doing SetPrefs() before Start(), but that violates the ipn.Backend contract, which says you should call Start() before anything else (that's why it's called Start()). As a result, doing SetPrefs({ControlURL=..., WantRunning=true}) would cause a connection to the *previous* control server (because WantRunning=true), and then connect to the *new* control server only after running Start(). This problem may have been avoided before, but only by pure luck. It turned out to be relatively harmless since the connection to the old control server was immediately closed and replaced anyway, but it created a race condition that could have caused spurious notifications or rejected keys if the server responded quickly. As already covered by existing TODOs, a better fix would be to have Start() get out of the business of state migration altogether. But we're approaching a release so I want to make the minimum possible fix. Fixes #1840. Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
2021-04-30ipn: mock controlclient.Client; big ipn.Backend state machine test.apenwarr/statetestAvery Pennarun1-0/+45
A very long unit test that verifies the way the controlclient and ipn.Backend interact. This is a giant sequential test of the state machine. The test passes, but only because it's asserting all the wrong behaviour. I marked all the behaviour I think is wrong with BUG comments, and several additional test opportunities with TODO. Note: the new test supercedes TestStartsInNeedsLoginState, which was checking for incorrect behaviour (although the new test still checks for the same incorrect behaviour) and assumed .Start() would converge before returning, which it happens to do, but only for this very specific case, for the current implementation. You're supposed to wait for the notifications. Updates: tailscale/corp#1660 Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
2021-04-23ipn/ipnlocal: add a LocalBackend.Start fast path if already runningBrad Fitzpatrick1-11/+15
Updates tailscale/corp#1621 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-20ipn{,/ipnlocal}: in direct file receive mode, don't rename partial fileBrad Fitzpatrick1-6/+9
Let caller (macOS) do it so Finder progress bar can be dismissed without races. Updates tailscale/corp#1575 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-12ipn/ipnlocal: add LocalBackend.SetDirectFileRootBrad Fitzpatrick1-0/+7
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-11ipn/localapi: move EditPrefs to localapiBrad Fitzpatrick1-2/+0
Follow-up/revision to recent 53cfff109b01baa3d219697a1a9e2ea16c4b0d3d which added EditPrefs. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-09ipn/ipnlocal: always set Notify.FilesWaiting, set IncomingFiles non-nil when ↵Brad Fitzpatrick1-2/+11
empty