mirror of
https://github.com/juanfont/headscale.git
synced 2026-09-22 00:04:53 +09:00
all: adopt maps and cmp helpers
This commit is contained in:
@@ -1399,17 +1399,11 @@ func (s *Scenario) GetIPs(user string) ([]netip.Addr, error) {
|
||||
|
||||
// GetClients returns all [TailscaleClient]s associated with a [User] in a [Scenario].
|
||||
func (s *Scenario) GetClients(user string) ([]TailscaleClient, error) {
|
||||
var clients []TailscaleClient
|
||||
|
||||
if ns, ok := s.users[user]; ok {
|
||||
for _, client := range ns.Clients {
|
||||
clients = append(clients, client)
|
||||
}
|
||||
|
||||
return clients, nil
|
||||
return xmaps.Values(ns.Clients), nil
|
||||
}
|
||||
|
||||
return clients, fmt.Errorf("getting clients: %w", errNoUserAvailable)
|
||||
return nil, fmt.Errorf("getting clients: %w", errNoUserAvailable)
|
||||
}
|
||||
|
||||
// ListTailscaleClients returns a list of [TailscaleClient]s given the [User]s
|
||||
|
||||
Reference in New Issue
Block a user