tailconfig: add tailnet field to node

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>
pull/5696/head
nyghtowl 2022-09-27 10:35:34 -07:00
parent 70ee70b25d
commit 0a6d75eeca
3 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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.

View File

@ -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.