summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyghtowl <warrick@tailscale.com>2022-09-27 10:35:34 -0700
committernyghtowl <warrick@tailscale.com>2022-09-27 10:35:34 -0700
commit0a6d75eecad850ac73edef1aae6ea1fc23eff213 (patch)
tree30a80538fd981c888443b6c408af652031a27704
parent70ee70b25dc2f1495acaf651918ab7858a2cf3b3 (diff)
downloadtailscale-nyghtowl/tailnet-name2.tar.xz
tailscale-nyghtowl/tailnet-name2.zip
tailconfig: add tailnet field to nodenyghtowl/tailnet-name2
Enable access to tailnet name from Node to track and avoid computing in unrelated functions like ngnix-auth Signed-off-by: nyghtowl <warrick@tailscale.com>
-rw-r--r--tailcfg/tailcfg.go5
-rw-r--r--tailcfg/tailcfg_clone.go2
-rw-r--r--tailcfg/tailcfg_view.go4
3 files changed, 7 insertions, 4 deletions
diff --git a/tailcfg/tailcfg.go b/tailcfg/tailcfg.go
index 4b57de4aa..0908c15ad 100644
--- a/tailcfg/tailcfg.go
+++ b/tailcfg/tailcfg.go
@@ -219,6 +219,10 @@ type Node struct {
MachineAuthorized bool `json:",omitempty"` // TODO(crawshaw): replace with MachineStatus
+ // Tailscale cert domain used to represent the alias applied whether by default, shared or custom.
+ // Combination of a TCD prefix that is default, tails-scales or custom with the ts.net public suffix.
+ TailnetName string `json:",omitempty"` // ??.ts.net
+
// Capabilities are capabilities that the node has.
// They're free-form strings, but should be in the form of URLs/URIs
// such as:
@@ -234,7 +238,6 @@ type Node struct {
ComputedName string `json:",omitempty"` // MagicDNS base name (for normal non-shared-in nodes), FQDN (without trailing dot, for shared-in nodes), or Hostname (if no MagicDNS)
computedHostIfDifferent string // hostname, if different than ComputedName, otherwise empty
ComputedNameWithHost string `json:",omitempty"` // either "ComputedName" or "ComputedName (computedHostIfDifferent)", if computedHostIfDifferent is set
- TailnetName string `json:",omitempty"` // SSO Tailnet name
}
// DisplayName returns the user-facing name for a node which should
diff --git a/tailcfg/tailcfg_clone.go b/tailcfg/tailcfg_clone.go
index 13257661b..a0e6e4699 100644
--- a/tailcfg/tailcfg_clone.go
+++ b/tailcfg/tailcfg_clone.go
@@ -91,11 +91,11 @@ var _NodeCloneNeedsRegeneration = Node(struct {
Online *bool
KeepAlive bool
MachineAuthorized bool
+ TailnetName string
Capabilities []string
ComputedName string
computedHostIfDifferent string
ComputedNameWithHost string
- TailnetName string
}{})
// Clone makes a deep copy of Hostinfo.
diff --git a/tailcfg/tailcfg_view.go b/tailcfg/tailcfg_view.go
index 956b7d4c2..a89076517 100644
--- a/tailcfg/tailcfg_view.go
+++ b/tailcfg/tailcfg_view.go
@@ -170,10 +170,10 @@ func (v NodeView) Online() *bool {
func (v NodeView) KeepAlive() bool { return v.ж.KeepAlive }
func (v NodeView) MachineAuthorized() bool { return v.ж.MachineAuthorized }
+func (v NodeView) TailnetName() string { return v.ж.TailnetName }
func (v NodeView) Capabilities() views.Slice[string] { return views.SliceOf(v.ж.Capabilities) }
func (v NodeView) ComputedName() string { return v.ж.ComputedName }
func (v NodeView) ComputedNameWithHost() string { return v.ж.ComputedNameWithHost }
-func (v NodeView) TailnetName() string { return v.ж.TailnetName }
func (v NodeView) Equal(v2 NodeView) bool { return v.ж.Equal(v2.ж) }
// A compilation failure here means this code must be regenerated, with the command at the top of this file.
@@ -200,11 +200,11 @@ var _NodeViewNeedsRegeneration = Node(struct {
Online *bool
KeepAlive bool
MachineAuthorized bool
+ TailnetName string
Capabilities []string
ComputedName string
computedHostIfDifferent string
ComputedNameWithHost string
- TailnetName string
}{})
// View returns a readonly view of Hostinfo.