From 857cd6c0d793b7a482096a0564d0dc52456324f4 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 26 Jan 2022 09:38:13 -0800 Subject: [PATCH] ipn/ipnstate: add TailnetName to status RELNOTE=tailscale status --json | jq .TailnetName Fixes tailscale/corp#3665 Change-Id: I85de027ba2781eb31ee1e0c5ab913b0dfa5b4c86 Signed-off-by: Brad Fitzpatrick --- ipn/ipnlocal/local.go | 1 + ipn/ipnstate/ipnstate.go | 4 ++++ types/netmap/netmap.go | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 7741b0a81..6ffc59891 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -381,6 +381,7 @@ func (b *LocalBackend) updateStatus(sb *ipnstate.StatusBuilder, extraLocked func if b.netMap != nil { s.MagicDNSSuffix = b.netMap.MagicDNSSuffix() s.CertDomains = append([]string(nil), b.netMap.DNS.CertDomains...) + s.TailnetName = b.netMap.Domain } }) sb.MutateSelfStatus(func(ss *ipnstate.PeerStatus) { diff --git a/ipn/ipnstate/ipnstate.go b/ipn/ipnstate/ipnstate.go index 518847582..fd77875cb 100644 --- a/ipn/ipnstate/ipnstate.go +++ b/ipn/ipnstate/ipnstate.go @@ -33,6 +33,10 @@ type Status struct { // "Starting", "Running". BackendState string + // TailnetName is the name of the network that's currently in + // use. + TailnetName string + AuthURL string // current URL provided by control to authorize client TailscaleIPs []netaddr.IP // Tailscale IP(s) assigned to this node Self *PeerStatus diff --git a/types/netmap/netmap.go b/types/netmap/netmap.go index 9cf90f28c..0507e3eb9 100644 --- a/types/netmap/netmap.go +++ b/types/netmap/netmap.go @@ -62,7 +62,9 @@ type NetworkMap struct { // ACLs - User tailcfg.UserID + User tailcfg.UserID + + // Domain is the current Tailnet name. Domain string UserProfiles map[tailcfg.UserID]tailcfg.UserProfile