mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-03 10:31:59 +00:00
tailcfg: update node display name fields and methods (#1207)
Signed-off-by: Sonia Appasamy <sonia@tailscale.com> Consolidates the node display name logic from each of the clients into tailcfg.Node. UI clients can use these names directly, rather than computing them independently.
This commit is contained in:
@@ -26,21 +26,3 @@ func TestHasSuffix(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestToBaseName(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
want string
|
||||
}{
|
||||
{"foo", "foo"},
|
||||
{"foo.com", "foo"},
|
||||
{"foo.example.com.beta.tailscale.net", "foo"},
|
||||
{"computer-a.test.gmail.com.beta.tailscale.net", "computer-a"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
got := ToBaseName(tt.name)
|
||||
if got != tt.want {
|
||||
t.Errorf("ToBaseName(%q) = %q; want %q", tt.name, got, tt.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user