mirror of
https://github.com/openziti/zrok.git
synced 2025-03-16 16:38:15 +01:00
sort shares/accesses in status call (#221)
This commit is contained in:
parent
5d57087fd6
commit
3f00bb6ec0
@ -3,6 +3,7 @@ package agent
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"github.com/openziti/zrok/agent/agentGrpc"
|
"github.com/openziti/zrok/agent/agentGrpc"
|
||||||
|
"sort"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (i *agentGrpcImpl) Status(_ context.Context, _ *agentGrpc.StatusRequest) (*agentGrpc.StatusResponse, error) {
|
func (i *agentGrpcImpl) Status(_ context.Context, _ *agentGrpc.StatusRequest) (*agentGrpc.StatusResponse, error) {
|
||||||
@ -15,6 +16,9 @@ func (i *agentGrpcImpl) Status(_ context.Context, _ *agentGrpc.StatusRequest) (*
|
|||||||
ResponseHeaders: acc.responseHeaders,
|
ResponseHeaders: acc.responseHeaders,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
sort.Slice(accesses, func(i, j int) bool {
|
||||||
|
return accesses[i].FrontendToken < accesses[j].FrontendToken
|
||||||
|
})
|
||||||
|
|
||||||
var shares []*agentGrpc.ShareDetail
|
var shares []*agentGrpc.ShareDetail
|
||||||
for token, shr := range i.agent.shares {
|
for token, shr := range i.agent.shares {
|
||||||
@ -28,6 +32,9 @@ func (i *agentGrpcImpl) Status(_ context.Context, _ *agentGrpc.StatusRequest) (*
|
|||||||
Closed: shr.closed,
|
Closed: shr.closed,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
sort.Slice(shares, func(i, j int) bool {
|
||||||
|
return shares[i].Token < shares[j].Token
|
||||||
|
})
|
||||||
|
|
||||||
return &agentGrpc.StatusResponse{Accesses: accesses, Shares: shares}, nil
|
return &agentGrpc.StatusResponse{Accesses: accesses, Shares: shares}, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user