mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-02 22:35:59 +00:00
client/tailscale/keys: fix client.Keys unmarshalling
Signed-off-by: Author Name hbowron@gmail.com Signed-off-by: Harry Bowron <harry@bolt.com> Fixes #7020
This commit is contained in:
parent
6e5faff51e
commit
c1daa42c24
@ -55,14 +55,14 @@ func (c *Client) Keys(ctx context.Context) ([]string, error) {
|
|||||||
return nil, handleErrorResponse(b, resp)
|
return nil, handleErrorResponse(b, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
var keys []struct {
|
var keys struct {
|
||||||
ID string `json:"id"`
|
Keys []*Key `json:"keys"`
|
||||||
}
|
}
|
||||||
if err := json.Unmarshal(b, &keys); err != nil {
|
if err := json.Unmarshal(b, &keys); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ret := make([]string, 0, len(keys))
|
ret := make([]string, 0, len(keys.Keys))
|
||||||
for _, k := range keys {
|
for _, k := range keys.Keys {
|
||||||
ret = append(ret, k.ID)
|
ret = append(ret, k.ID)
|
||||||
}
|
}
|
||||||
return ret, nil
|
return ret, nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user