-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ipn/ipnlocal: add support for multiple profiles
Currently all user state is stored in ipn.Prefs, which is then persisted into the specified ipn.StateStore under a single key "_daemon" except in the case of Windows. Windows kind of already supports multiple profiles as multiple users can log in the node and go into "Unattended" mode. On Windows we do this by storing the desired prefs in the StateStore under `user-<user-id>` and then store another `server-mode-start-key` which only has `user-<user-id>` in the value. This allows tailscaled to discover that it needs to run in `Unattended` mode and it also informs tailscaled as to which prefs it needs to load. Say if the prefs are for UserID 123, we would store the actual prefs in `user-123` and store `user-123` in `server-mode-start-key`. For the generic support for multiple profiles, we leave the Windows behavior intact and unchanged. Instead we store profiles in a new format `profile-<profile-name>` and add another key `_current-profile` which would then point to `profile-<profile-name>`. The primary reason for the different keys is to not accidentally start a a profile on Windows while also allowing multiple profiles. By adding a new ProfileManager we also simplify some of the state machine from LocalBackend as it no longer needs to own prefs and also write it to disk. Signed-off-by: Maisem Ali <maisem@tailscale.com>
- Loading branch information
Showing
27 changed files
with
857 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.