2024-08-26 19:13:59 +02:00
|
|
|
package agent
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"github.com/openziti/zrok/agent/agentGrpc"
|
|
|
|
)
|
|
|
|
|
2024-09-18 17:54:37 +02:00
|
|
|
func (i *agentGrpcImpl) Status(_ context.Context, _ *agentGrpc.StatusRequest) (*agentGrpc.StatusResponse, error) {
|
2024-08-26 19:13:59 +02:00
|
|
|
var accesses []*agentGrpc.AccessDetail
|
2024-09-25 17:06:06 +02:00
|
|
|
for feToken, acc := range i.agent.accesses {
|
2024-08-26 19:13:59 +02:00
|
|
|
accesses = append(accesses, &agentGrpc.AccessDetail{
|
2024-09-17 04:01:09 +02:00
|
|
|
FrontendToken: feToken,
|
|
|
|
Token: acc.token,
|
2024-08-26 19:13:59 +02:00
|
|
|
BindAddress: acc.bindAddress,
|
|
|
|
ResponseHeaders: acc.responseHeaders,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
var shares []*agentGrpc.ShareDetail
|
2024-09-25 17:06:06 +02:00
|
|
|
for token, shr := range i.agent.shares {
|
2024-08-26 19:13:59 +02:00
|
|
|
shares = append(shares, &agentGrpc.ShareDetail{
|
|
|
|
Token: token,
|
|
|
|
ShareMode: string(shr.shareMode),
|
|
|
|
BackendMode: string(shr.backendMode),
|
|
|
|
Reserved: shr.reserved,
|
|
|
|
FrontendEndpoint: shr.frontendSelection,
|
|
|
|
BackendEndpoint: shr.target,
|
|
|
|
Closed: shr.closed,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-09-18 17:54:37 +02:00
|
|
|
return &agentGrpc.StatusResponse{Accesses: accesses, Shares: shares}, nil
|
2024-08-26 19:13:59 +02:00
|
|
|
}
|