Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

new IP allocator and add postgres to integration tests. #1756

Merged
merged 10 commits into from
Feb 18, 2024
17 changes: 17 additions & 0 deletions hscontrol/grpcv1.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package hscontrol
import (
"context"
"fmt"
"sort"
"strings"
"time"

Expand Down Expand Up @@ -98,6 +99,10 @@ func (api headscaleV1APIServer) ListUsers(
response[index] = user.Proto()
}

sort.Slice(response, func(i, j int) bool {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good lord, yes.

return response[i].Id < response[j].Id
})

log.Trace().Caller().Interface("users", response).Msg("")

return &v1.ListUsersResponse{Users: response}, nil
Expand Down Expand Up @@ -168,6 +173,10 @@ func (api headscaleV1APIServer) ListPreAuthKeys(
response[index] = key.Proto()
}

sort.Slice(response, func(i, j int) bool {
return response[i].Id < response[j].Id
})

return &v1.ListPreAuthKeysResponse{PreAuthKeys: response}, nil
}

Expand Down Expand Up @@ -427,6 +436,10 @@ func (api headscaleV1APIServer) ListNodes(
return nil, err
}

sort.Slice(nodes, func(i, j int) bool {
return nodes[i].ID < nodes[j].ID
})

response := make([]*v1.Node, len(nodes))
for index, node := range nodes {
resp := node.Proto()
Expand Down Expand Up @@ -611,6 +624,10 @@ func (api headscaleV1APIServer) ListApiKeys(
response[index] = key.Proto()
}

sort.Slice(response, func(i, j int) bool {
return response[i].Id < response[j].Id
})

return &v1.ListApiKeysResponse{ApiKeys: response}, nil
}

Expand Down