diff options
Diffstat (limited to 'types')
| -rw-r--r-- | types/netmap/netmap.go | 11 | ||||
| -rw-r--r-- | types/netmap/nodemut_test.go | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/types/netmap/netmap.go b/types/netmap/netmap.go index 233dcc656..e92a63278 100644 --- a/types/netmap/netmap.go +++ b/types/netmap/netmap.go @@ -68,6 +68,8 @@ type NetworkMap struct { // Domain is the current Tailnet name. Domain string + // DisplayName is the user editable version of the Domain. + DisplayName string `json:",omitempty"` // DomainAuditLogID is an audit log ID provided by control and // only populated if the domain opts into data-plane audit logging. @@ -187,6 +189,15 @@ func (nm *NetworkMap) DomainName() string { return nm.Domain } +// DisplayName returns the name of the NetworkMap's current tailnet user +// editable display name. If the map is nil, it returns an empty string. +func (nm *NetworkMap) GetDisplayName() string { + if nm == nil { + return "" + } + return nm.DisplayName +} + // 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. diff --git a/types/netmap/nodemut_test.go b/types/netmap/nodemut_test.go index f11a303af..353f9524a 100644 --- a/types/netmap/nodemut_test.go +++ b/types/netmap/nodemut_test.go @@ -45,7 +45,7 @@ func TestMapResponseContainsNonPatchFields(t *testing.T) { var want bool switch f.Name { - case "MapSessionHandle", "Seq", "KeepAlive", "PingRequest", "PopBrowserURL", "ControlTime": + case "MapSessionHandle", "Seq", "KeepAlive", "PingRequest", "PopBrowserURL", "ControlTime", "DisplayName": // There are meta fields that apply to all MapResponse values. // They should be ignored. want = false |
