mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 21:27:31 +00:00
ipn/ipnlocal,cmd/tailscale: persist tailnet name in user profile
This PR starts to persist the NetMap tailnet name in SetPrefs so that tailscaled clients can use this value to disambiguate fast user switching from one tailnet to another that are under the same exact login. We will also try to backfill this information during backend starts and profile switches so that users don't have to re-authenticate their profile. The first client to use this new information is the CLI in 'tailscale switch -list' which now uses text/tabwriter to display the ID, Tailnet, and Account. Since account names are ambiguous, we allow the user to pass 'tailscale switch ID' to specify the exact tailnet they want to switch to. Updates #9286 Signed-off-by: Marwan Sulaiman <marwan@tailscale.com>
This commit is contained in:

committed by
Marwan Sulaiman

parent
e75be017e4
commit
2dc0645368
@@ -177,6 +177,16 @@ func (nm *NetworkMap) MagicDNSSuffix() string {
|
||||
return MagicDNSSuffixOfNodeName(nm.Name)
|
||||
}
|
||||
|
||||
// DomainName returns the name of the NetworkMap's
|
||||
// current tailnet. If the map is nil, it returns
|
||||
// an empty string.
|
||||
func (nm *NetworkMap) DomainName() string {
|
||||
if nm == nil {
|
||||
return ""
|
||||
}
|
||||
return nm.Domain
|
||||
}
|
||||
|
||||
// SelfCapabilities returns SelfNode.Capabilities if nm and nm.SelfNode are
|
||||
// non-nil. This is a method so we can use it in envknob/logknob without a
|
||||
// circular dependency.
|
||||
|
Reference in New Issue
Block a user