constellation/coordinator/pubapi/vpn.go
Christoph Meyer 9441e46e4b AB#2033 Remove redundant "failed" in error wrapping
Remove "failed" from wrapped errors
Where appropriate rephrase "unable to/could not" to "failed" in root
errors
Start error log messages with "Failed"
2022-06-22 12:02:10 +01:00

23 lines
609 B
Go

package pubapi
import (
"context"
"github.com/edgelesssys/constellation/coordinator/peer"
"github.com/edgelesssys/constellation/coordinator/pubapi/pubproto"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
// GetVPNPeers retrieves VPN peers from a coordinator.
func (a *API) GetVPNPeers(context.Context, *pubproto.GetVPNPeersRequest) (*pubproto.GetVPNPeersResponse, error) {
_, peers, err := a.core.GetPeers(0)
if err != nil {
return nil, status.Errorf(codes.Internal, "getting peers: %v", err)
}
return &pubproto.GetVPNPeersResponse{
Peers: peer.ToPubProto(peers),
}, nil
}