diff --git a/Makefile b/Makefile index 658124d..c419951 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ PROTOC_GEN_GO_VERSION:=v1.34.2 PROTOC_GEN_GO_GRPC_VERSION:=v1.5.1 # add any components here after their directory has been created with .proto files -COMPONENTS:=connector peer +COMPONENTS:=connector device all: docker-run diff --git a/device/device.pb.go b/device/device.pb.go new file mode 100644 index 0000000..bc4b767 --- /dev/null +++ b/device/device.pb.go @@ -0,0 +1,835 @@ +// sets the .proto file syntax version + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc v4.24.4 +// source: device.proto + +// sets the protobuf package name (i.e. definitions namespace) + +package device + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// messages from devices to the server (api) +type DeviceToServerMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Message: + // + // *DeviceToServerMessage_AuthChallenge + // *DeviceToServerMessage_Peers + // *DeviceToServerMessage_Heartbeat + Message isDeviceToServerMessage_Message `protobuf_oneof:"Message"` +} + +func (x *DeviceToServerMessage) Reset() { + *x = DeviceToServerMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_device_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeviceToServerMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceToServerMessage) ProtoMessage() {} + +func (x *DeviceToServerMessage) ProtoReflect() protoreflect.Message { + mi := &file_device_proto_msgTypes[0] + 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 DeviceToServerMessage.ProtoReflect.Descriptor instead. +func (*DeviceToServerMessage) Descriptor() ([]byte, []int) { + return file_device_proto_rawDescGZIP(), []int{0} +} + +func (m *DeviceToServerMessage) GetMessage() isDeviceToServerMessage_Message { + if m != nil { + return m.Message + } + return nil +} + +func (x *DeviceToServerMessage) GetAuthChallenge() *AuthChallengeSolution { + if x, ok := x.GetMessage().(*DeviceToServerMessage_AuthChallenge); ok { + return x.AuthChallenge + } + return nil +} + +func (x *DeviceToServerMessage) GetPeers() *GetPeersRequest { + if x, ok := x.GetMessage().(*DeviceToServerMessage_Peers); ok { + return x.Peers + } + return nil +} + +func (x *DeviceToServerMessage) GetHeartbeat() *HeartbeatRequest { + if x, ok := x.GetMessage().(*DeviceToServerMessage_Heartbeat); ok { + return x.Heartbeat + } + return nil +} + +type isDeviceToServerMessage_Message interface { + isDeviceToServerMessage_Message() +} + +type DeviceToServerMessage_AuthChallenge struct { + AuthChallenge *AuthChallengeSolution `protobuf:"bytes,1,opt,name=authChallenge,proto3,oneof"` +} + +type DeviceToServerMessage_Peers struct { + Peers *GetPeersRequest `protobuf:"bytes,2,opt,name=peers,proto3,oneof"` +} + +type DeviceToServerMessage_Heartbeat struct { + Heartbeat *HeartbeatRequest `protobuf:"bytes,3,opt,name=heartbeat,proto3,oneof"` +} + +func (*DeviceToServerMessage_AuthChallenge) isDeviceToServerMessage_Message() {} + +func (*DeviceToServerMessage_Peers) isDeviceToServerMessage_Message() {} + +func (*DeviceToServerMessage_Heartbeat) isDeviceToServerMessage_Message() {} + +// messages from the server (api) to devices +type ServerToDeviceMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Message: + // + // *ServerToDeviceMessage_AuthChallenge + // *ServerToDeviceMessage_Peers + // *ServerToDeviceMessage_Heartbeat + Message isServerToDeviceMessage_Message `protobuf_oneof:"Message"` +} + +func (x *ServerToDeviceMessage) Reset() { + *x = ServerToDeviceMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_device_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServerToDeviceMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerToDeviceMessage) ProtoMessage() {} + +func (x *ServerToDeviceMessage) ProtoReflect() protoreflect.Message { + mi := &file_device_proto_msgTypes[1] + 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 ServerToDeviceMessage.ProtoReflect.Descriptor instead. +func (*ServerToDeviceMessage) Descriptor() ([]byte, []int) { + return file_device_proto_rawDescGZIP(), []int{1} +} + +func (m *ServerToDeviceMessage) GetMessage() isServerToDeviceMessage_Message { + if m != nil { + return m.Message + } + return nil +} + +func (x *ServerToDeviceMessage) GetAuthChallenge() *AuthChallenge { + if x, ok := x.GetMessage().(*ServerToDeviceMessage_AuthChallenge); ok { + return x.AuthChallenge + } + return nil +} + +func (x *ServerToDeviceMessage) GetPeers() *GetPeersResponse { + if x, ok := x.GetMessage().(*ServerToDeviceMessage_Peers); ok { + return x.Peers + } + return nil +} + +func (x *ServerToDeviceMessage) GetHeartbeat() *HeartbeatResponse { + if x, ok := x.GetMessage().(*ServerToDeviceMessage_Heartbeat); ok { + return x.Heartbeat + } + return nil +} + +type isServerToDeviceMessage_Message interface { + isServerToDeviceMessage_Message() +} + +type ServerToDeviceMessage_AuthChallenge struct { + AuthChallenge *AuthChallenge `protobuf:"bytes,1,opt,name=authChallenge,proto3,oneof"` +} + +type ServerToDeviceMessage_Peers struct { + Peers *GetPeersResponse `protobuf:"bytes,2,opt,name=peers,proto3,oneof"` +} + +type ServerToDeviceMessage_Heartbeat struct { + Heartbeat *HeartbeatResponse `protobuf:"bytes,3,opt,name=heartbeat,proto3,oneof"` +} + +func (*ServerToDeviceMessage_AuthChallenge) isServerToDeviceMessage_Message() {} + +func (*ServerToDeviceMessage_Peers) isServerToDeviceMessage_Message() {} + +func (*ServerToDeviceMessage_Heartbeat) isServerToDeviceMessage_Message() {} + +type AuthChallenge struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServerPublicKey string `protobuf:"bytes,1,opt,name=serverPublicKey,proto3" json:"serverPublicKey,omitempty"` + Challenge []byte `protobuf:"bytes,2,opt,name=challenge,proto3" json:"challenge,omitempty"` + ChallengeNonce []byte `protobuf:"bytes,3,opt,name=challengeNonce,proto3" json:"challengeNonce,omitempty"` +} + +func (x *AuthChallenge) Reset() { + *x = AuthChallenge{} + if protoimpl.UnsafeEnabled { + mi := &file_device_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AuthChallenge) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthChallenge) ProtoMessage() {} + +func (x *AuthChallenge) ProtoReflect() protoreflect.Message { + mi := &file_device_proto_msgTypes[2] + 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 AuthChallenge.ProtoReflect.Descriptor instead. +func (*AuthChallenge) Descriptor() ([]byte, []int) { + return file_device_proto_rawDescGZIP(), []int{2} +} + +func (x *AuthChallenge) GetServerPublicKey() string { + if x != nil { + return x.ServerPublicKey + } + return "" +} + +func (x *AuthChallenge) GetChallenge() []byte { + if x != nil { + return x.Challenge + } + return nil +} + +func (x *AuthChallenge) GetChallengeNonce() []byte { + if x != nil { + return x.ChallengeNonce + } + return nil +} + +type AuthChallengeSolution struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Solved []byte `protobuf:"bytes,1,opt,name=solved,proto3" json:"solved,omitempty"` + SolvedNonce []byte `protobuf:"bytes,2,opt,name=solvedNonce,proto3" json:"solvedNonce,omitempty"` +} + +func (x *AuthChallengeSolution) Reset() { + *x = AuthChallengeSolution{} + if protoimpl.UnsafeEnabled { + mi := &file_device_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AuthChallengeSolution) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthChallengeSolution) ProtoMessage() {} + +func (x *AuthChallengeSolution) ProtoReflect() protoreflect.Message { + mi := &file_device_proto_msgTypes[3] + 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 AuthChallengeSolution.ProtoReflect.Descriptor instead. +func (*AuthChallengeSolution) Descriptor() ([]byte, []int) { + return file_device_proto_rawDescGZIP(), []int{3} +} + +func (x *AuthChallengeSolution) GetSolved() []byte { + if x != nil { + return x.Solved + } + return nil +} + +func (x *AuthChallengeSolution) GetSolvedNonce() []byte { + if x != nil { + return x.SolvedNonce + } + return nil +} + +type HeartbeatRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *HeartbeatRequest) Reset() { + *x = HeartbeatRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_device_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HeartbeatRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeartbeatRequest) ProtoMessage() {} + +func (x *HeartbeatRequest) ProtoReflect() protoreflect.Message { + mi := &file_device_proto_msgTypes[4] + 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 HeartbeatRequest.ProtoReflect.Descriptor instead. +func (*HeartbeatRequest) Descriptor() ([]byte, []int) { + return file_device_proto_rawDescGZIP(), []int{4} +} + +type HeartbeatResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *HeartbeatResponse) Reset() { + *x = HeartbeatResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_device_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HeartbeatResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeartbeatResponse) ProtoMessage() {} + +func (x *HeartbeatResponse) ProtoReflect() protoreflect.Message { + mi := &file_device_proto_msgTypes[5] + 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 HeartbeatResponse.ProtoReflect.Descriptor instead. +func (*HeartbeatResponse) Descriptor() ([]byte, []int) { + return file_device_proto_rawDescGZIP(), []int{5} +} + +type GetPeersRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GetPeersRequest) Reset() { + *x = GetPeersRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_device_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPeersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPeersRequest) ProtoMessage() {} + +func (x *GetPeersRequest) ProtoReflect() protoreflect.Message { + mi := &file_device_proto_msgTypes[6] + 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 GetPeersRequest.ProtoReflect.Descriptor instead. +func (*GetPeersRequest) Descriptor() ([]byte, []int) { + return file_device_proto_rawDescGZIP(), []int{6} +} + +type GetPeersResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Peers []*WireGuardPeer `protobuf:"bytes,1,rep,name=peers,proto3" json:"peers,omitempty"` +} + +func (x *GetPeersResponse) Reset() { + *x = GetPeersResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_device_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPeersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPeersResponse) ProtoMessage() {} + +func (x *GetPeersResponse) ProtoReflect() protoreflect.Message { + mi := &file_device_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 GetPeersResponse.ProtoReflect.Descriptor instead. +func (*GetPeersResponse) Descriptor() ([]byte, []int) { + return file_device_proto_rawDescGZIP(), []int{7} +} + +func (x *GetPeersResponse) GetPeers() []*WireGuardPeer { + if x != nil { + return x.Peers + } + return nil +} + +type WireGuardPeer struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PublicKey string `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // the public key of the peer, used for identification and encryption + Endpoint string `protobuf:"bytes,2,opt,name=endpoint,proto3" json:"endpoint,omitempty"` // the endpoint (IP + port) to send packets to for the peer + AllowedIps []string `protobuf:"bytes,3,rep,name=allowed_ips,json=allowedIps,proto3" json:"allowed_ips,omitempty"` // list of routes (CIDRs) to be routed through this peer (most peers will just have their own IP/32) + PersistentKeepalive uint32 `protobuf:"varint,4,opt,name=persistent_keepalive,json=persistentKeepalive,proto3" json:"persistent_keepalive,omitempty"` // the interval (seconds) for sending keepalive packets (0 means disabled) +} + +func (x *WireGuardPeer) Reset() { + *x = WireGuardPeer{} + if protoimpl.UnsafeEnabled { + mi := &file_device_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WireGuardPeer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WireGuardPeer) ProtoMessage() {} + +func (x *WireGuardPeer) ProtoReflect() protoreflect.Message { + mi := &file_device_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 WireGuardPeer.ProtoReflect.Descriptor instead. +func (*WireGuardPeer) Descriptor() ([]byte, []int) { + return file_device_proto_rawDescGZIP(), []int{8} +} + +func (x *WireGuardPeer) GetPublicKey() string { + if x != nil { + return x.PublicKey + } + return "" +} + +func (x *WireGuardPeer) GetEndpoint() string { + if x != nil { + return x.Endpoint + } + return "" +} + +func (x *WireGuardPeer) GetAllowedIps() []string { + if x != nil { + return x.AllowedIps + } + return nil +} + +func (x *WireGuardPeer) GetPersistentKeepalive() uint32 { + if x != nil { + return x.PersistentKeepalive + } + return 0 +} + +var File_device_proto protoreflect.FileDescriptor + +var file_device_proto_rawDesc = []byte{ + 0x0a, 0x0c, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, + 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, + 0x31, 0x22, 0xf5, 0x01, 0x0a, 0x15, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x6f, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x50, 0x0a, 0x0d, 0x61, + 0x75, 0x74, 0x68, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, 0x64, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x43, 0x68, 0x61, 0x6c, 0x6c, + 0x65, 0x6e, 0x67, 0x65, 0x53, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0d, + 0x61, 0x75, 0x74, 0x68, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x12, 0x3a, 0x0a, + 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x62, + 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x48, 0x00, 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x12, 0x43, 0x0a, 0x09, 0x68, 0x65, 0x61, + 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x62, + 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x48, 0x00, 0x52, 0x09, 0x68, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x42, 0x09, + 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xef, 0x01, 0x0a, 0x15, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x54, 0x6f, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x12, 0x48, 0x0a, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x43, 0x68, 0x61, 0x6c, 0x6c, + 0x65, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x6f, 0x72, + 0x64, 0x65, 0x72, 0x30, 0x2e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, + 0x75, 0x74, 0x68, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0d, + 0x61, 0x75, 0x74, 0x68, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x12, 0x3b, 0x0a, + 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x62, + 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x48, 0x00, 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x12, 0x44, 0x0a, 0x09, 0x68, 0x65, + 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, + 0x31, 0x2e, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x09, 0x68, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, + 0x42, 0x09, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x7f, 0x0a, 0x0d, 0x41, + 0x75, 0x74, 0x68, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x12, 0x28, 0x0a, 0x0f, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x50, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, + 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6c, 0x6c, + 0x65, 0x6e, 0x67, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, + 0x65, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x63, 0x68, + 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x22, 0x51, 0x0a, 0x15, + 0x41, 0x75, 0x74, 0x68, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x53, 0x6f, 0x6c, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x12, 0x20, 0x0a, + 0x0b, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x0b, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x22, + 0x12, 0x0a, 0x10, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0x13, 0x0a, 0x11, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x11, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x50, + 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x4a, 0x0a, 0x10, 0x47, + 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x36, 0x0a, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, + 0x2e, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x76, 0x31, 0x2e, 0x57, 0x69, 0x72, 0x65, 0x47, 0x75, 0x61, 0x72, 0x64, 0x50, 0x65, 0x65, 0x72, + 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x22, 0x9e, 0x01, 0x0a, 0x0d, 0x57, 0x69, 0x72, 0x65, + 0x47, 0x75, 0x61, 0x72, 0x64, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, + 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, + 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, + 0x69, 0x70, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x6c, 0x6c, 0x6f, 0x77, + 0x65, 0x64, 0x49, 0x70, 0x73, 0x12, 0x31, 0x0a, 0x14, 0x70, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, + 0x65, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x13, 0x70, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x74, 0x4b, + 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x32, 0x82, 0x01, 0x0a, 0x17, 0x44, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x67, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x53, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x28, 0x2e, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, + 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x54, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, + 0x28, 0x2e, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x54, 0x6f, 0x44, 0x65, 0x76, 0x69, + 0x63, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x28, 0x01, 0x30, 0x01, 0x42, 0x2c, 0x5a, + 0x2a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, 0x6f, 0x72, 0x64, + 0x65, 0x72, 0x7a, 0x65, 0x72, 0x6f, 0x2f, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2d, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_device_proto_rawDescOnce sync.Once + file_device_proto_rawDescData = file_device_proto_rawDesc +) + +func file_device_proto_rawDescGZIP() []byte { + file_device_proto_rawDescOnce.Do(func() { + file_device_proto_rawDescData = protoimpl.X.CompressGZIP(file_device_proto_rawDescData) + }) + return file_device_proto_rawDescData +} + +var file_device_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_device_proto_goTypes = []any{ + (*DeviceToServerMessage)(nil), // 0: border0.device.v1.DeviceToServerMessage + (*ServerToDeviceMessage)(nil), // 1: border0.device.v1.ServerToDeviceMessage + (*AuthChallenge)(nil), // 2: border0.device.v1.AuthChallenge + (*AuthChallengeSolution)(nil), // 3: border0.device.v1.AuthChallengeSolution + (*HeartbeatRequest)(nil), // 4: border0.device.v1.HeartbeatRequest + (*HeartbeatResponse)(nil), // 5: border0.device.v1.HeartbeatResponse + (*GetPeersRequest)(nil), // 6: border0.device.v1.GetPeersRequest + (*GetPeersResponse)(nil), // 7: border0.device.v1.GetPeersResponse + (*WireGuardPeer)(nil), // 8: border0.device.v1.WireGuardPeer +} +var file_device_proto_depIdxs = []int32{ + 3, // 0: border0.device.v1.DeviceToServerMessage.authChallenge:type_name -> border0.device.v1.AuthChallengeSolution + 6, // 1: border0.device.v1.DeviceToServerMessage.peers:type_name -> border0.device.v1.GetPeersRequest + 4, // 2: border0.device.v1.DeviceToServerMessage.heartbeat:type_name -> border0.device.v1.HeartbeatRequest + 2, // 3: border0.device.v1.ServerToDeviceMessage.authChallenge:type_name -> border0.device.v1.AuthChallenge + 7, // 4: border0.device.v1.ServerToDeviceMessage.peers:type_name -> border0.device.v1.GetPeersResponse + 5, // 5: border0.device.v1.ServerToDeviceMessage.heartbeat:type_name -> border0.device.v1.HeartbeatResponse + 8, // 6: border0.device.v1.GetPeersResponse.peers:type_name -> border0.device.v1.WireGuardPeer + 0, // 7: border0.device.v1.DeviceManagementService.ControlStream:input_type -> border0.device.v1.DeviceToServerMessage + 1, // 8: border0.device.v1.DeviceManagementService.ControlStream:output_type -> border0.device.v1.ServerToDeviceMessage + 8, // [8:9] is the sub-list for method output_type + 7, // [7:8] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_device_proto_init() } +func file_device_proto_init() { + if File_device_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_device_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*DeviceToServerMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_device_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*ServerToDeviceMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_device_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*AuthChallenge); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_device_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*AuthChallengeSolution); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_device_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*HeartbeatRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_device_proto_msgTypes[5].Exporter = func(v any, i int) any { + switch v := v.(*HeartbeatResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_device_proto_msgTypes[6].Exporter = func(v any, i int) any { + switch v := v.(*GetPeersRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_device_proto_msgTypes[7].Exporter = func(v any, i int) any { + switch v := v.(*GetPeersResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_device_proto_msgTypes[8].Exporter = func(v any, i int) any { + switch v := v.(*WireGuardPeer); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_device_proto_msgTypes[0].OneofWrappers = []any{ + (*DeviceToServerMessage_AuthChallenge)(nil), + (*DeviceToServerMessage_Peers)(nil), + (*DeviceToServerMessage_Heartbeat)(nil), + } + file_device_proto_msgTypes[1].OneofWrappers = []any{ + (*ServerToDeviceMessage_AuthChallenge)(nil), + (*ServerToDeviceMessage_Peers)(nil), + (*ServerToDeviceMessage_Heartbeat)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_device_proto_rawDesc, + NumEnums: 0, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_device_proto_goTypes, + DependencyIndexes: file_device_proto_depIdxs, + MessageInfos: file_device_proto_msgTypes, + }.Build() + File_device_proto = out.File + file_device_proto_rawDesc = nil + file_device_proto_goTypes = nil + file_device_proto_depIdxs = nil +} diff --git a/peer/peer.proto b/device/device.proto similarity index 66% rename from peer/peer.proto rename to device/device.proto index 5e49190..11f35e2 100644 --- a/peer/peer.proto +++ b/device/device.proto @@ -2,18 +2,18 @@ syntax = "proto3"; // sets the output golang package name -option go_package = "github.com/borderzero/border0-proto/peer"; +option go_package = "github.com/borderzero/border0-proto/device"; // sets the protobuf package name (i.e. definitions namespace) -package border0.peer.v1; +package border0.device.v1; -// the stream (rpc) service for the Border0 api to manage peers/devices -service PeerService { - rpc ControlStream(stream ClientToServerMessage) returns (stream ServerToClientMessage); +// the stream (rpc) service for the Border0 api to manage devices +service DeviceManagementService { + rpc ControlStream(stream DeviceToServerMessage) returns (stream ServerToDeviceMessage); } -// messages from clients to the server (api) -message ClientToServerMessage { +// messages from devices to the server (api) +message DeviceToServerMessage { oneof Message { AuthChallengeSolution authChallenge = 1; GetPeersRequest peers = 2; @@ -21,8 +21,8 @@ message ClientToServerMessage { } } -// messages from the server (api) to clients -message ServerToClientMessage { +// messages from the server (api) to devices +message ServerToDeviceMessage { oneof Message { AuthChallenge authChallenge = 1; GetPeersResponse peers = 2; @@ -31,12 +31,14 @@ message ServerToClientMessage { } message AuthChallenge { - string challenge = 1; - string serverPublicKey = 2; + string serverPublicKey = 1; + bytes challenge = 2; + bytes challengeNonce = 3; } message AuthChallengeSolution { - string solved = 1; + bytes solved = 1; + bytes solvedNonce = 2; } message HeartbeatRequest {} @@ -53,4 +55,4 @@ message WireGuardPeer { string endpoint = 2; // the endpoint (IP + port) to send packets to for the peer repeated string allowed_ips = 3; // list of routes (CIDRs) to be routed through this peer (most peers will just have their own IP/32) uint32 persistent_keepalive = 4; // the interval (seconds) for sending keepalive packets (0 means disabled) -} \ No newline at end of file +} diff --git a/device/device_grpc.pb.go b/device/device_grpc.pb.go new file mode 100644 index 0000000..97a2d91 --- /dev/null +++ b/device/device_grpc.pb.go @@ -0,0 +1,124 @@ +// sets the .proto file syntax version + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v4.24.4 +// source: device.proto + +// sets the protobuf package name (i.e. definitions namespace) + +package device + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + DeviceManagementService_ControlStream_FullMethodName = "/border0.device.v1.DeviceManagementService/ControlStream" +) + +// DeviceManagementServiceClient is the client API for DeviceManagementService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// the stream (rpc) service for the Border0 api to manage devices +type DeviceManagementServiceClient interface { + ControlStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[DeviceToServerMessage, ServerToDeviceMessage], error) +} + +type deviceManagementServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewDeviceManagementServiceClient(cc grpc.ClientConnInterface) DeviceManagementServiceClient { + return &deviceManagementServiceClient{cc} +} + +func (c *deviceManagementServiceClient) ControlStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[DeviceToServerMessage, ServerToDeviceMessage], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &DeviceManagementService_ServiceDesc.Streams[0], DeviceManagementService_ControlStream_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[DeviceToServerMessage, ServerToDeviceMessage]{ClientStream: stream} + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type DeviceManagementService_ControlStreamClient = grpc.BidiStreamingClient[DeviceToServerMessage, ServerToDeviceMessage] + +// DeviceManagementServiceServer is the server API for DeviceManagementService service. +// All implementations must embed UnimplementedDeviceManagementServiceServer +// for forward compatibility. +// +// the stream (rpc) service for the Border0 api to manage devices +type DeviceManagementServiceServer interface { + ControlStream(grpc.BidiStreamingServer[DeviceToServerMessage, ServerToDeviceMessage]) error + mustEmbedUnimplementedDeviceManagementServiceServer() +} + +// UnimplementedDeviceManagementServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedDeviceManagementServiceServer struct{} + +func (UnimplementedDeviceManagementServiceServer) ControlStream(grpc.BidiStreamingServer[DeviceToServerMessage, ServerToDeviceMessage]) error { + return status.Errorf(codes.Unimplemented, "method ControlStream not implemented") +} +func (UnimplementedDeviceManagementServiceServer) mustEmbedUnimplementedDeviceManagementServiceServer() { +} +func (UnimplementedDeviceManagementServiceServer) testEmbeddedByValue() {} + +// UnsafeDeviceManagementServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to DeviceManagementServiceServer will +// result in compilation errors. +type UnsafeDeviceManagementServiceServer interface { + mustEmbedUnimplementedDeviceManagementServiceServer() +} + +func RegisterDeviceManagementServiceServer(s grpc.ServiceRegistrar, srv DeviceManagementServiceServer) { + // If the following call pancis, it indicates UnimplementedDeviceManagementServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&DeviceManagementService_ServiceDesc, srv) +} + +func _DeviceManagementService_ControlStream_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(DeviceManagementServiceServer).ControlStream(&grpc.GenericServerStream[DeviceToServerMessage, ServerToDeviceMessage]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type DeviceManagementService_ControlStreamServer = grpc.BidiStreamingServer[DeviceToServerMessage, ServerToDeviceMessage] + +// DeviceManagementService_ServiceDesc is the grpc.ServiceDesc for DeviceManagementService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var DeviceManagementService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "border0.device.v1.DeviceManagementService", + HandlerType: (*DeviceManagementServiceServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "ControlStream", + Handler: _DeviceManagementService_ControlStream_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "device.proto", +} diff --git a/peer/peer.pb.go b/peer/peer.pb.go deleted file mode 100644 index 65e3d13..0000000 --- a/peer/peer.pb.go +++ /dev/null @@ -1,812 +0,0 @@ -// sets the .proto file syntax version - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v4.24.4 -// source: peer.proto - -// sets the protobuf package name (i.e. definitions namespace) - -package peer - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// messages from clients to the server (api) -type ClientToServerMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Message: - // - // *ClientToServerMessage_AuthChallenge - // *ClientToServerMessage_Peers - // *ClientToServerMessage_Heartbeat - Message isClientToServerMessage_Message `protobuf_oneof:"Message"` -} - -func (x *ClientToServerMessage) Reset() { - *x = ClientToServerMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_peer_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ClientToServerMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ClientToServerMessage) ProtoMessage() {} - -func (x *ClientToServerMessage) ProtoReflect() protoreflect.Message { - mi := &file_peer_proto_msgTypes[0] - 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 ClientToServerMessage.ProtoReflect.Descriptor instead. -func (*ClientToServerMessage) Descriptor() ([]byte, []int) { - return file_peer_proto_rawDescGZIP(), []int{0} -} - -func (m *ClientToServerMessage) GetMessage() isClientToServerMessage_Message { - if m != nil { - return m.Message - } - return nil -} - -func (x *ClientToServerMessage) GetAuthChallenge() *AuthChallengeSolution { - if x, ok := x.GetMessage().(*ClientToServerMessage_AuthChallenge); ok { - return x.AuthChallenge - } - return nil -} - -func (x *ClientToServerMessage) GetPeers() *GetPeersRequest { - if x, ok := x.GetMessage().(*ClientToServerMessage_Peers); ok { - return x.Peers - } - return nil -} - -func (x *ClientToServerMessage) GetHeartbeat() *HeartbeatRequest { - if x, ok := x.GetMessage().(*ClientToServerMessage_Heartbeat); ok { - return x.Heartbeat - } - return nil -} - -type isClientToServerMessage_Message interface { - isClientToServerMessage_Message() -} - -type ClientToServerMessage_AuthChallenge struct { - AuthChallenge *AuthChallengeSolution `protobuf:"bytes,1,opt,name=authChallenge,proto3,oneof"` -} - -type ClientToServerMessage_Peers struct { - Peers *GetPeersRequest `protobuf:"bytes,2,opt,name=peers,proto3,oneof"` -} - -type ClientToServerMessage_Heartbeat struct { - Heartbeat *HeartbeatRequest `protobuf:"bytes,3,opt,name=heartbeat,proto3,oneof"` -} - -func (*ClientToServerMessage_AuthChallenge) isClientToServerMessage_Message() {} - -func (*ClientToServerMessage_Peers) isClientToServerMessage_Message() {} - -func (*ClientToServerMessage_Heartbeat) isClientToServerMessage_Message() {} - -// messages from the server (api) to clients -type ServerToClientMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Message: - // - // *ServerToClientMessage_AuthChallenge - // *ServerToClientMessage_Peers - // *ServerToClientMessage_Heartbeat - Message isServerToClientMessage_Message `protobuf_oneof:"Message"` -} - -func (x *ServerToClientMessage) Reset() { - *x = ServerToClientMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_peer_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ServerToClientMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ServerToClientMessage) ProtoMessage() {} - -func (x *ServerToClientMessage) ProtoReflect() protoreflect.Message { - mi := &file_peer_proto_msgTypes[1] - 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 ServerToClientMessage.ProtoReflect.Descriptor instead. -func (*ServerToClientMessage) Descriptor() ([]byte, []int) { - return file_peer_proto_rawDescGZIP(), []int{1} -} - -func (m *ServerToClientMessage) GetMessage() isServerToClientMessage_Message { - if m != nil { - return m.Message - } - return nil -} - -func (x *ServerToClientMessage) GetAuthChallenge() *AuthChallenge { - if x, ok := x.GetMessage().(*ServerToClientMessage_AuthChallenge); ok { - return x.AuthChallenge - } - return nil -} - -func (x *ServerToClientMessage) GetPeers() *GetPeersResponse { - if x, ok := x.GetMessage().(*ServerToClientMessage_Peers); ok { - return x.Peers - } - return nil -} - -func (x *ServerToClientMessage) GetHeartbeat() *HeartbeatResponse { - if x, ok := x.GetMessage().(*ServerToClientMessage_Heartbeat); ok { - return x.Heartbeat - } - return nil -} - -type isServerToClientMessage_Message interface { - isServerToClientMessage_Message() -} - -type ServerToClientMessage_AuthChallenge struct { - AuthChallenge *AuthChallenge `protobuf:"bytes,1,opt,name=authChallenge,proto3,oneof"` -} - -type ServerToClientMessage_Peers struct { - Peers *GetPeersResponse `protobuf:"bytes,2,opt,name=peers,proto3,oneof"` -} - -type ServerToClientMessage_Heartbeat struct { - Heartbeat *HeartbeatResponse `protobuf:"bytes,3,opt,name=heartbeat,proto3,oneof"` -} - -func (*ServerToClientMessage_AuthChallenge) isServerToClientMessage_Message() {} - -func (*ServerToClientMessage_Peers) isServerToClientMessage_Message() {} - -func (*ServerToClientMessage_Heartbeat) isServerToClientMessage_Message() {} - -type AuthChallenge struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Challenge string `protobuf:"bytes,1,opt,name=challenge,proto3" json:"challenge,omitempty"` - ServerPublicKey string `protobuf:"bytes,2,opt,name=serverPublicKey,proto3" json:"serverPublicKey,omitempty"` -} - -func (x *AuthChallenge) Reset() { - *x = AuthChallenge{} - if protoimpl.UnsafeEnabled { - mi := &file_peer_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthChallenge) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthChallenge) ProtoMessage() {} - -func (x *AuthChallenge) ProtoReflect() protoreflect.Message { - mi := &file_peer_proto_msgTypes[2] - 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 AuthChallenge.ProtoReflect.Descriptor instead. -func (*AuthChallenge) Descriptor() ([]byte, []int) { - return file_peer_proto_rawDescGZIP(), []int{2} -} - -func (x *AuthChallenge) GetChallenge() string { - if x != nil { - return x.Challenge - } - return "" -} - -func (x *AuthChallenge) GetServerPublicKey() string { - if x != nil { - return x.ServerPublicKey - } - return "" -} - -type AuthChallengeSolution struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Solved string `protobuf:"bytes,1,opt,name=solved,proto3" json:"solved,omitempty"` -} - -func (x *AuthChallengeSolution) Reset() { - *x = AuthChallengeSolution{} - if protoimpl.UnsafeEnabled { - mi := &file_peer_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthChallengeSolution) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthChallengeSolution) ProtoMessage() {} - -func (x *AuthChallengeSolution) ProtoReflect() protoreflect.Message { - mi := &file_peer_proto_msgTypes[3] - 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 AuthChallengeSolution.ProtoReflect.Descriptor instead. -func (*AuthChallengeSolution) Descriptor() ([]byte, []int) { - return file_peer_proto_rawDescGZIP(), []int{3} -} - -func (x *AuthChallengeSolution) GetSolved() string { - if x != nil { - return x.Solved - } - return "" -} - -type HeartbeatRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *HeartbeatRequest) Reset() { - *x = HeartbeatRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_peer_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeartbeatRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeartbeatRequest) ProtoMessage() {} - -func (x *HeartbeatRequest) ProtoReflect() protoreflect.Message { - mi := &file_peer_proto_msgTypes[4] - 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 HeartbeatRequest.ProtoReflect.Descriptor instead. -func (*HeartbeatRequest) Descriptor() ([]byte, []int) { - return file_peer_proto_rawDescGZIP(), []int{4} -} - -type HeartbeatResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *HeartbeatResponse) Reset() { - *x = HeartbeatResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_peer_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *HeartbeatResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*HeartbeatResponse) ProtoMessage() {} - -func (x *HeartbeatResponse) ProtoReflect() protoreflect.Message { - mi := &file_peer_proto_msgTypes[5] - 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 HeartbeatResponse.ProtoReflect.Descriptor instead. -func (*HeartbeatResponse) Descriptor() ([]byte, []int) { - return file_peer_proto_rawDescGZIP(), []int{5} -} - -type GetPeersRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *GetPeersRequest) Reset() { - *x = GetPeersRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_peer_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetPeersRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetPeersRequest) ProtoMessage() {} - -func (x *GetPeersRequest) ProtoReflect() protoreflect.Message { - mi := &file_peer_proto_msgTypes[6] - 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 GetPeersRequest.ProtoReflect.Descriptor instead. -func (*GetPeersRequest) Descriptor() ([]byte, []int) { - return file_peer_proto_rawDescGZIP(), []int{6} -} - -type GetPeersResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Peers []*WireGuardPeer `protobuf:"bytes,1,rep,name=peers,proto3" json:"peers,omitempty"` -} - -func (x *GetPeersResponse) Reset() { - *x = GetPeersResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_peer_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetPeersResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetPeersResponse) ProtoMessage() {} - -func (x *GetPeersResponse) ProtoReflect() protoreflect.Message { - mi := &file_peer_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 GetPeersResponse.ProtoReflect.Descriptor instead. -func (*GetPeersResponse) Descriptor() ([]byte, []int) { - return file_peer_proto_rawDescGZIP(), []int{7} -} - -func (x *GetPeersResponse) GetPeers() []*WireGuardPeer { - if x != nil { - return x.Peers - } - return nil -} - -type WireGuardPeer struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PublicKey string `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // the public key of the peer, used for identification and encryption - Endpoint string `protobuf:"bytes,2,opt,name=endpoint,proto3" json:"endpoint,omitempty"` // the endpoint (IP + port) to send packets to for the peer - AllowedIps []string `protobuf:"bytes,3,rep,name=allowed_ips,json=allowedIps,proto3" json:"allowed_ips,omitempty"` // list of routes (CIDRs) to be routed through this peer (most peers will just have their own IP/32) - PersistentKeepalive uint32 `protobuf:"varint,4,opt,name=persistent_keepalive,json=persistentKeepalive,proto3" json:"persistent_keepalive,omitempty"` // the interval (seconds) for sending keepalive packets (0 means disabled) -} - -func (x *WireGuardPeer) Reset() { - *x = WireGuardPeer{} - if protoimpl.UnsafeEnabled { - mi := &file_peer_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WireGuardPeer) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WireGuardPeer) ProtoMessage() {} - -func (x *WireGuardPeer) ProtoReflect() protoreflect.Message { - mi := &file_peer_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 WireGuardPeer.ProtoReflect.Descriptor instead. -func (*WireGuardPeer) Descriptor() ([]byte, []int) { - return file_peer_proto_rawDescGZIP(), []int{8} -} - -func (x *WireGuardPeer) GetPublicKey() string { - if x != nil { - return x.PublicKey - } - return "" -} - -func (x *WireGuardPeer) GetEndpoint() string { - if x != nil { - return x.Endpoint - } - return "" -} - -func (x *WireGuardPeer) GetAllowedIps() []string { - if x != nil { - return x.AllowedIps - } - return nil -} - -func (x *WireGuardPeer) GetPersistentKeepalive() uint32 { - if x != nil { - return x.PersistentKeepalive - } - return 0 -} - -var File_peer_proto protoreflect.FileDescriptor - -var file_peer_proto_rawDesc = []byte{ - 0x0a, 0x0a, 0x70, 0x65, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x62, 0x6f, - 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x22, 0xef, 0x01, - 0x0a, 0x15, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x4e, 0x0a, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x43, - 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, - 0x2e, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x2e, 0x76, 0x31, - 0x2e, 0x41, 0x75, 0x74, 0x68, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x53, 0x6f, - 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x43, 0x68, - 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x12, 0x38, 0x0a, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, - 0x2e, 0x70, 0x65, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, - 0x73, 0x12, 0x41, 0x0a, 0x09, 0x68, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, 0x70, - 0x65, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x09, 0x68, 0x65, 0x61, 0x72, 0x74, - 0x62, 0x65, 0x61, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, - 0xe9, 0x01, 0x0a, 0x15, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x54, 0x6f, 0x43, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x46, 0x0a, 0x0d, 0x61, 0x75, 0x74, - 0x68, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1e, 0x2e, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x2e, - 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, - 0x48, 0x00, 0x52, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, - 0x65, 0x12, 0x39, 0x0a, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x21, 0x2e, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x2e, - 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x12, 0x42, 0x0a, 0x09, - 0x68, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x22, 0x2e, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x2e, 0x76, - 0x31, 0x2e, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x09, 0x68, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, - 0x42, 0x09, 0x0a, 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x57, 0x0a, 0x0d, 0x41, - 0x75, 0x74, 0x68, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, - 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x63, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, - 0x63, 0x4b, 0x65, 0x79, 0x22, 0x2f, 0x0a, 0x15, 0x41, 0x75, 0x74, 0x68, 0x43, 0x68, 0x61, 0x6c, - 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x53, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, - 0x06, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, - 0x6f, 0x6c, 0x76, 0x65, 0x64, 0x22, 0x12, 0x0a, 0x10, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, - 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x13, 0x0a, 0x11, 0x48, 0x65, 0x61, - 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x11, - 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x22, 0x48, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, 0x70, - 0x65, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x57, 0x69, 0x72, 0x65, 0x47, 0x75, 0x61, 0x72, 0x64, - 0x50, 0x65, 0x65, 0x72, 0x52, 0x05, 0x70, 0x65, 0x65, 0x72, 0x73, 0x22, 0x9e, 0x01, 0x0a, 0x0d, - 0x57, 0x69, 0x72, 0x65, 0x47, 0x75, 0x61, 0x72, 0x64, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1d, 0x0a, - 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, - 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x6c, 0x6c, 0x6f, - 0x77, 0x65, 0x64, 0x5f, 0x69, 0x70, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x61, - 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x49, 0x70, 0x73, 0x12, 0x31, 0x0a, 0x14, 0x70, 0x65, 0x72, - 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x13, 0x70, 0x65, 0x72, 0x73, 0x69, 0x73, 0x74, - 0x65, 0x6e, 0x74, 0x4b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x32, 0x72, 0x0a, 0x0b, - 0x50, 0x65, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x63, 0x0a, 0x0d, 0x43, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x26, 0x2e, 0x62, - 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x1a, 0x26, 0x2e, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x30, 0x2e, 0x70, - 0x65, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x54, 0x6f, 0x43, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x28, 0x01, 0x30, 0x01, - 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x62, - 0x6f, 0x72, 0x64, 0x65, 0x72, 0x7a, 0x65, 0x72, 0x6f, 0x2f, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72, - 0x30, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_peer_proto_rawDescOnce sync.Once - file_peer_proto_rawDescData = file_peer_proto_rawDesc -) - -func file_peer_proto_rawDescGZIP() []byte { - file_peer_proto_rawDescOnce.Do(func() { - file_peer_proto_rawDescData = protoimpl.X.CompressGZIP(file_peer_proto_rawDescData) - }) - return file_peer_proto_rawDescData -} - -var file_peer_proto_msgTypes = make([]protoimpl.MessageInfo, 9) -var file_peer_proto_goTypes = []any{ - (*ClientToServerMessage)(nil), // 0: border0.peer.v1.ClientToServerMessage - (*ServerToClientMessage)(nil), // 1: border0.peer.v1.ServerToClientMessage - (*AuthChallenge)(nil), // 2: border0.peer.v1.AuthChallenge - (*AuthChallengeSolution)(nil), // 3: border0.peer.v1.AuthChallengeSolution - (*HeartbeatRequest)(nil), // 4: border0.peer.v1.HeartbeatRequest - (*HeartbeatResponse)(nil), // 5: border0.peer.v1.HeartbeatResponse - (*GetPeersRequest)(nil), // 6: border0.peer.v1.GetPeersRequest - (*GetPeersResponse)(nil), // 7: border0.peer.v1.GetPeersResponse - (*WireGuardPeer)(nil), // 8: border0.peer.v1.WireGuardPeer -} -var file_peer_proto_depIdxs = []int32{ - 3, // 0: border0.peer.v1.ClientToServerMessage.authChallenge:type_name -> border0.peer.v1.AuthChallengeSolution - 6, // 1: border0.peer.v1.ClientToServerMessage.peers:type_name -> border0.peer.v1.GetPeersRequest - 4, // 2: border0.peer.v1.ClientToServerMessage.heartbeat:type_name -> border0.peer.v1.HeartbeatRequest - 2, // 3: border0.peer.v1.ServerToClientMessage.authChallenge:type_name -> border0.peer.v1.AuthChallenge - 7, // 4: border0.peer.v1.ServerToClientMessage.peers:type_name -> border0.peer.v1.GetPeersResponse - 5, // 5: border0.peer.v1.ServerToClientMessage.heartbeat:type_name -> border0.peer.v1.HeartbeatResponse - 8, // 6: border0.peer.v1.GetPeersResponse.peers:type_name -> border0.peer.v1.WireGuardPeer - 0, // 7: border0.peer.v1.PeerService.ControlStream:input_type -> border0.peer.v1.ClientToServerMessage - 1, // 8: border0.peer.v1.PeerService.ControlStream:output_type -> border0.peer.v1.ServerToClientMessage - 8, // [8:9] is the sub-list for method output_type - 7, // [7:8] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name -} - -func init() { file_peer_proto_init() } -func file_peer_proto_init() { - if File_peer_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_peer_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*ClientToServerMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_peer_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*ServerToClientMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_peer_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*AuthChallenge); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_peer_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*AuthChallengeSolution); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_peer_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*HeartbeatRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_peer_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*HeartbeatResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_peer_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*GetPeersRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_peer_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*GetPeersResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_peer_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*WireGuardPeer); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_peer_proto_msgTypes[0].OneofWrappers = []any{ - (*ClientToServerMessage_AuthChallenge)(nil), - (*ClientToServerMessage_Peers)(nil), - (*ClientToServerMessage_Heartbeat)(nil), - } - file_peer_proto_msgTypes[1].OneofWrappers = []any{ - (*ServerToClientMessage_AuthChallenge)(nil), - (*ServerToClientMessage_Peers)(nil), - (*ServerToClientMessage_Heartbeat)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_peer_proto_rawDesc, - NumEnums: 0, - NumMessages: 9, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_peer_proto_goTypes, - DependencyIndexes: file_peer_proto_depIdxs, - MessageInfos: file_peer_proto_msgTypes, - }.Build() - File_peer_proto = out.File - file_peer_proto_rawDesc = nil - file_peer_proto_goTypes = nil - file_peer_proto_depIdxs = nil -} diff --git a/peer/peer_grpc.pb.go b/peer/peer_grpc.pb.go deleted file mode 100644 index 3c441eb..0000000 --- a/peer/peer_grpc.pb.go +++ /dev/null @@ -1,123 +0,0 @@ -// sets the .proto file syntax version - -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.5.1 -// - protoc v4.24.4 -// source: peer.proto - -// sets the protobuf package name (i.e. definitions namespace) - -package peer - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 - -const ( - PeerService_ControlStream_FullMethodName = "/border0.peer.v1.PeerService/ControlStream" -) - -// PeerServiceClient is the client API for PeerService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// the stream (rpc) service for the Border0 api to manage peers/devices -type PeerServiceClient interface { - ControlStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ClientToServerMessage, ServerToClientMessage], error) -} - -type peerServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewPeerServiceClient(cc grpc.ClientConnInterface) PeerServiceClient { - return &peerServiceClient{cc} -} - -func (c *peerServiceClient) ControlStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ClientToServerMessage, ServerToClientMessage], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &PeerService_ServiceDesc.Streams[0], PeerService_ControlStream_FullMethodName, cOpts...) - if err != nil { - return nil, err - } - x := &grpc.GenericClientStream[ClientToServerMessage, ServerToClientMessage]{ClientStream: stream} - return x, nil -} - -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type PeerService_ControlStreamClient = grpc.BidiStreamingClient[ClientToServerMessage, ServerToClientMessage] - -// PeerServiceServer is the server API for PeerService service. -// All implementations must embed UnimplementedPeerServiceServer -// for forward compatibility. -// -// the stream (rpc) service for the Border0 api to manage peers/devices -type PeerServiceServer interface { - ControlStream(grpc.BidiStreamingServer[ClientToServerMessage, ServerToClientMessage]) error - mustEmbedUnimplementedPeerServiceServer() -} - -// UnimplementedPeerServiceServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedPeerServiceServer struct{} - -func (UnimplementedPeerServiceServer) ControlStream(grpc.BidiStreamingServer[ClientToServerMessage, ServerToClientMessage]) error { - return status.Errorf(codes.Unimplemented, "method ControlStream not implemented") -} -func (UnimplementedPeerServiceServer) mustEmbedUnimplementedPeerServiceServer() {} -func (UnimplementedPeerServiceServer) testEmbeddedByValue() {} - -// UnsafePeerServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to PeerServiceServer will -// result in compilation errors. -type UnsafePeerServiceServer interface { - mustEmbedUnimplementedPeerServiceServer() -} - -func RegisterPeerServiceServer(s grpc.ServiceRegistrar, srv PeerServiceServer) { - // If the following call pancis, it indicates UnimplementedPeerServiceServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&PeerService_ServiceDesc, srv) -} - -func _PeerService_ControlStream_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(PeerServiceServer).ControlStream(&grpc.GenericServerStream[ClientToServerMessage, ServerToClientMessage]{ServerStream: stream}) -} - -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type PeerService_ControlStreamServer = grpc.BidiStreamingServer[ClientToServerMessage, ServerToClientMessage] - -// PeerService_ServiceDesc is the grpc.ServiceDesc for PeerService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var PeerService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "border0.peer.v1.PeerService", - HandlerType: (*PeerServiceServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "ControlStream", - Handler: _PeerService_ControlStream_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "peer.proto", -}