tailcfg: add Node.HasCap helpers

This makes a follow up change less noisy.

Updates #cleanup

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali
2023-09-18 09:36:26 -07:00
committed by Maisem Ali
parent d06b48dd0a
commit 4da0689c2c
8 changed files with 36 additions and 22 deletions

View File

@@ -368,6 +368,16 @@ type Node struct {
ExitNodeDNSResolvers []*dnstype.Resolver `json:",omitempty"`
}
// HasCap reports whether the node has the given capability.
func (v NodeView) HasCap(cap NodeCapability) bool {
return v.ж.HasCap(cap)
}
// HasCap reports whether the node has the given capability.
func (v *Node) HasCap(cap NodeCapability) bool {
return v != nil && slices.Contains(v.Capabilities, cap)
}
// DisplayName returns the user-facing name for a node which should
// be shown in client UIs.
//