From 3b30beb56705384eed713a61352fd20a47fabdd0 Mon Sep 17 00:00:00 2001 From: Mikhail Bragin Date: Sun, 25 Jul 2021 17:08:16 +0200 Subject: [PATCH] add config properties to the SyncResponse of the management gRpc service (#66) * feature: add config properties to the SyncResponse of the management gRpc service --- management/proto/generate.sh | 4 + management/proto/management.pb.go | 639 ++++++++++++++++++++++++--- management/proto/management.proto | 71 ++- management/server/management_test.go | 10 +- 4 files changed, 648 insertions(+), 76 deletions(-) create mode 100755 management/proto/generate.sh diff --git a/management/proto/generate.sh b/management/proto/generate.sh new file mode 100755 index 000000000..a07eebc4e --- /dev/null +++ b/management/proto/generate.sh @@ -0,0 +1,4 @@ +#!/bin/bash +go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26 +go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1 +protoc -I proto/ proto/management.proto --go_out=. --go-grpc_out=. \ No newline at end of file diff --git a/management/proto/management.pb.go b/management/proto/management.pb.go index 5f9b6c29e..f9b414fe2 100644 --- a/management/proto/management.pb.go +++ b/management/proto/management.pb.go @@ -21,6 +21,55 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type HostConfig_Protocol int32 + +const ( + HostConfig_PLAIN HostConfig_Protocol = 0 + HostConfig_TLS HostConfig_Protocol = 1 + HostConfig_DTLS HostConfig_Protocol = 2 +) + +// Enum value maps for HostConfig_Protocol. +var ( + HostConfig_Protocol_name = map[int32]string{ + 0: "PLAIN", + 1: "TLS", + 2: "DTLS", + } + HostConfig_Protocol_value = map[string]int32{ + "PLAIN": 0, + "TLS": 1, + "DTLS": 2, + } +) + +func (x HostConfig_Protocol) Enum() *HostConfig_Protocol { + p := new(HostConfig_Protocol) + *p = x + return p +} + +func (x HostConfig_Protocol) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (HostConfig_Protocol) Descriptor() protoreflect.EnumDescriptor { + return file_management_proto_enumTypes[0].Descriptor() +} + +func (HostConfig_Protocol) Type() protoreflect.EnumType { + return &file_management_proto_enumTypes[0] +} + +func (x HostConfig_Protocol) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use HostConfig_Protocol.Descriptor instead. +func (HostConfig_Protocol) EnumDescriptor() ([]byte, []int) { + return file_management_proto_rawDescGZIP(), []int{8, 0} +} + type EncryptedMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -116,13 +165,18 @@ func (*SyncRequest) Descriptor() ([]byte, []int) { return file_management_proto_rawDescGZIP(), []int{1} } +// SyncResponse represents a state that should be applied to the local peer (e.g. Wiretrustee servers config as well as local peer and remote peers configs) type SyncResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // A list of peers available - Peers []string `protobuf:"bytes,1,rep,name=peers,proto3" json:"peers,omitempty"` + // Global config + WiretrusteeConfig *WiretrusteeConfig `protobuf:"bytes,1,opt,name=wiretrusteeConfig,proto3" json:"wiretrusteeConfig,omitempty"` + PeerConfig *PeerConfig `protobuf:"bytes,2,opt,name=peerConfig,proto3" json:"peerConfig,omitempty"` + RemotePeers []*RemotePeerConfig `protobuf:"bytes,3,rep,name=remotePeers,proto3" json:"remotePeers,omitempty"` + // Deprecated: used for compatibility + Peers []string `protobuf:"bytes,4,rep,name=peers,proto3" json:"peers,omitempty"` } func (x *SyncResponse) Reset() { @@ -157,6 +211,27 @@ func (*SyncResponse) Descriptor() ([]byte, []int) { return file_management_proto_rawDescGZIP(), []int{2} } +func (x *SyncResponse) GetWiretrusteeConfig() *WiretrusteeConfig { + if x != nil { + return x.WiretrusteeConfig + } + return nil +} + +func (x *SyncResponse) GetPeerConfig() *PeerConfig { + if x != nil { + return x.PeerConfig + } + return nil +} + +func (x *SyncResponse) GetRemotePeers() []*RemotePeerConfig { + if x != nil { + return x.RemotePeers + } + return nil +} + func (x *SyncResponse) GetPeers() []string { if x != nil { return x.Peers @@ -354,6 +429,320 @@ func (*Empty) Descriptor() ([]byte, []int) { return file_management_proto_rawDescGZIP(), []int{6} } +// WiretrusteeConfig is a common configuration of any Wiretrustee peer. It contains STUN, TURN, Signal and Management servers configurations +type WiretrusteeConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // a list of STUN servers + Stuns []*HostConfig `protobuf:"bytes,1,rep,name=stuns,proto3" json:"stuns,omitempty"` + // a list of TURN servers + Turns []*ProtectedHostConfig `protobuf:"bytes,2,rep,name=turns,proto3" json:"turns,omitempty"` + // a Signal server config + Signal *HostConfig `protobuf:"bytes,3,opt,name=signal,proto3" json:"signal,omitempty"` +} + +func (x *WiretrusteeConfig) Reset() { + *x = WiretrusteeConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_management_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WiretrusteeConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WiretrusteeConfig) ProtoMessage() {} + +func (x *WiretrusteeConfig) ProtoReflect() protoreflect.Message { + mi := &file_management_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WiretrusteeConfig.ProtoReflect.Descriptor instead. +func (*WiretrusteeConfig) Descriptor() ([]byte, []int) { + return file_management_proto_rawDescGZIP(), []int{7} +} + +func (x *WiretrusteeConfig) GetStuns() []*HostConfig { + if x != nil { + return x.Stuns + } + return nil +} + +func (x *WiretrusteeConfig) GetTurns() []*ProtectedHostConfig { + if x != nil { + return x.Turns + } + return nil +} + +func (x *WiretrusteeConfig) GetSignal() *HostConfig { + if x != nil { + return x.Signal + } + return nil +} + +// HostConfig describes connection properties of some server (e.g. STUN, Signal, Management) +type HostConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + Port int32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` + Protocol HostConfig_Protocol `protobuf:"varint,3,opt,name=protocol,proto3,enum=management.HostConfig_Protocol" json:"protocol,omitempty"` +} + +func (x *HostConfig) Reset() { + *x = HostConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_management_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HostConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HostConfig) ProtoMessage() {} + +func (x *HostConfig) ProtoReflect() protoreflect.Message { + mi := &file_management_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HostConfig.ProtoReflect.Descriptor instead. +func (*HostConfig) Descriptor() ([]byte, []int) { + return file_management_proto_rawDescGZIP(), []int{8} +} + +func (x *HostConfig) GetHost() string { + if x != nil { + return x.Host + } + return "" +} + +func (x *HostConfig) GetPort() int32 { + if x != nil { + return x.Port + } + return 0 +} + +func (x *HostConfig) GetProtocol() HostConfig_Protocol { + if x != nil { + return x.Protocol + } + return HostConfig_PLAIN +} + +// ProtectedHostConfig is similar to HostConfig but has additional user and password +// Mostly used for TURN servers +type ProtectedHostConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + HostConfig *HostConfig `protobuf:"bytes,1,opt,name=hostConfig,proto3" json:"hostConfig,omitempty"` + User string `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` + Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` +} + +func (x *ProtectedHostConfig) Reset() { + *x = ProtectedHostConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_management_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProtectedHostConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProtectedHostConfig) ProtoMessage() {} + +func (x *ProtectedHostConfig) ProtoReflect() protoreflect.Message { + mi := &file_management_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProtectedHostConfig.ProtoReflect.Descriptor instead. +func (*ProtectedHostConfig) Descriptor() ([]byte, []int) { + return file_management_proto_rawDescGZIP(), []int{9} +} + +func (x *ProtectedHostConfig) GetHostConfig() *HostConfig { + if x != nil { + return x.HostConfig + } + return nil +} + +func (x *ProtectedHostConfig) GetUser() string { + if x != nil { + return x.User + } + return "" +} + +func (x *ProtectedHostConfig) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +// PeerConfig represents a configuration of a "our" peer. +// The properties are used to configure local Wireguard +type PeerConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Peer's virtual IP address within the Wiretrustee VPN (a Wireguard address config) + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Wiretrustee DNS server (a Wireguard DNS config) + Dns string `protobuf:"bytes,2,opt,name=dns,proto3" json:"dns,omitempty"` +} + +func (x *PeerConfig) Reset() { + *x = PeerConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_management_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerConfig) ProtoMessage() {} + +func (x *PeerConfig) ProtoReflect() protoreflect.Message { + mi := &file_management_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerConfig.ProtoReflect.Descriptor instead. +func (*PeerConfig) Descriptor() ([]byte, []int) { + return file_management_proto_rawDescGZIP(), []int{10} +} + +func (x *PeerConfig) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *PeerConfig) GetDns() string { + if x != nil { + return x.Dns + } + return "" +} + +// RemotePeerConfig represents a configuration of a remote peer. +// The properties are used to configure Wireguard Peers sections +type RemotePeerConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A Wireguard public key of a remote peer + WgPubKey string `protobuf:"bytes,1,opt,name=wgPubKey,proto3" json:"wgPubKey,omitempty"` + // Wireguard allowed IPs of a remote peer e.g. [10.30.30.1/32] + AllowedIps []string `protobuf:"bytes,2,rep,name=allowedIps,proto3" json:"allowedIps,omitempty"` +} + +func (x *RemotePeerConfig) Reset() { + *x = RemotePeerConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_management_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemotePeerConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemotePeerConfig) ProtoMessage() {} + +func (x *RemotePeerConfig) ProtoReflect() protoreflect.Message { + mi := &file_management_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemotePeerConfig.ProtoReflect.Descriptor instead. +func (*RemotePeerConfig) Descriptor() ([]byte, []int) { + return file_management_proto_rawDescGZIP(), []int{11} +} + +func (x *RemotePeerConfig) GetWgPubKey() string { + if x != nil { + return x.WgPubKey + } + return "" +} + +func (x *RemotePeerConfig) GetAllowedIps() []string { + if x != nil { + return x.AllowedIps + } + return nil +} + var File_management_proto protoreflect.FileDescriptor var file_management_proto_rawDesc = []byte{ @@ -366,41 +755,91 @@ var file_management_proto_rawDesc = []byte{ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x77, 0x67, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x0d, 0x0a, 0x0b, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x22, 0x24, 0x0a, 0x0c, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x22, 0x43, 0x0a, 0x13, 0x52, 0x65, 0x67, 0x69, - 0x73, 0x74, 0x65, 0x72, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x75, 0x70, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x74, 0x75, 0x70, 0x4b, 0x65, 0x79, 0x22, 0x16, 0x0a, - 0x14, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5f, 0x0a, 0x11, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4b, - 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x38, 0x0a, 0x09, - 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x41, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x65, 0x78, 0x70, - 0x69, 0x72, 0x65, 0x73, 0x41, 0x74, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x32, - 0xa9, 0x02, 0x0a, 0x11, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x53, 0x0a, 0x0c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, - 0x72, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x65, 0x65, 0x72, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x65, 0x65, 0x72, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, 0x04, 0x53, 0x79, - 0x6e, 0x63, 0x12, 0x1c, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, - 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x1a, 0x1c, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x6e, - 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x00, - 0x30, 0x01, 0x12, 0x42, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4b, - 0x65, 0x79, 0x12, 0x11, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1d, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x33, 0x0a, 0x09, 0x69, 0x73, 0x48, 0x65, 0x61, 0x6c, - 0x74, 0x68, 0x79, 0x12, 0x11, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x11, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, 0x08, 0x5a, 0x06, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x74, 0x22, 0xe9, 0x01, 0x0a, 0x0c, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x11, 0x77, 0x69, 0x72, 0x65, 0x74, 0x72, 0x75, 0x73, 0x74, + 0x65, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, + 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x57, 0x69, 0x72, 0x65, + 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x11, 0x77, + 0x69, 0x72, 0x65, 0x74, 0x72, 0x75, 0x73, 0x74, 0x65, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x12, 0x36, 0x0a, 0x0a, 0x70, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x2e, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0a, 0x70, 0x65, + 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x3e, 0x0a, 0x0b, 0x72, 0x65, 0x6d, 0x6f, + 0x74, 0x65, 0x50, 0x65, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, + 0x65, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0b, 0x72, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x65, 0x65, 0x72, + 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x22, 0x43, + 0x0a, 0x13, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x74, 0x75, 0x70, + 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x74, 0x75, 0x70, + 0x4b, 0x65, 0x79, 0x22, 0x16, 0x0a, 0x14, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, + 0x65, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5f, 0x0a, 0x11, 0x53, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x38, 0x0a, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x41, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x41, 0x74, 0x22, 0x07, 0x0a, 0x05, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0xa8, 0x01, 0x0a, 0x11, 0x57, 0x69, 0x72, 0x65, 0x74, 0x72, + 0x75, 0x73, 0x74, 0x65, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2c, 0x0a, 0x05, 0x73, + 0x74, 0x75, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x52, 0x05, 0x73, 0x74, 0x75, 0x6e, 0x73, 0x12, 0x35, 0x0a, 0x05, 0x74, 0x75, 0x72, + 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x48, + 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x05, 0x74, 0x75, 0x72, 0x6e, 0x73, + 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x16, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x48, 0x6f, + 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, + 0x22, 0x9b, 0x01, 0x0a, 0x0a, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, + 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, + 0x6f, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x3b, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x22, 0x28, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x12, 0x09, 0x0a, 0x05, 0x50, 0x4c, 0x41, 0x49, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, + 0x4c, 0x53, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x54, 0x4c, 0x53, 0x10, 0x02, 0x22, 0x7d, + 0x0a, 0x13, 0x50, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x48, 0x6f, 0x73, 0x74, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x36, 0x0a, 0x0a, 0x68, 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x52, 0x0a, 0x68, 0x6f, 0x73, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, + 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x73, 0x65, + 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x38, 0x0a, + 0x0a, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x64, 0x6e, 0x73, 0x22, 0x4e, 0x0a, 0x10, 0x52, 0x65, 0x6d, 0x6f, 0x74, + 0x65, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x77, + 0x67, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x77, + 0x67, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x77, + 0x65, 0x64, 0x49, 0x70, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, + 0x6f, 0x77, 0x65, 0x64, 0x49, 0x70, 0x73, 0x32, 0xa9, 0x02, 0x0a, 0x11, 0x4d, 0x61, 0x6e, 0x61, + 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x53, 0x0a, + 0x0c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1f, 0x2e, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x65, 0x72, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, + 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x65, 0x72, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x46, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x1c, 0x2e, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, + 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x1c, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x42, 0x0a, 0x0c, 0x47, 0x65, + 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x11, 0x2e, 0x6d, 0x61, 0x6e, + 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1d, 0x2e, + 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x33, + 0x0a, 0x09, 0x69, 0x73, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x12, 0x11, 0x2e, 0x6d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x11, + 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x22, 0x00, 0x42, 0x08, 0x5a, 0x06, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -415,32 +854,47 @@ func file_management_proto_rawDescGZIP() []byte { return file_management_proto_rawDescData } -var file_management_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_management_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_management_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_management_proto_goTypes = []interface{}{ - (*EncryptedMessage)(nil), // 0: management.EncryptedMessage - (*SyncRequest)(nil), // 1: management.SyncRequest - (*SyncResponse)(nil), // 2: management.SyncResponse - (*RegisterPeerRequest)(nil), // 3: management.RegisterPeerRequest - (*RegisterPeerResponse)(nil), // 4: management.RegisterPeerResponse - (*ServerKeyResponse)(nil), // 5: management.ServerKeyResponse - (*Empty)(nil), // 6: management.Empty - (*timestamp.Timestamp)(nil), // 7: google.protobuf.Timestamp + (HostConfig_Protocol)(0), // 0: management.HostConfig.Protocol + (*EncryptedMessage)(nil), // 1: management.EncryptedMessage + (*SyncRequest)(nil), // 2: management.SyncRequest + (*SyncResponse)(nil), // 3: management.SyncResponse + (*RegisterPeerRequest)(nil), // 4: management.RegisterPeerRequest + (*RegisterPeerResponse)(nil), // 5: management.RegisterPeerResponse + (*ServerKeyResponse)(nil), // 6: management.ServerKeyResponse + (*Empty)(nil), // 7: management.Empty + (*WiretrusteeConfig)(nil), // 8: management.WiretrusteeConfig + (*HostConfig)(nil), // 9: management.HostConfig + (*ProtectedHostConfig)(nil), // 10: management.ProtectedHostConfig + (*PeerConfig)(nil), // 11: management.PeerConfig + (*RemotePeerConfig)(nil), // 12: management.RemotePeerConfig + (*timestamp.Timestamp)(nil), // 13: google.protobuf.Timestamp } var file_management_proto_depIdxs = []int32{ - 7, // 0: management.ServerKeyResponse.expiresAt:type_name -> google.protobuf.Timestamp - 3, // 1: management.ManagementService.RegisterPeer:input_type -> management.RegisterPeerRequest - 0, // 2: management.ManagementService.Sync:input_type -> management.EncryptedMessage - 6, // 3: management.ManagementService.GetServerKey:input_type -> management.Empty - 6, // 4: management.ManagementService.isHealthy:input_type -> management.Empty - 4, // 5: management.ManagementService.RegisterPeer:output_type -> management.RegisterPeerResponse - 0, // 6: management.ManagementService.Sync:output_type -> management.EncryptedMessage - 5, // 7: management.ManagementService.GetServerKey:output_type -> management.ServerKeyResponse - 6, // 8: management.ManagementService.isHealthy:output_type -> management.Empty - 5, // [5:9] is the sub-list for method output_type - 1, // [1:5] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 8, // 0: management.SyncResponse.wiretrusteeConfig:type_name -> management.WiretrusteeConfig + 11, // 1: management.SyncResponse.peerConfig:type_name -> management.PeerConfig + 12, // 2: management.SyncResponse.remotePeers:type_name -> management.RemotePeerConfig + 13, // 3: management.ServerKeyResponse.expiresAt:type_name -> google.protobuf.Timestamp + 9, // 4: management.WiretrusteeConfig.stuns:type_name -> management.HostConfig + 10, // 5: management.WiretrusteeConfig.turns:type_name -> management.ProtectedHostConfig + 9, // 6: management.WiretrusteeConfig.signal:type_name -> management.HostConfig + 0, // 7: management.HostConfig.protocol:type_name -> management.HostConfig.Protocol + 9, // 8: management.ProtectedHostConfig.hostConfig:type_name -> management.HostConfig + 4, // 9: management.ManagementService.RegisterPeer:input_type -> management.RegisterPeerRequest + 1, // 10: management.ManagementService.Sync:input_type -> management.EncryptedMessage + 7, // 11: management.ManagementService.GetServerKey:input_type -> management.Empty + 7, // 12: management.ManagementService.isHealthy:input_type -> management.Empty + 5, // 13: management.ManagementService.RegisterPeer:output_type -> management.RegisterPeerResponse + 1, // 14: management.ManagementService.Sync:output_type -> management.EncryptedMessage + 6, // 15: management.ManagementService.GetServerKey:output_type -> management.ServerKeyResponse + 7, // 16: management.ManagementService.isHealthy:output_type -> management.Empty + 13, // [13:17] is the sub-list for method output_type + 9, // [9:13] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_management_proto_init() } @@ -533,19 +987,80 @@ func file_management_proto_init() { return nil } } + file_management_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WiretrusteeConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_management_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HostConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_management_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProtectedHostConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_management_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_management_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemotePeerConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_management_proto_rawDesc, - NumEnums: 0, - NumMessages: 7, + NumEnums: 1, + NumMessages: 12, NumExtensions: 0, NumServices: 1, }, GoTypes: file_management_proto_goTypes, DependencyIndexes: file_management_proto_depIdxs, + EnumInfos: file_management_proto_enumTypes, MessageInfos: file_management_proto_msgTypes, }.Build() File_management_proto = out.File diff --git a/management/proto/management.proto b/management/proto/management.proto index 2db57313d..61e792e0b 100644 --- a/management/proto/management.proto +++ b/management/proto/management.proto @@ -31,13 +31,19 @@ message EncryptedMessage { bytes body = 2; } -message SyncRequest { - -} +message SyncRequest {} +// SyncResponse represents a state that should be applied to the local peer (e.g. Wiretrustee servers config as well as local peer and remote peers configs) message SyncResponse { - // A list of peers available - repeated string peers = 1; + // Global config + WiretrusteeConfig wiretrusteeConfig = 1; + + PeerConfig peerConfig = 2; + + repeated RemotePeerConfig remotePeers = 3; + + // Deprecated: used for compatibility + repeated string peers = 4; } message RegisterPeerRequest { @@ -48,9 +54,7 @@ message RegisterPeerRequest { string setupKey = 2; } -message RegisterPeerResponse { - -} +message RegisterPeerResponse {} message ServerKeyResponse { // Server's Wireguard public key @@ -59,6 +63,55 @@ message ServerKeyResponse { google.protobuf.Timestamp expiresAt = 2; } -message Empty { +message Empty {} +// WiretrusteeConfig is a common configuration of any Wiretrustee peer. It contains STUN, TURN, Signal and Management servers configurations +message WiretrusteeConfig { + // a list of STUN servers + repeated HostConfig stuns = 1; + // a list of TURN servers + repeated ProtectedHostConfig turns = 2; + + // a Signal server config + HostConfig signal = 3; +} + +// HostConfig describes connection properties of some server (e.g. STUN, Signal, Management) +message HostConfig { + string host = 1; + int32 port = 2; + Protocol protocol = 3; + + enum Protocol { + PLAIN = 0; + TLS = 1; + DTLS = 2; + } +} +// ProtectedHostConfig is similar to HostConfig but has additional user and password +// Mostly used for TURN servers +message ProtectedHostConfig { + HostConfig hostConfig = 1; + string user = 2; + string password = 3; +} + +// PeerConfig represents a configuration of a "our" peer. +// The properties are used to configure local Wireguard +message PeerConfig { + // Peer's virtual IP address within the Wiretrustee VPN (a Wireguard address config) + string address = 1; + // Wiretrustee DNS server (a Wireguard DNS config) + string dns = 2; +} + +// RemotePeerConfig represents a configuration of a remote peer. +// The properties are used to configure Wireguard Peers sections +message RemotePeerConfig { + + // A Wireguard public key of a remote peer + string wgPubKey = 1; + + // Wireguard allowed IPs of a remote peer e.g. [10.30.30.1/32] + repeated string allowedIps = 2; } \ No newline at end of file diff --git a/management/server/management_test.go b/management/server/management_test.go index dd8fb9a8c..720907b69 100644 --- a/management/server/management_test.go +++ b/management/server/management_test.go @@ -112,8 +112,8 @@ var _ = Describe("Management service", func() { err = pb.Unmarshal(decryptedBytes, resp) Expect(err).NotTo(HaveOccurred()) - Expect(resp.Peers).To(HaveLen(2)) - Expect(resp.Peers).To(ContainElements(key1.PublicKey().String(), key2.PublicKey().String())) + Expect(resp.GetPeers()).To(HaveLen(2)) + Expect(resp.GetPeers()).To(ContainElements(key1.PublicKey().String(), key2.PublicKey().String())) }) }) @@ -143,7 +143,7 @@ var _ = Describe("Management service", func() { Expect(err).NotTo(HaveOccurred()) resp := &mgmtProto.SyncResponse{} err = pb.Unmarshal(decryptedBytes, resp) - Expect(resp.Peers).To(HaveLen(0)) + Expect(resp.GetPeers()).To(HaveLen(0)) wg := sync2.WaitGroup{} wg.Add(1) @@ -167,8 +167,8 @@ var _ = Describe("Management service", func() { wg.Wait() Expect(err).NotTo(HaveOccurred()) - Expect(resp.Peers).To(ContainElements(key1.PublicKey().String())) - Expect(resp.Peers).To(HaveLen(1)) + Expect(resp.GetPeers()).To(ContainElements(key1.PublicKey().String())) + Expect(resp.GetPeers()).To(HaveLen(1)) }) }) })