mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-26 01:53:42 +01:00
4587f7686e
* feat: basic management service implementation [FAILING TESTS] * test: fix healthcheck test * test: #39 add peer registration endpoint test * feat: #39 add setup key handling * feat: #39 add peer management store persistence * refactor: extract config read/write to the utility package * refactor: move file contents copy to the utility package * refactor: use Accounts instead of Users in the Store * feature: add management server Docker file * refactor: introduce datadir instead of config * chore: use filepath.Join to concat filepaths instead of string concat * refactor: move stop channel to the root * refactor: move stop channel to the root * review: fix PR review notes Co-authored-by: braginini <hello@wiretrustee.com>
284 lines
10 KiB
Go
284 lines
10 KiB
Go
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
// source: management.proto
|
|
|
|
package proto
|
|
|
|
import (
|
|
context "context"
|
|
fmt "fmt"
|
|
proto "github.com/golang/protobuf/proto"
|
|
_ "github.com/golang/protobuf/protoc-gen-go/descriptor"
|
|
grpc "google.golang.org/grpc"
|
|
codes "google.golang.org/grpc/codes"
|
|
status "google.golang.org/grpc/status"
|
|
math "math"
|
|
)
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the proto package it is being compiled against.
|
|
// A compilation error at this line likely means your copy of the
|
|
// proto package needs to be updated.
|
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
|
|
|
type RegisterPeerRequest struct {
|
|
// Wireguard public key
|
|
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
|
|
// Pre-authorized setup key
|
|
SetupKey string `protobuf:"bytes,2,opt,name=setupKey,proto3" json:"setupKey,omitempty"`
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
XXX_sizecache int32 `json:"-"`
|
|
}
|
|
|
|
func (m *RegisterPeerRequest) Reset() { *m = RegisterPeerRequest{} }
|
|
func (m *RegisterPeerRequest) String() string { return proto.CompactTextString(m) }
|
|
func (*RegisterPeerRequest) ProtoMessage() {}
|
|
func (*RegisterPeerRequest) Descriptor() ([]byte, []int) {
|
|
return fileDescriptor_edc174f991dc0a25, []int{0}
|
|
}
|
|
|
|
func (m *RegisterPeerRequest) XXX_Unmarshal(b []byte) error {
|
|
return xxx_messageInfo_RegisterPeerRequest.Unmarshal(m, b)
|
|
}
|
|
func (m *RegisterPeerRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
return xxx_messageInfo_RegisterPeerRequest.Marshal(b, m, deterministic)
|
|
}
|
|
func (m *RegisterPeerRequest) XXX_Merge(src proto.Message) {
|
|
xxx_messageInfo_RegisterPeerRequest.Merge(m, src)
|
|
}
|
|
func (m *RegisterPeerRequest) XXX_Size() int {
|
|
return xxx_messageInfo_RegisterPeerRequest.Size(m)
|
|
}
|
|
func (m *RegisterPeerRequest) XXX_DiscardUnknown() {
|
|
xxx_messageInfo_RegisterPeerRequest.DiscardUnknown(m)
|
|
}
|
|
|
|
var xxx_messageInfo_RegisterPeerRequest proto.InternalMessageInfo
|
|
|
|
func (m *RegisterPeerRequest) GetKey() string {
|
|
if m != nil {
|
|
return m.Key
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *RegisterPeerRequest) GetSetupKey() string {
|
|
if m != nil {
|
|
return m.SetupKey
|
|
}
|
|
return ""
|
|
}
|
|
|
|
type RegisterPeerResponse struct {
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
XXX_sizecache int32 `json:"-"`
|
|
}
|
|
|
|
func (m *RegisterPeerResponse) Reset() { *m = RegisterPeerResponse{} }
|
|
func (m *RegisterPeerResponse) String() string { return proto.CompactTextString(m) }
|
|
func (*RegisterPeerResponse) ProtoMessage() {}
|
|
func (*RegisterPeerResponse) Descriptor() ([]byte, []int) {
|
|
return fileDescriptor_edc174f991dc0a25, []int{1}
|
|
}
|
|
|
|
func (m *RegisterPeerResponse) XXX_Unmarshal(b []byte) error {
|
|
return xxx_messageInfo_RegisterPeerResponse.Unmarshal(m, b)
|
|
}
|
|
func (m *RegisterPeerResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
return xxx_messageInfo_RegisterPeerResponse.Marshal(b, m, deterministic)
|
|
}
|
|
func (m *RegisterPeerResponse) XXX_Merge(src proto.Message) {
|
|
xxx_messageInfo_RegisterPeerResponse.Merge(m, src)
|
|
}
|
|
func (m *RegisterPeerResponse) XXX_Size() int {
|
|
return xxx_messageInfo_RegisterPeerResponse.Size(m)
|
|
}
|
|
func (m *RegisterPeerResponse) XXX_DiscardUnknown() {
|
|
xxx_messageInfo_RegisterPeerResponse.DiscardUnknown(m)
|
|
}
|
|
|
|
var xxx_messageInfo_RegisterPeerResponse proto.InternalMessageInfo
|
|
|
|
type Empty struct {
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
XXX_sizecache int32 `json:"-"`
|
|
}
|
|
|
|
func (m *Empty) Reset() { *m = Empty{} }
|
|
func (m *Empty) String() string { return proto.CompactTextString(m) }
|
|
func (*Empty) ProtoMessage() {}
|
|
func (*Empty) Descriptor() ([]byte, []int) {
|
|
return fileDescriptor_edc174f991dc0a25, []int{2}
|
|
}
|
|
|
|
func (m *Empty) XXX_Unmarshal(b []byte) error {
|
|
return xxx_messageInfo_Empty.Unmarshal(m, b)
|
|
}
|
|
func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
return xxx_messageInfo_Empty.Marshal(b, m, deterministic)
|
|
}
|
|
func (m *Empty) XXX_Merge(src proto.Message) {
|
|
xxx_messageInfo_Empty.Merge(m, src)
|
|
}
|
|
func (m *Empty) XXX_Size() int {
|
|
return xxx_messageInfo_Empty.Size(m)
|
|
}
|
|
func (m *Empty) XXX_DiscardUnknown() {
|
|
xxx_messageInfo_Empty.DiscardUnknown(m)
|
|
}
|
|
|
|
var xxx_messageInfo_Empty proto.InternalMessageInfo
|
|
|
|
func init() {
|
|
proto.RegisterType((*RegisterPeerRequest)(nil), "management.RegisterPeerRequest")
|
|
proto.RegisterType((*RegisterPeerResponse)(nil), "management.RegisterPeerResponse")
|
|
proto.RegisterType((*Empty)(nil), "management.Empty")
|
|
}
|
|
|
|
func init() {
|
|
proto.RegisterFile("management.proto", fileDescriptor_edc174f991dc0a25)
|
|
}
|
|
|
|
var fileDescriptor_edc174f991dc0a25 = []byte{
|
|
// 224 bytes of a gzipped FileDescriptorProto
|
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0x4d, 0xcc, 0x4b,
|
|
0x4c, 0x4f, 0xcd, 0x4d, 0xcd, 0x2b, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x42, 0x88,
|
|
0x48, 0x29, 0xa4, 0xe7, 0xe7, 0xa7, 0xe7, 0xa4, 0xea, 0x83, 0x65, 0x92, 0x4a, 0xd3, 0xf4, 0x53,
|
|
0x52, 0x8b, 0x93, 0x8b, 0x32, 0x0b, 0x4a, 0xf2, 0x8b, 0x20, 0xaa, 0x95, 0x9c, 0xb9, 0x84, 0x83,
|
|
0x52, 0xd3, 0x33, 0x8b, 0x4b, 0x52, 0x8b, 0x02, 0x52, 0x53, 0x8b, 0x82, 0x52, 0x0b, 0x4b, 0x53,
|
|
0x8b, 0x4b, 0x84, 0x04, 0xb8, 0x98, 0xb3, 0x53, 0x2b, 0x25, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83,
|
|
0x40, 0x4c, 0x21, 0x29, 0x2e, 0x8e, 0xe2, 0xd4, 0x92, 0xd2, 0x02, 0xef, 0xd4, 0x4a, 0x09, 0x26,
|
|
0xb0, 0x30, 0x9c, 0xaf, 0x24, 0xc6, 0x25, 0x82, 0x6a, 0x48, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa,
|
|
0x12, 0x3b, 0x17, 0xab, 0x6b, 0x6e, 0x41, 0x49, 0xa5, 0xd1, 0x5c, 0x46, 0x2e, 0x41, 0x5f, 0xb8,
|
|
0xb3, 0x82, 0x53, 0x8b, 0xca, 0x32, 0x93, 0x53, 0x85, 0x82, 0xb9, 0x78, 0x90, 0xb5, 0x09, 0xc9,
|
|
0xeb, 0x21, 0x79, 0x06, 0x8b, 0xab, 0xa4, 0x14, 0x70, 0x2b, 0x80, 0xda, 0xc8, 0x20, 0x64, 0xcc,
|
|
0xc5, 0x99, 0x59, 0xec, 0x91, 0x9a, 0x98, 0x53, 0x92, 0x51, 0x29, 0x24, 0x88, 0xac, 0x01, 0xec,
|
|
0x14, 0x29, 0x4c, 0x21, 0x25, 0x06, 0x27, 0xce, 0x28, 0x76, 0x3d, 0x6b, 0x48, 0x20, 0xb1, 0x81,
|
|
0x29, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x55, 0x7e, 0x24, 0xf8, 0x59, 0x01, 0x00, 0x00,
|
|
}
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ context.Context
|
|
var _ grpc.ClientConnInterface
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the grpc package it is being compiled against.
|
|
const _ = grpc.SupportPackageIsVersion6
|
|
|
|
// ManagementServiceClient is the client API for ManagementService service.
|
|
//
|
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
|
type ManagementServiceClient interface {
|
|
RegisterPeer(ctx context.Context, in *RegisterPeerRequest, opts ...grpc.CallOption) (*RegisterPeerResponse, error)
|
|
// health check endpoint
|
|
IsHealthy(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
|
|
}
|
|
|
|
type managementServiceClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewManagementServiceClient(cc grpc.ClientConnInterface) ManagementServiceClient {
|
|
return &managementServiceClient{cc}
|
|
}
|
|
|
|
func (c *managementServiceClient) RegisterPeer(ctx context.Context, in *RegisterPeerRequest, opts ...grpc.CallOption) (*RegisterPeerResponse, error) {
|
|
out := new(RegisterPeerResponse)
|
|
err := c.cc.Invoke(ctx, "/management.ManagementService/RegisterPeer", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *managementServiceClient) IsHealthy(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) {
|
|
out := new(Empty)
|
|
err := c.cc.Invoke(ctx, "/management.ManagementService/isHealthy", in, out, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// ManagementServiceServer is the server API for ManagementService service.
|
|
type ManagementServiceServer interface {
|
|
RegisterPeer(context.Context, *RegisterPeerRequest) (*RegisterPeerResponse, error)
|
|
// health check endpoint
|
|
IsHealthy(context.Context, *Empty) (*Empty, error)
|
|
}
|
|
|
|
// UnimplementedManagementServiceServer can be embedded to have forward compatible implementations.
|
|
type UnimplementedManagementServiceServer struct {
|
|
}
|
|
|
|
func (*UnimplementedManagementServiceServer) RegisterPeer(ctx context.Context, req *RegisterPeerRequest) (*RegisterPeerResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method RegisterPeer not implemented")
|
|
}
|
|
func (*UnimplementedManagementServiceServer) IsHealthy(ctx context.Context, req *Empty) (*Empty, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method IsHealthy not implemented")
|
|
}
|
|
|
|
func RegisterManagementServiceServer(s *grpc.Server, srv ManagementServiceServer) {
|
|
s.RegisterService(&_ManagementService_serviceDesc, srv)
|
|
}
|
|
|
|
func _ManagementService_RegisterPeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(RegisterPeerRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(ManagementServiceServer).RegisterPeer(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/management.ManagementService/RegisterPeer",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(ManagementServiceServer).RegisterPeer(ctx, req.(*RegisterPeerRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _ManagementService_IsHealthy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(Empty)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(ManagementServiceServer).IsHealthy(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: "/management.ManagementService/IsHealthy",
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(ManagementServiceServer).IsHealthy(ctx, req.(*Empty))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
var _ManagementService_serviceDesc = grpc.ServiceDesc{
|
|
ServiceName: "management.ManagementService",
|
|
HandlerType: (*ManagementServiceServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "RegisterPeer",
|
|
Handler: _ManagementService_RegisterPeer_Handler,
|
|
},
|
|
{
|
|
MethodName: "isHealthy",
|
|
Handler: _ManagementService_IsHealthy_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{},
|
|
Metadata: "management.proto",
|
|
}
|