From 8863ea1b67b3229973f3d9abd94f1d3803b9d37d Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 12 Aug 2024 11:35:57 -0400 Subject: [PATCH 01/51] 'zrok daemon' cli skeleton (#463) --- cmd/zrok/daemon.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 cmd/zrok/daemon.go diff --git a/cmd/zrok/daemon.go b/cmd/zrok/daemon.go new file mode 100644 index 00000000..c2977b17 --- /dev/null +++ b/cmd/zrok/daemon.go @@ -0,0 +1,37 @@ +package main + +import ( + "github.com/openziti/zrok/environment" + "github.com/openziti/zrok/tui" + "github.com/spf13/cobra" +) + +func init() { + rootCmd.AddCommand(newDaemonCommand().cmd) +} + +type daemonCommand struct { + cmd *cobra.Command +} + +func newDaemonCommand() *daemonCommand { + cmd := &cobra.Command{ + Use: "daemon", + Short: "Launch a zrok daemon", + Args: cobra.NoArgs, + } + command := &daemonCommand{cmd: cmd} + cmd.Run = command.run + return command +} + +func (cmd *daemonCommand) run(_ *cobra.Command, _ []string) { + root, err := environment.LoadRoot() + if err != nil { + tui.Error("error loading zrokdir", err) + } + + if !root.IsEnabled() { + tui.Error("unable to load environment; did you 'zrok enable'?", nil) + } +} From 2d33c99902951f8ff39b116ca96fef11a8c0ce31 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Wed, 21 Aug 2024 14:48:02 -0400 Subject: [PATCH 02/51] daemon model skeleton (#463) --- daemon/daemon.go | 13 +++++++++++++ daemon/model.go | 27 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 daemon/daemon.go create mode 100644 daemon/model.go diff --git a/daemon/daemon.go b/daemon/daemon.go new file mode 100644 index 00000000..6fe01cc5 --- /dev/null +++ b/daemon/daemon.go @@ -0,0 +1,13 @@ +package daemon + +type Daemon struct { + shares map[string]*share + accesses map[string]*access +} + +func NewDaemon() *Daemon { + return &Daemon{ + shares: make(map[string]*share), + accesses: make(map[string]*access), + } +} diff --git a/daemon/model.go b/daemon/model.go new file mode 100644 index 00000000..a32694d3 --- /dev/null +++ b/daemon/model.go @@ -0,0 +1,27 @@ +package daemon + +import ( + "github.com/openziti/zrok/sdk/golang/sdk" + "time" +) + +type share struct { + token string + + basicAuth []string + frontendSelection []string + backendMode sdk.BackendMode + insecure bool + oauthProvider string + oauthEmailAddressPatterns []string + oauthCheckInterval time.Duration + closed bool + accessGrants []string +} + +type access struct { + token string + + bindAddress string + responseHeaders []string +} From 83ad5dde6dd136862253fbd1b0ce87103422e39b Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Thu, 22 Aug 2024 11:02:33 -0400 Subject: [PATCH 03/51] daemon -> agent (#463) --- daemon/daemon.go => agent/agent.go | 2 +- {daemon => agent}/model.go | 2 +- cmd/zrok/{daemon.go => agent.go} | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) rename daemon/daemon.go => agent/agent.go (93%) rename {daemon => agent}/model.go (97%) rename cmd/zrok/{daemon.go => agent.go} (63%) diff --git a/daemon/daemon.go b/agent/agent.go similarity index 93% rename from daemon/daemon.go rename to agent/agent.go index 6fe01cc5..12a1d727 100644 --- a/daemon/daemon.go +++ b/agent/agent.go @@ -1,4 +1,4 @@ -package daemon +package agent type Daemon struct { shares map[string]*share diff --git a/daemon/model.go b/agent/model.go similarity index 97% rename from daemon/model.go rename to agent/model.go index a32694d3..1c103705 100644 --- a/daemon/model.go +++ b/agent/model.go @@ -1,4 +1,4 @@ -package daemon +package agent import ( "github.com/openziti/zrok/sdk/golang/sdk" diff --git a/cmd/zrok/daemon.go b/cmd/zrok/agent.go similarity index 63% rename from cmd/zrok/daemon.go rename to cmd/zrok/agent.go index c2977b17..21331699 100644 --- a/cmd/zrok/daemon.go +++ b/cmd/zrok/agent.go @@ -7,25 +7,25 @@ import ( ) func init() { - rootCmd.AddCommand(newDaemonCommand().cmd) + rootCmd.AddCommand(newAgentCommand().cmd) } -type daemonCommand struct { +type agentCommand struct { cmd *cobra.Command } -func newDaemonCommand() *daemonCommand { +func newAgentCommand() *agentCommand { cmd := &cobra.Command{ - Use: "daemon", - Short: "Launch a zrok daemon", + Use: "agent", + Short: "Launch a zrok agent", Args: cobra.NoArgs, } - command := &daemonCommand{cmd: cmd} + command := &agentCommand{cmd: cmd} cmd.Run = command.run return command } -func (cmd *daemonCommand) run(_ *cobra.Command, _ []string) { +func (cmd *agentCommand) run(_ *cobra.Command, _ []string) { root, err := environment.LoadRoot() if err != nil { tui.Error("error loading zrokdir", err) From bd0f2d7430a995e18adcfec43a8a3e9ce54d7318 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 23 Aug 2024 11:31:46 -0400 Subject: [PATCH 04/51] grpc infrastructure (#463) --- agent/grpc.go | 14 ++ agent/grpc/agent.pb.go | 199 ++++++++++++++++++++++++ agent/grpc/agent.proto | 12 ++ agent/grpc/agent/grpc/agent.pb.go | 200 +++++++++++++++++++++++++ agent/grpc/agent/grpc/agent_grpc.pb.go | 121 +++++++++++++++ agent/grpc/agent_grpc.pb.go | 121 +++++++++++++++ bin/generate_pb.sh | 7 + 7 files changed, 674 insertions(+) create mode 100644 agent/grpc.go create mode 100644 agent/grpc/agent.pb.go create mode 100644 agent/grpc/agent.proto create mode 100644 agent/grpc/agent/grpc/agent.pb.go create mode 100644 agent/grpc/agent/grpc/agent_grpc.pb.go create mode 100644 agent/grpc/agent_grpc.pb.go create mode 100755 bin/generate_pb.sh diff --git a/agent/grpc.go b/agent/grpc.go new file mode 100644 index 00000000..7f6cc892 --- /dev/null +++ b/agent/grpc.go @@ -0,0 +1,14 @@ +package agent + +import ( + "context" + "github.com/openziti/zrok/agent/grpc" + "github.com/prometheus/common/version" +) + +type grpcServer struct { +} + +func (s *grpcServer) Version(ctx context.Context, req *grpc.VersionRequest) (*grpc.VersionReply, error) { + return &grpc.VersionReply{V: &version.Version}, nil +} diff --git a/agent/grpc/agent.pb.go b/agent/grpc/agent.pb.go new file mode 100644 index 00000000..78aa436c --- /dev/null +++ b/agent/grpc/agent.pb.go @@ -0,0 +1,199 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc v5.27.3 +// source: agent.proto + +package grpc + +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) +) + +type VersionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *VersionRequest) Reset() { + *x = VersionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VersionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VersionRequest) ProtoMessage() {} + +func (x *VersionRequest) ProtoReflect() protoreflect.Message { + mi := &file_agent_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 VersionRequest.ProtoReflect.Descriptor instead. +func (*VersionRequest) Descriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{0} +} + +type VersionReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + V *string `protobuf:"bytes,1,req,name=v" json:"v,omitempty"` +} + +func (x *VersionReply) Reset() { + *x = VersionReply{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VersionReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VersionReply) ProtoMessage() {} + +func (x *VersionReply) ProtoReflect() protoreflect.Message { + mi := &file_agent_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 VersionReply.ProtoReflect.Descriptor instead. +func (*VersionReply) Descriptor() ([]byte, []int) { + return file_agent_proto_rawDescGZIP(), []int{1} +} + +func (x *VersionReply) GetV() string { + if x != nil && x.V != nil { + return *x.V + } + return "" +} + +var File_agent_proto protoreflect.FileDescriptor + +var file_agent_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x10, 0x0a, + 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, + 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, + 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0x34, 0x0a, + 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x22, 0x00, 0x42, 0x25, 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, + 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, +} + +var ( + file_agent_proto_rawDescOnce sync.Once + file_agent_proto_rawDescData = file_agent_proto_rawDesc +) + +func file_agent_proto_rawDescGZIP() []byte { + file_agent_proto_rawDescOnce.Do(func() { + file_agent_proto_rawDescData = protoimpl.X.CompressGZIP(file_agent_proto_rawDescData) + }) + return file_agent_proto_rawDescData +} + +var file_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_agent_proto_goTypes = []any{ + (*VersionRequest)(nil), // 0: VersionRequest + (*VersionReply)(nil), // 1: VersionReply +} +var file_agent_proto_depIdxs = []int32{ + 0, // 0: Agent.Version:input_type -> VersionRequest + 1, // 1: Agent.Version:output_type -> VersionReply + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_agent_proto_init() } +func file_agent_proto_init() { + if File_agent_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_agent_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*VersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*VersionReply); 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_agent_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_agent_proto_goTypes, + DependencyIndexes: file_agent_proto_depIdxs, + MessageInfos: file_agent_proto_msgTypes, + }.Build() + File_agent_proto = out.File + file_agent_proto_rawDesc = nil + file_agent_proto_goTypes = nil + file_agent_proto_depIdxs = nil +} diff --git a/agent/grpc/agent.proto b/agent/grpc/agent.proto new file mode 100644 index 00000000..2a088372 --- /dev/null +++ b/agent/grpc/agent.proto @@ -0,0 +1,12 @@ +option go_package = "github.com/openziti/zrok/agent/grpc"; + +service Agent { + rpc Version(VersionRequest) returns (VersionReply) {} +} + +message VersionRequest { +} + +message VersionReply { + required string v = 1; +} diff --git a/agent/grpc/agent/grpc/agent.pb.go b/agent/grpc/agent/grpc/agent.pb.go new file mode 100644 index 00000000..3fb18638 --- /dev/null +++ b/agent/grpc/agent/grpc/agent.pb.go @@ -0,0 +1,200 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc v5.27.3 +// source: agent/grpc/agent.proto + +package grpc + +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) +) + +type VersionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *VersionRequest) Reset() { + *x = VersionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_grpc_agent_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VersionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VersionRequest) ProtoMessage() {} + +func (x *VersionRequest) ProtoReflect() protoreflect.Message { + mi := &file_agent_grpc_agent_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 VersionRequest.ProtoReflect.Descriptor instead. +func (*VersionRequest) Descriptor() ([]byte, []int) { + return file_agent_grpc_agent_proto_rawDescGZIP(), []int{0} +} + +type VersionReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + V *string `protobuf:"bytes,1,req,name=v" json:"v,omitempty"` +} + +func (x *VersionReply) Reset() { + *x = VersionReply{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_grpc_agent_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VersionReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VersionReply) ProtoMessage() {} + +func (x *VersionReply) ProtoReflect() protoreflect.Message { + mi := &file_agent_grpc_agent_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 VersionReply.ProtoReflect.Descriptor instead. +func (*VersionReply) Descriptor() ([]byte, []int) { + return file_agent_grpc_agent_proto_rawDescGZIP(), []int{1} +} + +func (x *VersionReply) GetV() string { + if x != nil && x.V != nil { + return *x.V + } + return "" +} + +var File_agent_grpc_agent_proto protoreflect.FileDescriptor + +var file_agent_grpc_agent_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x61, 0x67, 0x65, + 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x10, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x0c, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, + 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0x34, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, + 0x74, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x25, + 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, + 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, + 0x2f, 0x67, 0x72, 0x70, 0x63, +} + +var ( + file_agent_grpc_agent_proto_rawDescOnce sync.Once + file_agent_grpc_agent_proto_rawDescData = file_agent_grpc_agent_proto_rawDesc +) + +func file_agent_grpc_agent_proto_rawDescGZIP() []byte { + file_agent_grpc_agent_proto_rawDescOnce.Do(func() { + file_agent_grpc_agent_proto_rawDescData = protoimpl.X.CompressGZIP(file_agent_grpc_agent_proto_rawDescData) + }) + return file_agent_grpc_agent_proto_rawDescData +} + +var file_agent_grpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_agent_grpc_agent_proto_goTypes = []any{ + (*VersionRequest)(nil), // 0: VersionRequest + (*VersionReply)(nil), // 1: VersionReply +} +var file_agent_grpc_agent_proto_depIdxs = []int32{ + 0, // 0: Agent.Version:input_type -> VersionRequest + 1, // 1: Agent.Version:output_type -> VersionReply + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_agent_grpc_agent_proto_init() } +func file_agent_grpc_agent_proto_init() { + if File_agent_grpc_agent_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_agent_grpc_agent_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*VersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_grpc_agent_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*VersionReply); 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_agent_grpc_agent_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_agent_grpc_agent_proto_goTypes, + DependencyIndexes: file_agent_grpc_agent_proto_depIdxs, + MessageInfos: file_agent_grpc_agent_proto_msgTypes, + }.Build() + File_agent_grpc_agent_proto = out.File + file_agent_grpc_agent_proto_rawDesc = nil + file_agent_grpc_agent_proto_goTypes = nil + file_agent_grpc_agent_proto_depIdxs = nil +} diff --git a/agent/grpc/agent/grpc/agent_grpc.pb.go b/agent/grpc/agent/grpc/agent_grpc.pb.go new file mode 100644 index 00000000..f5b11faa --- /dev/null +++ b/agent/grpc/agent/grpc/agent_grpc.pb.go @@ -0,0 +1,121 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.27.3 +// source: agent/grpc/agent.proto + +package grpc + +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 ( + Agent_Version_FullMethodName = "/Agent/Version" +) + +// AgentClient is the client API for Agent 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. +type AgentClient interface { + Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionReply, error) +} + +type agentClient struct { + cc grpc.ClientConnInterface +} + +func NewAgentClient(cc grpc.ClientConnInterface) AgentClient { + return &agentClient{cc} +} + +func (c *agentClient) Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(VersionReply) + err := c.cc.Invoke(ctx, Agent_Version_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AgentServer is the server API for Agent service. +// All implementations must embed UnimplementedAgentServer +// for forward compatibility. +type AgentServer interface { + Version(context.Context, *VersionRequest) (*VersionReply, error) + mustEmbedUnimplementedAgentServer() +} + +// UnimplementedAgentServer 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 UnimplementedAgentServer struct{} + +func (UnimplementedAgentServer) Version(context.Context, *VersionRequest) (*VersionReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method Version not implemented") +} +func (UnimplementedAgentServer) mustEmbedUnimplementedAgentServer() {} +func (UnimplementedAgentServer) testEmbeddedByValue() {} + +// UnsafeAgentServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AgentServer will +// result in compilation errors. +type UnsafeAgentServer interface { + mustEmbedUnimplementedAgentServer() +} + +func RegisterAgentServer(s grpc.ServiceRegistrar, srv AgentServer) { + // If the following call pancis, it indicates UnimplementedAgentServer 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(&Agent_ServiceDesc, srv) +} + +func _Agent_Version_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VersionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AgentServer).Version(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Agent_Version_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AgentServer).Version(ctx, req.(*VersionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Agent_ServiceDesc is the grpc.ServiceDesc for Agent service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Agent_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "Agent", + HandlerType: (*AgentServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Version", + Handler: _Agent_Version_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "agent/grpc/agent.proto", +} diff --git a/agent/grpc/agent_grpc.pb.go b/agent/grpc/agent_grpc.pb.go new file mode 100644 index 00000000..fa72a855 --- /dev/null +++ b/agent/grpc/agent_grpc.pb.go @@ -0,0 +1,121 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.27.3 +// source: agent.proto + +package grpc + +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 ( + Agent_Version_FullMethodName = "/Agent/Version" +) + +// AgentClient is the client API for Agent 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. +type AgentClient interface { + Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionReply, error) +} + +type agentClient struct { + cc grpc.ClientConnInterface +} + +func NewAgentClient(cc grpc.ClientConnInterface) AgentClient { + return &agentClient{cc} +} + +func (c *agentClient) Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(VersionReply) + err := c.cc.Invoke(ctx, Agent_Version_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// AgentServer is the server API for Agent service. +// All implementations must embed UnimplementedAgentServer +// for forward compatibility. +type AgentServer interface { + Version(context.Context, *VersionRequest) (*VersionReply, error) + mustEmbedUnimplementedAgentServer() +} + +// UnimplementedAgentServer 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 UnimplementedAgentServer struct{} + +func (UnimplementedAgentServer) Version(context.Context, *VersionRequest) (*VersionReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method Version not implemented") +} +func (UnimplementedAgentServer) mustEmbedUnimplementedAgentServer() {} +func (UnimplementedAgentServer) testEmbeddedByValue() {} + +// UnsafeAgentServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to AgentServer will +// result in compilation errors. +type UnsafeAgentServer interface { + mustEmbedUnimplementedAgentServer() +} + +func RegisterAgentServer(s grpc.ServiceRegistrar, srv AgentServer) { + // If the following call pancis, it indicates UnimplementedAgentServer 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(&Agent_ServiceDesc, srv) +} + +func _Agent_Version_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VersionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AgentServer).Version(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Agent_Version_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AgentServer).Version(ctx, req.(*VersionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Agent_ServiceDesc is the grpc.ServiceDesc for Agent service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Agent_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "Agent", + HandlerType: (*AgentServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Version", + Handler: _Agent_Version_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "agent.proto", +} diff --git a/bin/generate_pb.sh b/bin/generate_pb.sh new file mode 100755 index 00000000..722edca6 --- /dev/null +++ b/bin/generate_pb.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +protoc --go_out=agent/grpc \ + --go_opt=paths=source_relative \ + --go-grpc_out=agent/grpc \ + --go-grpc_opt=paths=source_relative \ + agent/grpc/agent.proto From 95098e6357d392258553015316e53c90a5b2108e Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 23 Aug 2024 12:05:05 -0400 Subject: [PATCH 05/51] roughed in grpc infrastructure for agent (#463) --- agent/agent.go | 40 +++++++++++++++++++++++++++++++---- agent/grpc.go | 6 ++++-- cmd/zrok/agent.go | 10 +++++++++ environment/env_core/model.go | 2 ++ environment/env_v0_3/api.go | 4 ++++ environment/env_v0_4/api.go | 4 ++++ environment/env_v0_4/dirs.go | 8 +++++++ go.mod | 14 ++++++------ go.sum | 13 ++++++++++-- 9 files changed, 86 insertions(+), 15 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index 12a1d727..68aa1959 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -1,13 +1,45 @@ package agent -type Daemon struct { +import ( + agentGrpc "github.com/openziti/zrok/agent/grpc" + "github.com/openziti/zrok/environment/env_core" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" + "google.golang.org/grpc" + "net" +) + +type Agent struct { + root env_core.Root shares map[string]*share accesses map[string]*access } -func NewDaemon() *Daemon { - return &Daemon{ +func NewAgent(root env_core.Root) (*Agent, error) { + if !root.IsEnabled() { + return nil, errors.Errorf("unable to load environment; did you 'zrok enable'?") + } + return &Agent{ + root: root, shares: make(map[string]*share), accesses: make(map[string]*access), - } + }, nil +} + +func (a *Agent) Run() error { + logrus.Infof("started") + agentSocket, err := a.root.AgentSocket() + if err != nil { + return err + } + l, err := net.Listen("unix", agentSocket) + if err != nil { + return err + } + srv := grpc.NewServer() + agentGrpc.RegisterAgentServer(srv, &agentGrpcImpl{}) + if err := srv.Serve(l); err != nil { + return err + } + return nil } diff --git a/agent/grpc.go b/agent/grpc.go index 7f6cc892..12b9da0d 100644 --- a/agent/grpc.go +++ b/agent/grpc.go @@ -4,11 +4,13 @@ import ( "context" "github.com/openziti/zrok/agent/grpc" "github.com/prometheus/common/version" + _ "google.golang.org/grpc" ) -type grpcServer struct { +type agentGrpcImpl struct { + grpc.UnimplementedAgentServer } -func (s *grpcServer) Version(ctx context.Context, req *grpc.VersionRequest) (*grpc.VersionReply, error) { +func (s *agentGrpcImpl) Version(ctx context.Context, req *grpc.VersionRequest) (*grpc.VersionReply, error) { return &grpc.VersionReply{V: &version.Version}, nil } diff --git a/cmd/zrok/agent.go b/cmd/zrok/agent.go index 21331699..8cc6bd04 100644 --- a/cmd/zrok/agent.go +++ b/cmd/zrok/agent.go @@ -1,6 +1,7 @@ package main import ( + "github.com/openziti/zrok/agent" "github.com/openziti/zrok/environment" "github.com/openziti/zrok/tui" "github.com/spf13/cobra" @@ -34,4 +35,13 @@ func (cmd *agentCommand) run(_ *cobra.Command, _ []string) { if !root.IsEnabled() { tui.Error("unable to load environment; did you 'zrok enable'?", nil) } + + a, err := agent.NewAgent(root) + if err != nil { + tui.Error("error creating agent", err) + } + + if err := a.Run(); err != nil { + tui.Error("agent aborted", err) + } } diff --git a/environment/env_core/model.go b/environment/env_core/model.go index ebb1df34..de3eeb70 100644 --- a/environment/env_core/model.go +++ b/environment/env_core/model.go @@ -26,6 +26,8 @@ type Root interface { ZitiIdentityNamed(name string) (string, error) SaveZitiIdentityNamed(name, data string) error DeleteZitiIdentityNamed(name string) error + + AgentSocket() (string, error) } type Environment struct { diff --git a/environment/env_v0_3/api.go b/environment/env_v0_3/api.go index 61a03296..c4a0a090 100644 --- a/environment/env_v0_3/api.go +++ b/environment/env_v0_3/api.go @@ -174,6 +174,10 @@ func (r *Root) DeleteZitiIdentityNamed(name string) error { return nil } +func (r *Root) AgentSocket() (string, error) { + return "", errors.Errorf("this environment version does not support agent sockets; please 'zrok update' this environment") +} + func (r *Root) Obliterate() error { zrd, err := rootDir() if err != nil { diff --git a/environment/env_v0_4/api.go b/environment/env_v0_4/api.go index 35db06c5..e2123197 100644 --- a/environment/env_v0_4/api.go +++ b/environment/env_v0_4/api.go @@ -174,6 +174,10 @@ func (r *Root) DeleteZitiIdentityNamed(name string) error { return nil } +func (r *Root) AgentSocket() (string, error) { + return agentSocket() +} + func (r *Root) Obliterate() error { zrd, err := rootDir() if err != nil { diff --git a/environment/env_v0_4/dirs.go b/environment/env_v0_4/dirs.go index b259fe09..bf18febf 100644 --- a/environment/env_v0_4/dirs.go +++ b/environment/env_v0_4/dirs.go @@ -53,3 +53,11 @@ func identityFile(name string) (string, error) { } return filepath.Join(idd, fmt.Sprintf("%v.json", name)), nil } + +func agentSocket() (string, error) { + zrd, err := rootDir() + if err != nil { + return "", err + } + return filepath.Join(zrd, "agent.socket"), nil +} diff --git a/go.mod b/go.mod index 5878ee29..fa13c060 100644 --- a/go.mod +++ b/go.mod @@ -43,6 +43,7 @@ require ( github.com/openziti/transport/v2 v2.0.138 github.com/orcaman/concurrent-map/v2 v2.0.1 github.com/pkg/errors v0.9.1 + github.com/prometheus/common v0.45.0 github.com/rabbitmq/amqp091-go v1.8.1 github.com/rubenv/sql-migrate v1.6.0 github.com/shirou/gopsutil/v3 v3.24.5 @@ -57,6 +58,8 @@ require ( golang.org/x/net v0.27.0 golang.org/x/oauth2 v0.21.0 golang.org/x/time v0.5.0 + google.golang.org/grpc v1.65.0 + google.golang.org/protobuf v1.34.2 nhooyr.io/websocket v1.8.11 ) @@ -84,7 +87,7 @@ require ( github.com/caddyserver/certmagic v0.20.0 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/containerd/console v1.0.3 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect @@ -125,7 +128,7 @@ require ( github.com/gobwas/pool v0.2.1 // indirect github.com/gobwas/ws v1.2.1 // indirect github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/golang/glog v1.2.0 // indirect + github.com/golang/glog v1.2.1 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/cel-go v0.15.1 // indirect @@ -194,7 +197,6 @@ require ( github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect github.com/prometheus/client_golang v1.17.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/quic-go/qpack v0.4.0 // indirect github.com/quic-go/qtls-go1-20 v0.4.1 // indirect @@ -259,10 +261,8 @@ require ( golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect golang.zx2c4.com/wireguard v0.0.0-20220703234212-c31a7b1ab478 // indirect golang.zx2c4.com/wireguard/windows v0.5.3 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231127180814-3a041ad873d4 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect - google.golang.org/grpc v1.59.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/square/go-jose.v2 v2.6.0 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect diff --git a/go.sum b/go.sum index e8bcedf7..6c4f0bf6 100644 --- a/go.sum +++ b/go.sum @@ -121,6 +121,8 @@ github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghf github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charmbracelet/bubbles v0.14.0 h1:DJfCwnARfWjZLvMglhSQzo76UZ2gucuHPy9jLWX45Og= github.com/charmbracelet/bubbles v0.14.0/go.mod h1:bbeTiXwPww4M031aGi8UK2HT9RDWoiNibae+1yCMtcc= github.com/charmbracelet/bubbletea v0.21.0/go.mod h1:GgmJMec61d08zXsOhqRC/AiOx4K4pmz+VIcRIm1FKr4= @@ -301,6 +303,8 @@ github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVI github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= +github.com/golang/glog v1.2.1 h1:OptwRhECazUx5ix5TTWC3EZhsZEHWcYWY4FQHTIubm4= +github.com/golang/glog v1.2.1/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -961,8 +965,6 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 h1:tIqhe go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0/go.mod h1:nUeKExfxAQVbiVFn32YXpXZZHZ61Cc3s3Rn1pDBGAb0= go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= -go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= -go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= go.opentelemetry.io/otel/sdk v1.28.0 h1:b9d7hIry8yZsgtbmM0DKyPWMMUMlK9NEKuIG4aBqWyE= go.opentelemetry.io/otel/sdk v1.28.0/go.mod h1:oYj7ClPUA7Iw3m+r7GeEjz0qckQRJK2B8zjcZEfu7Pg= go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= @@ -1402,12 +1404,17 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ= google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f h1:Vn+VyHU5guc9KjB5KrjI2q0wCOWEOIh0OEsleqakHJg= google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f/go.mod h1:nWSwAFPb+qfNJXsoeO3Io7zf4tMSfN8EA8RlDA04GhY= google.golang.org/genproto/googleapis/api v0.0.0-20231127180814-3a041ad873d4 h1:ZcOkrmX74HbKFYnpPY8Qsw93fC29TbJXspYKaBkSXDQ= google.golang.org/genproto/googleapis/api v0.0.0-20231127180814-3a041ad873d4/go.mod h1:k2dtGpRrbsSyKcNPKKI5sstZkrNCZwpU/ns96JoHbGg= +google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= +google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 h1:DC7wcm+i+P1rN3Ff07vL+OndGg5OhNddHyTA+ocPqYE= google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4/go.mod h1:eJVxU6o+4G1PSczBr85xmyvSNYAKvAYgkub40YGomFM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1430,6 +1437,8 @@ google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From 3c310c27db627f859ba9eb9fdc31449baff8379a Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 23 Aug 2024 12:12:57 -0400 Subject: [PATCH 06/51] 'zrok agent' -> 'zrok agent start' (#463) --- cmd/zrok/agent.go | 12 ++++++------ cmd/zrok/main.go | 7 +++++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/cmd/zrok/agent.go b/cmd/zrok/agent.go index 8cc6bd04..1a040864 100644 --- a/cmd/zrok/agent.go +++ b/cmd/zrok/agent.go @@ -8,25 +8,25 @@ import ( ) func init() { - rootCmd.AddCommand(newAgentCommand().cmd) + agentCmd.AddCommand(newAgentStartCommand().cmd) } -type agentCommand struct { +type agentStartCommand struct { cmd *cobra.Command } -func newAgentCommand() *agentCommand { +func newAgentStartCommand() *agentStartCommand { cmd := &cobra.Command{ - Use: "agent", + Use: "start", Short: "Launch a zrok agent", Args: cobra.NoArgs, } - command := &agentCommand{cmd: cmd} + command := &agentStartCommand{cmd: cmd} cmd.Run = command.run return command } -func (cmd *agentCommand) run(_ *cobra.Command, _ []string) { +func (cmd *agentStartCommand) run(_ *cobra.Command, _ []string) { root, err := environment.LoadRoot() if err != nil { tui.Error("error loading zrokdir", err) diff --git a/cmd/zrok/main.go b/cmd/zrok/main.go index 750c71da..9fe7eb4a 100644 --- a/cmd/zrok/main.go +++ b/cmd/zrok/main.go @@ -23,6 +23,7 @@ func init() { adminCmd.AddCommand(adminDeleteCmd) adminCmd.AddCommand(adminListCmd) adminCmd.AddCommand(adminUpdateCmd) + rootCmd.AddCommand(agentCmd) testCmd.AddCommand(loopCmd) rootCmd.AddCommand(adminCmd) rootCmd.AddCommand(configCmd) @@ -75,6 +76,12 @@ var adminUpdateCmd = &cobra.Command{ Short: "Update global resources", } +var agentCmd = &cobra.Command{ + Use: "agent", + Short: "zrok Agent commands", + Aliases: []string{"daemon"}, +} + var configCmd = &cobra.Command{ Use: "config", Short: "Configure your zrok environment", From 896125d25d3b853a05bd7cc275292f0041aa456a Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 23 Aug 2024 12:27:20 -0400 Subject: [PATCH 07/51] version client (#463) --- agent/grpc.go | 5 ++- cmd/zrok/{agent.go => agentStart.go} | 2 +- cmd/zrok/agentVersion.go | 56 ++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 3 deletions(-) rename cmd/zrok/{agent.go => agentStart.go} (96%) create mode 100644 cmd/zrok/agentVersion.go diff --git a/agent/grpc.go b/agent/grpc.go index 12b9da0d..652b55df 100644 --- a/agent/grpc.go +++ b/agent/grpc.go @@ -3,7 +3,7 @@ package agent import ( "context" "github.com/openziti/zrok/agent/grpc" - "github.com/prometheus/common/version" + "github.com/openziti/zrok/build" _ "google.golang.org/grpc" ) @@ -12,5 +12,6 @@ type agentGrpcImpl struct { } func (s *agentGrpcImpl) Version(ctx context.Context, req *grpc.VersionRequest) (*grpc.VersionReply, error) { - return &grpc.VersionReply{V: &version.Version}, nil + v := build.String() + return &grpc.VersionReply{V: &v}, nil } diff --git a/cmd/zrok/agent.go b/cmd/zrok/agentStart.go similarity index 96% rename from cmd/zrok/agent.go rename to cmd/zrok/agentStart.go index 1a040864..698863b2 100644 --- a/cmd/zrok/agent.go +++ b/cmd/zrok/agentStart.go @@ -18,7 +18,7 @@ type agentStartCommand struct { func newAgentStartCommand() *agentStartCommand { cmd := &cobra.Command{ Use: "start", - Short: "Launch a zrok agent", + Short: "Start a zrok agent", Args: cobra.NoArgs, } command := &agentStartCommand{cmd: cmd} diff --git a/cmd/zrok/agentVersion.go b/cmd/zrok/agentVersion.go new file mode 100644 index 00000000..cc4cc3cc --- /dev/null +++ b/cmd/zrok/agentVersion.go @@ -0,0 +1,56 @@ +package main + +import ( + "context" + grpc2 "github.com/openziti/zrok/agent/grpc" + "github.com/openziti/zrok/environment" + "github.com/openziti/zrok/tui" + "github.com/spf13/cobra" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" +) + +func init() { + agentCmd.AddCommand(newAgentVersionCommand().cmd) +} + +type agentVersionCommand struct { + cmd *cobra.Command +} + +func newAgentVersionCommand() *agentVersionCommand { + cmd := &cobra.Command{ + Use: "version", + Short: "Retrieve the running zrok Agent version", + Args: cobra.NoArgs, + } + command := &agentVersionCommand{cmd: cmd} + cmd.Run = command.run + return command +} + +func (cmd *agentVersionCommand) run(_ *cobra.Command, _ []string) { + root, err := environment.LoadRoot() + if err != nil { + tui.Error("error loading zrokdir", err) + } + + agentSocket, err := root.AgentSocket() + if err != nil { + tui.Error("error getting agent socket", err) + } + + conn, err := grpc.NewClient("unix://"+agentSocket, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + tui.Error("error connecting to agent socket", err) + } + defer conn.Close() + client := grpc2.NewAgentClient(conn) + + v, err := client.Version(context.Background(), &grpc2.VersionRequest{}) + if err != nil { + tui.Error("error getting agent version", err) + } + + println(*v.V) +} From 23796be138e23ee6637cba84a7448f331f5767d1 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 23 Aug 2024 12:31:02 -0400 Subject: [PATCH 08/51] package naming housekeeping (#463) --- agent/agent.go | 2 +- agent/{grpc => agentGrpc}/agent.pb.go | 71 ++++---- agent/{grpc => agentGrpc}/agent.proto | 2 +- agent/{grpc => agentGrpc}/agent_grpc.pb.go | 6 +- agent/grpc.go | 9 +- agent/grpc/agent/grpc/agent.pb.go | 200 --------------------- agent/grpc/agent/grpc/agent_grpc.pb.go | 121 ------------- bin/generate_pb.sh | 6 +- cmd/zrok/agentVersion.go | 2 +- 9 files changed, 49 insertions(+), 370 deletions(-) rename agent/{grpc => agentGrpc}/agent.pb.go (65%) rename agent/{grpc => agentGrpc}/agent.proto (70%) rename agent/{grpc => agentGrpc}/agent_grpc.pb.go (97%) delete mode 100644 agent/grpc/agent/grpc/agent.pb.go delete mode 100644 agent/grpc/agent/grpc/agent_grpc.pb.go diff --git a/agent/agent.go b/agent/agent.go index 68aa1959..246e5a3b 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -1,7 +1,7 @@ package agent import ( - agentGrpc "github.com/openziti/zrok/agent/grpc" + "github.com/openziti/zrok/agent/agentGrpc" "github.com/openziti/zrok/environment/env_core" "github.com/pkg/errors" "github.com/sirupsen/logrus" diff --git a/agent/grpc/agent.pb.go b/agent/agentGrpc/agent.pb.go similarity index 65% rename from agent/grpc/agent.pb.go rename to agent/agentGrpc/agent.pb.go index 78aa436c..cf170e81 100644 --- a/agent/grpc/agent.pb.go +++ b/agent/agentGrpc/agent.pb.go @@ -2,9 +2,9 @@ // versions: // protoc-gen-go v1.34.2 // protoc v5.27.3 -// source: agent.proto +// source: agent/agentGrpc/agent.proto -package grpc +package agentGrpc import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -29,7 +29,7 @@ type VersionRequest struct { func (x *VersionRequest) Reset() { *x = VersionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_proto_msgTypes[0] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -42,7 +42,7 @@ func (x *VersionRequest) String() string { func (*VersionRequest) ProtoMessage() {} func (x *VersionRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_proto_msgTypes[0] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -55,7 +55,7 @@ func (x *VersionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionRequest.ProtoReflect.Descriptor instead. func (*VersionRequest) Descriptor() ([]byte, []int) { - return file_agent_proto_rawDescGZIP(), []int{0} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{0} } type VersionReply struct { @@ -69,7 +69,7 @@ type VersionReply struct { func (x *VersionReply) Reset() { *x = VersionReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_proto_msgTypes[1] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -82,7 +82,7 @@ func (x *VersionReply) String() string { func (*VersionReply) ProtoMessage() {} func (x *VersionReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_proto_msgTypes[1] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -95,7 +95,7 @@ func (x *VersionReply) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionReply.ProtoReflect.Descriptor instead. func (*VersionReply) Descriptor() ([]byte, []int) { - return file_agent_proto_rawDescGZIP(), []int{1} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{1} } func (x *VersionReply) GetV() string { @@ -105,39 +105,40 @@ func (x *VersionReply) GetV() string { return "" } -var File_agent_proto protoreflect.FileDescriptor +var File_agent_agentGrpc_agent_proto protoreflect.FileDescriptor -var file_agent_proto_rawDesc = []byte{ - 0x0a, 0x0b, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x10, 0x0a, +var file_agent_agentGrpc_agent_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, + 0x63, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x10, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0x34, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x22, 0x00, 0x42, 0x25, 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, - 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, + 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, } var ( - file_agent_proto_rawDescOnce sync.Once - file_agent_proto_rawDescData = file_agent_proto_rawDesc + file_agent_agentGrpc_agent_proto_rawDescOnce sync.Once + file_agent_agentGrpc_agent_proto_rawDescData = file_agent_agentGrpc_agent_proto_rawDesc ) -func file_agent_proto_rawDescGZIP() []byte { - file_agent_proto_rawDescOnce.Do(func() { - file_agent_proto_rawDescData = protoimpl.X.CompressGZIP(file_agent_proto_rawDescData) +func file_agent_agentGrpc_agent_proto_rawDescGZIP() []byte { + file_agent_agentGrpc_agent_proto_rawDescOnce.Do(func() { + file_agent_agentGrpc_agent_proto_rawDescData = protoimpl.X.CompressGZIP(file_agent_agentGrpc_agent_proto_rawDescData) }) - return file_agent_proto_rawDescData + return file_agent_agentGrpc_agent_proto_rawDescData } -var file_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_agent_proto_goTypes = []any{ +var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_agent_agentGrpc_agent_proto_goTypes = []any{ (*VersionRequest)(nil), // 0: VersionRequest (*VersionReply)(nil), // 1: VersionReply } -var file_agent_proto_depIdxs = []int32{ +var file_agent_agentGrpc_agent_proto_depIdxs = []int32{ 0, // 0: Agent.Version:input_type -> VersionRequest 1, // 1: Agent.Version:output_type -> VersionReply 1, // [1:2] is the sub-list for method output_type @@ -147,13 +148,13 @@ var file_agent_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_agent_proto_init() } -func file_agent_proto_init() { - if File_agent_proto != nil { +func init() { file_agent_agentGrpc_agent_proto_init() } +func file_agent_agentGrpc_agent_proto_init() { + if File_agent_agentGrpc_agent_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_agent_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_agent_agentGrpc_agent_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*VersionRequest); i { case 0: return &v.state @@ -165,7 +166,7 @@ func file_agent_proto_init() { return nil } } - file_agent_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_agent_agentGrpc_agent_proto_msgTypes[1].Exporter = func(v any, i int) any { switch v := v.(*VersionReply); i { case 0: return &v.state @@ -182,18 +183,18 @@ func file_agent_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_agent_proto_rawDesc, + RawDescriptor: file_agent_agentGrpc_agent_proto_rawDesc, NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_agent_proto_goTypes, - DependencyIndexes: file_agent_proto_depIdxs, - MessageInfos: file_agent_proto_msgTypes, + GoTypes: file_agent_agentGrpc_agent_proto_goTypes, + DependencyIndexes: file_agent_agentGrpc_agent_proto_depIdxs, + MessageInfos: file_agent_agentGrpc_agent_proto_msgTypes, }.Build() - File_agent_proto = out.File - file_agent_proto_rawDesc = nil - file_agent_proto_goTypes = nil - file_agent_proto_depIdxs = nil + File_agent_agentGrpc_agent_proto = out.File + file_agent_agentGrpc_agent_proto_rawDesc = nil + file_agent_agentGrpc_agent_proto_goTypes = nil + file_agent_agentGrpc_agent_proto_depIdxs = nil } diff --git a/agent/grpc/agent.proto b/agent/agentGrpc/agent.proto similarity index 70% rename from agent/grpc/agent.proto rename to agent/agentGrpc/agent.proto index 2a088372..e9add796 100644 --- a/agent/grpc/agent.proto +++ b/agent/agentGrpc/agent.proto @@ -1,4 +1,4 @@ -option go_package = "github.com/openziti/zrok/agent/grpc"; +option go_package = "github.com/openziti/zrok/agent/agentGrpc"; service Agent { rpc Version(VersionRequest) returns (VersionReply) {} diff --git a/agent/grpc/agent_grpc.pb.go b/agent/agentGrpc/agent_grpc.pb.go similarity index 97% rename from agent/grpc/agent_grpc.pb.go rename to agent/agentGrpc/agent_grpc.pb.go index fa72a855..397aa46c 100644 --- a/agent/grpc/agent_grpc.pb.go +++ b/agent/agentGrpc/agent_grpc.pb.go @@ -2,9 +2,9 @@ // versions: // - protoc-gen-go-grpc v1.5.1 // - protoc v5.27.3 -// source: agent.proto +// source: agent/agentGrpc/agent.proto -package grpc +package agentGrpc import ( context "context" @@ -117,5 +117,5 @@ var Agent_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "agent.proto", + Metadata: "agent/agentGrpc/agent.proto", } diff --git a/agent/grpc.go b/agent/grpc.go index 652b55df..cfa9863b 100644 --- a/agent/grpc.go +++ b/agent/grpc.go @@ -2,16 +2,15 @@ package agent import ( "context" - "github.com/openziti/zrok/agent/grpc" + "github.com/openziti/zrok/agent/agentGrpc" "github.com/openziti/zrok/build" - _ "google.golang.org/grpc" ) type agentGrpcImpl struct { - grpc.UnimplementedAgentServer + agentGrpc.UnimplementedAgentServer } -func (s *agentGrpcImpl) Version(ctx context.Context, req *grpc.VersionRequest) (*grpc.VersionReply, error) { +func (s *agentGrpcImpl) Version(ctx context.Context, req *agentGrpc.VersionRequest) (*agentGrpc.VersionReply, error) { v := build.String() - return &grpc.VersionReply{V: &v}, nil + return &agentGrpc.VersionReply{V: &v}, nil } diff --git a/agent/grpc/agent/grpc/agent.pb.go b/agent/grpc/agent/grpc/agent.pb.go deleted file mode 100644 index 3fb18638..00000000 --- a/agent/grpc/agent/grpc/agent.pb.go +++ /dev/null @@ -1,200 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.3 -// source: agent/grpc/agent.proto - -package grpc - -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) -) - -type VersionRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *VersionRequest) Reset() { - *x = VersionRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_agent_grpc_agent_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *VersionRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VersionRequest) ProtoMessage() {} - -func (x *VersionRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_grpc_agent_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 VersionRequest.ProtoReflect.Descriptor instead. -func (*VersionRequest) Descriptor() ([]byte, []int) { - return file_agent_grpc_agent_proto_rawDescGZIP(), []int{0} -} - -type VersionReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - V *string `protobuf:"bytes,1,req,name=v" json:"v,omitempty"` -} - -func (x *VersionReply) Reset() { - *x = VersionReply{} - if protoimpl.UnsafeEnabled { - mi := &file_agent_grpc_agent_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *VersionReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*VersionReply) ProtoMessage() {} - -func (x *VersionReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_grpc_agent_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 VersionReply.ProtoReflect.Descriptor instead. -func (*VersionReply) Descriptor() ([]byte, []int) { - return file_agent_grpc_agent_proto_rawDescGZIP(), []int{1} -} - -func (x *VersionReply) GetV() string { - if x != nil && x.V != nil { - return *x.V - } - return "" -} - -var File_agent_grpc_agent_proto protoreflect.FileDescriptor - -var file_agent_grpc_agent_proto_rawDesc = []byte{ - 0x0a, 0x16, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x61, 0x67, 0x65, - 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x10, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x0c, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, - 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0x34, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, - 0x74, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x25, - 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, - 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, - 0x2f, 0x67, 0x72, 0x70, 0x63, -} - -var ( - file_agent_grpc_agent_proto_rawDescOnce sync.Once - file_agent_grpc_agent_proto_rawDescData = file_agent_grpc_agent_proto_rawDesc -) - -func file_agent_grpc_agent_proto_rawDescGZIP() []byte { - file_agent_grpc_agent_proto_rawDescOnce.Do(func() { - file_agent_grpc_agent_proto_rawDescData = protoimpl.X.CompressGZIP(file_agent_grpc_agent_proto_rawDescData) - }) - return file_agent_grpc_agent_proto_rawDescData -} - -var file_agent_grpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_agent_grpc_agent_proto_goTypes = []any{ - (*VersionRequest)(nil), // 0: VersionRequest - (*VersionReply)(nil), // 1: VersionReply -} -var file_agent_grpc_agent_proto_depIdxs = []int32{ - 0, // 0: Agent.Version:input_type -> VersionRequest - 1, // 1: Agent.Version:output_type -> VersionReply - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_agent_grpc_agent_proto_init() } -func file_agent_grpc_agent_proto_init() { - if File_agent_grpc_agent_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_agent_grpc_agent_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*VersionRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_agent_grpc_agent_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*VersionReply); 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_agent_grpc_agent_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_agent_grpc_agent_proto_goTypes, - DependencyIndexes: file_agent_grpc_agent_proto_depIdxs, - MessageInfos: file_agent_grpc_agent_proto_msgTypes, - }.Build() - File_agent_grpc_agent_proto = out.File - file_agent_grpc_agent_proto_rawDesc = nil - file_agent_grpc_agent_proto_goTypes = nil - file_agent_grpc_agent_proto_depIdxs = nil -} diff --git a/agent/grpc/agent/grpc/agent_grpc.pb.go b/agent/grpc/agent/grpc/agent_grpc.pb.go deleted file mode 100644 index f5b11faa..00000000 --- a/agent/grpc/agent/grpc/agent_grpc.pb.go +++ /dev/null @@ -1,121 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.5.1 -// - protoc v5.27.3 -// source: agent/grpc/agent.proto - -package grpc - -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 ( - Agent_Version_FullMethodName = "/Agent/Version" -) - -// AgentClient is the client API for Agent 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. -type AgentClient interface { - Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionReply, error) -} - -type agentClient struct { - cc grpc.ClientConnInterface -} - -func NewAgentClient(cc grpc.ClientConnInterface) AgentClient { - return &agentClient{cc} -} - -func (c *agentClient) Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionReply, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(VersionReply) - err := c.cc.Invoke(ctx, Agent_Version_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// AgentServer is the server API for Agent service. -// All implementations must embed UnimplementedAgentServer -// for forward compatibility. -type AgentServer interface { - Version(context.Context, *VersionRequest) (*VersionReply, error) - mustEmbedUnimplementedAgentServer() -} - -// UnimplementedAgentServer 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 UnimplementedAgentServer struct{} - -func (UnimplementedAgentServer) Version(context.Context, *VersionRequest) (*VersionReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method Version not implemented") -} -func (UnimplementedAgentServer) mustEmbedUnimplementedAgentServer() {} -func (UnimplementedAgentServer) testEmbeddedByValue() {} - -// UnsafeAgentServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to AgentServer will -// result in compilation errors. -type UnsafeAgentServer interface { - mustEmbedUnimplementedAgentServer() -} - -func RegisterAgentServer(s grpc.ServiceRegistrar, srv AgentServer) { - // If the following call pancis, it indicates UnimplementedAgentServer 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(&Agent_ServiceDesc, srv) -} - -func _Agent_Version_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(VersionRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AgentServer).Version(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Agent_Version_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AgentServer).Version(ctx, req.(*VersionRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Agent_ServiceDesc is the grpc.ServiceDesc for Agent service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Agent_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "Agent", - HandlerType: (*AgentServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Version", - Handler: _Agent_Version_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "agent/grpc/agent.proto", -} diff --git a/bin/generate_pb.sh b/bin/generate_pb.sh index 722edca6..ed0af3ef 100755 --- a/bin/generate_pb.sh +++ b/bin/generate_pb.sh @@ -1,7 +1,7 @@ #!/bin/sh -protoc --go_out=agent/grpc \ +protoc --go_out=. \ --go_opt=paths=source_relative \ - --go-grpc_out=agent/grpc \ + --go-grpc_out=. \ --go-grpc_opt=paths=source_relative \ - agent/grpc/agent.proto + agent/agentGrpc/agent.proto diff --git a/cmd/zrok/agentVersion.go b/cmd/zrok/agentVersion.go index cc4cc3cc..fb9dacfa 100644 --- a/cmd/zrok/agentVersion.go +++ b/cmd/zrok/agentVersion.go @@ -2,7 +2,7 @@ package main import ( "context" - grpc2 "github.com/openziti/zrok/agent/grpc" + grpc2 "github.com/openziti/zrok/agent/agentGrpc" "github.com/openziti/zrok/environment" "github.com/openziti/zrok/tui" "github.com/spf13/cobra" From 3ba179673e6e5310e2e8992efec330ea56f12f62 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 23 Aug 2024 12:35:19 -0400 Subject: [PATCH 09/51] shutdown hook to clean up agent at exit (#463) --- agent/agent.go | 18 +++++++++++++++--- cmd/zrok/agentStart.go | 15 +++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index 246e5a3b..2d01211d 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -7,12 +7,14 @@ import ( "github.com/sirupsen/logrus" "google.golang.org/grpc" "net" + "os" ) type Agent struct { - root env_core.Root - shares map[string]*share - accesses map[string]*access + root env_core.Root + agentSocket string + shares map[string]*share + accesses map[string]*access } func NewAgent(root env_core.Root) (*Agent, error) { @@ -28,6 +30,7 @@ func NewAgent(root env_core.Root) (*Agent, error) { func (a *Agent) Run() error { logrus.Infof("started") + agentSocket, err := a.root.AgentSocket() if err != nil { return err @@ -36,10 +39,19 @@ func (a *Agent) Run() error { if err != nil { return err } + a.agentSocket = agentSocket + srv := grpc.NewServer() agentGrpc.RegisterAgentServer(srv, &agentGrpcImpl{}) if err := srv.Serve(l); err != nil { return err } + return nil } + +func (a *Agent) Shutdown() { + if err := os.Remove(a.agentSocket); err != nil { + logrus.Warnf("unable to remove agent socket: %v", err) + } +} diff --git a/cmd/zrok/agentStart.go b/cmd/zrok/agentStart.go index 698863b2..3c3c651d 100644 --- a/cmd/zrok/agentStart.go +++ b/cmd/zrok/agentStart.go @@ -5,6 +5,9 @@ import ( "github.com/openziti/zrok/environment" "github.com/openziti/zrok/tui" "github.com/spf13/cobra" + "os" + "os/signal" + "syscall" ) func init() { @@ -41,7 +44,19 @@ func (cmd *agentStartCommand) run(_ *cobra.Command, _ []string) { tui.Error("error creating agent", err) } + c := make(chan os.Signal) + signal.Notify(c, os.Interrupt, syscall.SIGTERM) + go func() { + <-c + cmd.shutdown(a) + os.Exit(0) + }() + if err := a.Run(); err != nil { tui.Error("agent aborted", err) } } + +func (cmd *agentStartCommand) shutdown(a *agent.Agent) { + a.Shutdown() +} From d8c9681da1ce52bc5718c21ef5c644f834217600 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 23 Aug 2024 12:41:13 -0400 Subject: [PATCH 10/51] tweak (#463) --- agent/{grpc.go => grpcImpl.go} | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) rename agent/{grpc.go => grpcImpl.go} (54%) diff --git a/agent/grpc.go b/agent/grpcImpl.go similarity index 54% rename from agent/grpc.go rename to agent/grpcImpl.go index cfa9863b..e0c31083 100644 --- a/agent/grpc.go +++ b/agent/grpcImpl.go @@ -4,13 +4,15 @@ import ( "context" "github.com/openziti/zrok/agent/agentGrpc" "github.com/openziti/zrok/build" + "github.com/sirupsen/logrus" ) type agentGrpcImpl struct { agentGrpc.UnimplementedAgentServer } -func (s *agentGrpcImpl) Version(ctx context.Context, req *agentGrpc.VersionRequest) (*agentGrpc.VersionReply, error) { +func (s *agentGrpcImpl) Version(_ context.Context, _ *agentGrpc.VersionRequest) (*agentGrpc.VersionReply, error) { v := build.String() + logrus.Infof("responding to version inquiry with '%v'", v) return &agentGrpc.VersionReply{V: &v}, nil } From 1808747215c59b3b0fde034988339bba3aeceac4 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 23 Aug 2024 12:49:12 -0400 Subject: [PATCH 11/51] windows path handling --- cmd/zrok/agentVersion.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/zrok/agentVersion.go b/cmd/zrok/agentVersion.go index fb9dacfa..aa051aae 100644 --- a/cmd/zrok/agentVersion.go +++ b/cmd/zrok/agentVersion.go @@ -8,6 +8,8 @@ import ( "github.com/spf13/cobra" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" + "path/filepath" + "strings" ) func init() { @@ -39,6 +41,7 @@ func (cmd *agentVersionCommand) run(_ *cobra.Command, _ []string) { if err != nil { tui.Error("error getting agent socket", err) } + agentSocket = filepath.ToSlash(strings.Replace(agentSocket, ":", "", -1)) conn, err := grpc.NewClient("unix://"+agentSocket, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { From 64c984ffcc687a56906ba707bfe3c800122d150d Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 23 Aug 2024 12:56:58 -0400 Subject: [PATCH 12/51] better grpc dialing for windows (#463) --- cmd/zrok/agentVersion.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/cmd/zrok/agentVersion.go b/cmd/zrok/agentVersion.go index aa051aae..6ea556bf 100644 --- a/cmd/zrok/agentVersion.go +++ b/cmd/zrok/agentVersion.go @@ -2,14 +2,14 @@ package main import ( "context" - grpc2 "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/agent/agentGrpc" "github.com/openziti/zrok/environment" "github.com/openziti/zrok/tui" "github.com/spf13/cobra" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" - "path/filepath" - "strings" + "google.golang.org/grpc/resolver" + "net" ) func init() { @@ -41,16 +41,18 @@ func (cmd *agentVersionCommand) run(_ *cobra.Command, _ []string) { if err != nil { tui.Error("error getting agent socket", err) } - agentSocket = filepath.ToSlash(strings.Replace(agentSocket, ":", "", -1)) - conn, err := grpc.NewClient("unix://"+agentSocket, grpc.WithTransportCredentials(insecure.NewCredentials())) + resolver.SetDefaultScheme("passthrough") + conn, err := grpc.NewClient("unix", grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) { + return net.Dial("unix", agentSocket) + }), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { tui.Error("error connecting to agent socket", err) } defer conn.Close() - client := grpc2.NewAgentClient(conn) + client := agentGrpc.NewAgentClient(conn) - v, err := client.Version(context.Background(), &grpc2.VersionRequest{}) + v, err := client.Version(context.Background(), &agentGrpc.VersionRequest{}) if err != nil { tui.Error("error getting agent version", err) } From a89d8ef1780c6fd2d7032680fb2226ac022d4825 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 23 Aug 2024 13:00:01 -0400 Subject: [PATCH 13/51] more logical grpc dialing (#463) --- cmd/zrok/agentVersion.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/zrok/agentVersion.go b/cmd/zrok/agentVersion.go index 6ea556bf..51502485 100644 --- a/cmd/zrok/agentVersion.go +++ b/cmd/zrok/agentVersion.go @@ -42,10 +42,14 @@ func (cmd *agentVersionCommand) run(_ *cobra.Command, _ []string) { tui.Error("error getting agent socket", err) } + opts := []grpc.DialOption{ + grpc.WithContextDialer(func(_ context.Context, addr string) (net.Conn, error) { + return net.Dial("unix", addr) + }), + grpc.WithTransportCredentials(insecure.NewCredentials()), + } resolver.SetDefaultScheme("passthrough") - conn, err := grpc.NewClient("unix", grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) { - return net.Dial("unix", agentSocket) - }), grpc.WithTransportCredentials(insecure.NewCredentials())) + conn, err := grpc.NewClient(agentSocket, opts...) if err != nil { tui.Error("error connecting to agent socket", err) } From 84c7e262025358797995b7df6b87d524d7c3607c Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 26 Aug 2024 11:39:13 -0400 Subject: [PATCH 14/51] 'proto3' (#463) --- agent/agentGrpc/agent.pb.go | 11 ++++++----- agent/agentGrpc/agent.proto | 4 +++- agent/grpcImpl.go | 2 +- cmd/zrok/agentVersion.go | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/agent/agentGrpc/agent.pb.go b/agent/agentGrpc/agent.pb.go index cf170e81..fde0cfc4 100644 --- a/agent/agentGrpc/agent.pb.go +++ b/agent/agentGrpc/agent.pb.go @@ -63,7 +63,7 @@ type VersionReply struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - V *string `protobuf:"bytes,1,req,name=v" json:"v,omitempty"` + V string `protobuf:"bytes,1,opt,name=v,proto3" json:"v,omitempty"` } func (x *VersionReply) Reset() { @@ -99,8 +99,8 @@ func (*VersionReply) Descriptor() ([]byte, []int) { } func (x *VersionReply) GetV() string { - if x != nil && x.V != nil { - return *x.V + if x != nil { + return x.V } return "" } @@ -112,13 +112,14 @@ var file_agent_agentGrpc_agent_proto_rawDesc = []byte{ 0x63, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x10, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, - 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x02, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0x34, 0x0a, + 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0x34, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, - 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, + 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/agent/agentGrpc/agent.proto b/agent/agentGrpc/agent.proto index e9add796..172bafc9 100644 --- a/agent/agentGrpc/agent.proto +++ b/agent/agentGrpc/agent.proto @@ -1,3 +1,5 @@ +syntax = "proto3"; + option go_package = "github.com/openziti/zrok/agent/agentGrpc"; service Agent { @@ -8,5 +10,5 @@ message VersionRequest { } message VersionReply { - required string v = 1; + string v = 1; } diff --git a/agent/grpcImpl.go b/agent/grpcImpl.go index e0c31083..ba7ff568 100644 --- a/agent/grpcImpl.go +++ b/agent/grpcImpl.go @@ -14,5 +14,5 @@ type agentGrpcImpl struct { func (s *agentGrpcImpl) Version(_ context.Context, _ *agentGrpc.VersionRequest) (*agentGrpc.VersionReply, error) { v := build.String() logrus.Infof("responding to version inquiry with '%v'", v) - return &agentGrpc.VersionReply{V: &v}, nil + return &agentGrpc.VersionReply{V: v}, nil } diff --git a/cmd/zrok/agentVersion.go b/cmd/zrok/agentVersion.go index 51502485..ca2c9653 100644 --- a/cmd/zrok/agentVersion.go +++ b/cmd/zrok/agentVersion.go @@ -61,5 +61,5 @@ func (cmd *agentVersionCommand) run(_ *cobra.Command, _ []string) { tui.Error("error getting agent version", err) } - println(*v.V) + println(v.GetV()) } From e0592a3625d2d4c62b217cee93849675900ecd54 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 26 Aug 2024 11:49:28 -0400 Subject: [PATCH 15/51] factor out unix domain grpc client (#463) --- agent/agentClient/agentClient.go | 33 ++++++++++++++++++++++++++++++++ cmd/zrok/agentVersion.go | 22 +++------------------ 2 files changed, 36 insertions(+), 19 deletions(-) create mode 100644 agent/agentClient/agentClient.go diff --git a/agent/agentClient/agentClient.go b/agent/agentClient/agentClient.go new file mode 100644 index 00000000..8459bc60 --- /dev/null +++ b/agent/agentClient/agentClient.go @@ -0,0 +1,33 @@ +package agentClient + +import ( + "context" + "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/environment/env_core" + "github.com/openziti/zrok/tui" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/resolver" + "net" +) + +func NewClient(root env_core.Root) (client agentGrpc.AgentClient, conn *grpc.ClientConn, err error) { + agentSocket, err := root.AgentSocket() + if err != nil { + tui.Error("error getting agent socket", err) + } + + opts := []grpc.DialOption{ + grpc.WithContextDialer(func(_ context.Context, addr string) (net.Conn, error) { + return net.Dial("unix", addr) + }), + grpc.WithTransportCredentials(insecure.NewCredentials()), + } + resolver.SetDefaultScheme("passthrough") + conn, err = grpc.NewClient(agentSocket, opts...) + if err != nil { + tui.Error("error connecting to agent socket", err) + } + + return agentGrpc.NewAgentClient(conn), conn, nil +} diff --git a/cmd/zrok/agentVersion.go b/cmd/zrok/agentVersion.go index ca2c9653..a25afa27 100644 --- a/cmd/zrok/agentVersion.go +++ b/cmd/zrok/agentVersion.go @@ -2,14 +2,11 @@ package main import ( "context" + "github.com/openziti/zrok/agent/agentClient" "github.com/openziti/zrok/agent/agentGrpc" "github.com/openziti/zrok/environment" "github.com/openziti/zrok/tui" "github.com/spf13/cobra" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - "google.golang.org/grpc/resolver" - "net" ) func init() { @@ -37,24 +34,11 @@ func (cmd *agentVersionCommand) run(_ *cobra.Command, _ []string) { tui.Error("error loading zrokdir", err) } - agentSocket, err := root.AgentSocket() + client, conn, err := agentClient.NewClient(root) if err != nil { - tui.Error("error getting agent socket", err) - } - - opts := []grpc.DialOption{ - grpc.WithContextDialer(func(_ context.Context, addr string) (net.Conn, error) { - return net.Dial("unix", addr) - }), - grpc.WithTransportCredentials(insecure.NewCredentials()), - } - resolver.SetDefaultScheme("passthrough") - conn, err := grpc.NewClient(agentSocket, opts...) - if err != nil { - tui.Error("error connecting to agent socket", err) + tui.Error("error getting agent client", err) } defer conn.Close() - client := agentGrpc.NewAgentClient(conn) v, err := client.Version(context.Background(), &agentGrpc.VersionRequest{}) if err != nil { From 66a95f0acddf9b314ef6ce8a49b4215eabdeab6a Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 26 Aug 2024 11:59:59 -0400 Subject: [PATCH 16/51] rudimentary 'zrok agent status' messages (#463) --- agent/agentGrpc/agent.pb.go | 421 +++++++++++++++++++++++++++++++++--- agent/agentGrpc/agent.proto | 27 +++ 2 files changed, 419 insertions(+), 29 deletions(-) diff --git a/agent/agentGrpc/agent.pb.go b/agent/agentGrpc/agent.pb.go index fde0cfc4..2cbd9e73 100644 --- a/agent/agentGrpc/agent.pb.go +++ b/agent/agentGrpc/agent.pb.go @@ -20,6 +20,282 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type AccessDetail struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + BindAddress string `protobuf:"bytes,2,opt,name=bindAddress,proto3" json:"bindAddress,omitempty"` + ResponseHeaders []string `protobuf:"bytes,3,rep,name=responseHeaders,proto3" json:"responseHeaders,omitempty"` +} + +func (x *AccessDetail) Reset() { + *x = AccessDetail{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AccessDetail) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AccessDetail) ProtoMessage() {} + +func (x *AccessDetail) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 AccessDetail.ProtoReflect.Descriptor instead. +func (*AccessDetail) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{0} +} + +func (x *AccessDetail) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *AccessDetail) GetBindAddress() string { + if x != nil { + return x.BindAddress + } + return "" +} + +func (x *AccessDetail) GetResponseHeaders() []string { + if x != nil { + return x.ResponseHeaders + } + return nil +} + +type ShareDetail struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + ShareMode string `protobuf:"bytes,2,opt,name=shareMode,proto3" json:"shareMode,omitempty"` + BackendMode string `protobuf:"bytes,3,opt,name=backendMode,proto3" json:"backendMode,omitempty"` + Reserved bool `protobuf:"varint,4,opt,name=reserved,proto3" json:"reserved,omitempty"` + UniqueName string `protobuf:"bytes,5,opt,name=uniqueName,proto3" json:"uniqueName,omitempty"` + FrontendEndpoint []string `protobuf:"bytes,6,rep,name=frontendEndpoint,proto3" json:"frontendEndpoint,omitempty"` + BackendEndpoint string `protobuf:"bytes,7,opt,name=backendEndpoint,proto3" json:"backendEndpoint,omitempty"` + Closed bool `protobuf:"varint,8,opt,name=closed,proto3" json:"closed,omitempty"` + Status string `protobuf:"bytes,9,opt,name=status,proto3" json:"status,omitempty"` +} + +func (x *ShareDetail) Reset() { + *x = ShareDetail{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ShareDetail) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShareDetail) ProtoMessage() {} + +func (x *ShareDetail) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 ShareDetail.ProtoReflect.Descriptor instead. +func (*ShareDetail) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{1} +} + +func (x *ShareDetail) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *ShareDetail) GetShareMode() string { + if x != nil { + return x.ShareMode + } + return "" +} + +func (x *ShareDetail) GetBackendMode() string { + if x != nil { + return x.BackendMode + } + return "" +} + +func (x *ShareDetail) GetReserved() bool { + if x != nil { + return x.Reserved + } + return false +} + +func (x *ShareDetail) GetUniqueName() string { + if x != nil { + return x.UniqueName + } + return "" +} + +func (x *ShareDetail) GetFrontendEndpoint() []string { + if x != nil { + return x.FrontendEndpoint + } + return nil +} + +func (x *ShareDetail) GetBackendEndpoint() string { + if x != nil { + return x.BackendEndpoint + } + return "" +} + +func (x *ShareDetail) GetClosed() bool { + if x != nil { + return x.Closed + } + return false +} + +func (x *ShareDetail) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +type StatusRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Accesses []*AccessDetail `protobuf:"bytes,1,rep,name=accesses,proto3" json:"accesses,omitempty"` + Shares []*ShareDetail `protobuf:"bytes,2,rep,name=shares,proto3" json:"shares,omitempty"` +} + +func (x *StatusRequest) Reset() { + *x = StatusRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatusRequest) ProtoMessage() {} + +func (x *StatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 StatusRequest.ProtoReflect.Descriptor instead. +func (*StatusRequest) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{2} +} + +func (x *StatusRequest) GetAccesses() []*AccessDetail { + if x != nil { + return x.Accesses + } + return nil +} + +func (x *StatusRequest) GetShares() []*ShareDetail { + if x != nil { + return x.Shares + } + return nil +} + +type StatusReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + V []string `protobuf:"bytes,1,rep,name=v,proto3" json:"v,omitempty"` +} + +func (x *StatusReply) Reset() { + *x = StatusReply{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatusReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatusReply) ProtoMessage() {} + +func (x *StatusReply) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 StatusReply.ProtoReflect.Descriptor instead. +func (*StatusReply) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{3} +} + +func (x *StatusReply) GetV() []string { + if x != nil { + return x.V + } + return nil +} + type VersionRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -29,7 +305,7 @@ type VersionRequest struct { func (x *VersionRequest) Reset() { *x = VersionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[0] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -42,7 +318,7 @@ func (x *VersionRequest) String() string { func (*VersionRequest) ProtoMessage() {} func (x *VersionRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[0] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -55,7 +331,7 @@ func (x *VersionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionRequest.ProtoReflect.Descriptor instead. func (*VersionRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{0} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{4} } type VersionReply struct { @@ -69,7 +345,7 @@ type VersionReply struct { func (x *VersionReply) Reset() { *x = VersionReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[1] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -82,7 +358,7 @@ func (x *VersionReply) String() string { func (*VersionReply) ProtoMessage() {} func (x *VersionReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[1] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -95,7 +371,7 @@ func (x *VersionReply) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionReply.ProtoReflect.Descriptor instead. func (*VersionReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{1} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{5} } func (x *VersionReply) GetV() string { @@ -109,17 +385,50 @@ var File_agent_agentGrpc_agent_proto protoreflect.FileDescriptor var file_agent_agentGrpc_agent_proto_rawDesc = []byte{ 0x0a, 0x1b, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, - 0x63, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x10, 0x0a, - 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, - 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, - 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0x34, 0x0a, - 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, - 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x63, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x70, 0x0a, + 0x0c, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, + 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x69, 0x6e, 0x64, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, + 0xa5, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, + 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, + 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, + 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, + 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, + 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x66, 0x72, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x28, 0x0a, + 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, + 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, + 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, + 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x60, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x1b, 0x0a, 0x0b, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x01, 0x76, 0x22, 0x10, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0x34, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, + 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, + 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, + 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -134,19 +443,25 @@ func file_agent_agentGrpc_agent_proto_rawDescGZIP() []byte { return file_agent_agentGrpc_agent_proto_rawDescData } -var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_agent_agentGrpc_agent_proto_goTypes = []any{ - (*VersionRequest)(nil), // 0: VersionRequest - (*VersionReply)(nil), // 1: VersionReply + (*AccessDetail)(nil), // 0: AccessDetail + (*ShareDetail)(nil), // 1: ShareDetail + (*StatusRequest)(nil), // 2: StatusRequest + (*StatusReply)(nil), // 3: StatusReply + (*VersionRequest)(nil), // 4: VersionRequest + (*VersionReply)(nil), // 5: VersionReply } var file_agent_agentGrpc_agent_proto_depIdxs = []int32{ - 0, // 0: Agent.Version:input_type -> VersionRequest - 1, // 1: Agent.Version:output_type -> VersionReply - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 0, // 0: StatusRequest.accesses:type_name -> AccessDetail + 1, // 1: StatusRequest.shares:type_name -> ShareDetail + 4, // 2: Agent.Version:input_type -> VersionRequest + 5, // 3: Agent.Version:output_type -> VersionReply + 3, // [3:4] is the sub-list for method output_type + 2, // [2:3] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_agent_agentGrpc_agent_proto_init() } @@ -156,7 +471,7 @@ func file_agent_agentGrpc_agent_proto_init() { } if !protoimpl.UnsafeEnabled { file_agent_agentGrpc_agent_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*VersionRequest); i { + switch v := v.(*AccessDetail); i { case 0: return &v.state case 1: @@ -168,6 +483,54 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*ShareDetail); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*StatusRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*StatusReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*VersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*VersionReply); i { case 0: return &v.state @@ -186,7 +549,7 @@ func file_agent_agentGrpc_agent_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_agent_agentGrpc_agent_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, diff --git a/agent/agentGrpc/agent.proto b/agent/agentGrpc/agent.proto index 172bafc9..ae3676f9 100644 --- a/agent/agentGrpc/agent.proto +++ b/agent/agentGrpc/agent.proto @@ -6,6 +6,33 @@ service Agent { rpc Version(VersionRequest) returns (VersionReply) {} } +message AccessDetail { + string token = 1; + string bindAddress = 2; + repeated string responseHeaders = 3; +} + +message ShareDetail { + string token = 1; + string shareMode = 2; + string backendMode = 3; + bool reserved = 4; + string uniqueName = 5; + repeated string frontendEndpoint = 6; + string backendEndpoint = 7; + bool closed = 8; + string status = 9; +} + +message StatusRequest { + repeated AccessDetail accesses = 1; + repeated ShareDetail shares = 2; +} + +message StatusReply { + repeated string v = 1; +} + message VersionRequest { } From b69025ce30c0ac23ec8c07b1bb10a9cace104cd2 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 26 Aug 2024 13:13:59 -0400 Subject: [PATCH 17/51] rudimentary 'zrok agent status' implementation (#463) --- agent/agent.go | 2 +- agent/agentGrpc/agent.pb.go | 113 +++++++++++++----------------- agent/agentGrpc/agent.proto | 15 ++-- agent/agentGrpc/agent_grpc.pb.go | 38 ++++++++++ agent/model.go | 11 ++- agent/status.go | 32 +++++++++ agent/{grpcImpl.go => version.go} | 6 +- cmd/zrok/agentStatus.go | 74 +++++++++++++++++++ cmd/zrok/agentVersion.go | 2 +- 9 files changed, 213 insertions(+), 80 deletions(-) create mode 100644 agent/status.go rename agent/{grpcImpl.go => version.go} (71%) create mode 100644 cmd/zrok/agentStatus.go diff --git a/agent/agent.go b/agent/agent.go index 2d01211d..adea2da9 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -42,7 +42,7 @@ func (a *Agent) Run() error { a.agentSocket = agentSocket srv := grpc.NewServer() - agentGrpc.RegisterAgentServer(srv, &agentGrpcImpl{}) + agentGrpc.RegisterAgentServer(srv, &agentGrpcImpl{a: a}) if err := srv.Serve(l); err != nil { return err } diff --git a/agent/agentGrpc/agent.pb.go b/agent/agentGrpc/agent.pb.go index 2cbd9e73..7c24933d 100644 --- a/agent/agentGrpc/agent.pb.go +++ b/agent/agentGrpc/agent.pb.go @@ -92,11 +92,10 @@ type ShareDetail struct { ShareMode string `protobuf:"bytes,2,opt,name=shareMode,proto3" json:"shareMode,omitempty"` BackendMode string `protobuf:"bytes,3,opt,name=backendMode,proto3" json:"backendMode,omitempty"` Reserved bool `protobuf:"varint,4,opt,name=reserved,proto3" json:"reserved,omitempty"` - UniqueName string `protobuf:"bytes,5,opt,name=uniqueName,proto3" json:"uniqueName,omitempty"` - FrontendEndpoint []string `protobuf:"bytes,6,rep,name=frontendEndpoint,proto3" json:"frontendEndpoint,omitempty"` - BackendEndpoint string `protobuf:"bytes,7,opt,name=backendEndpoint,proto3" json:"backendEndpoint,omitempty"` - Closed bool `protobuf:"varint,8,opt,name=closed,proto3" json:"closed,omitempty"` - Status string `protobuf:"bytes,9,opt,name=status,proto3" json:"status,omitempty"` + FrontendEndpoint []string `protobuf:"bytes,5,rep,name=frontendEndpoint,proto3" json:"frontendEndpoint,omitempty"` + BackendEndpoint string `protobuf:"bytes,6,opt,name=backendEndpoint,proto3" json:"backendEndpoint,omitempty"` + Closed bool `protobuf:"varint,7,opt,name=closed,proto3" json:"closed,omitempty"` + Status string `protobuf:"bytes,8,opt,name=status,proto3" json:"status,omitempty"` } func (x *ShareDetail) Reset() { @@ -159,13 +158,6 @@ func (x *ShareDetail) GetReserved() bool { return false } -func (x *ShareDetail) GetUniqueName() string { - if x != nil { - return x.UniqueName - } - return "" -} - func (x *ShareDetail) GetFrontendEndpoint() []string { if x != nil { return x.FrontendEndpoint @@ -198,9 +190,6 @@ type StatusRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - - Accesses []*AccessDetail `protobuf:"bytes,1,rep,name=accesses,proto3" json:"accesses,omitempty"` - Shares []*ShareDetail `protobuf:"bytes,2,rep,name=shares,proto3" json:"shares,omitempty"` } func (x *StatusRequest) Reset() { @@ -235,26 +224,13 @@ func (*StatusRequest) Descriptor() ([]byte, []int) { return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{2} } -func (x *StatusRequest) GetAccesses() []*AccessDetail { - if x != nil { - return x.Accesses - } - return nil -} - -func (x *StatusRequest) GetShares() []*ShareDetail { - if x != nil { - return x.Shares - } - return nil -} - type StatusReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - V []string `protobuf:"bytes,1,rep,name=v,proto3" json:"v,omitempty"` + Accesses []*AccessDetail `protobuf:"bytes,1,rep,name=accesses,proto3" json:"accesses,omitempty"` + Shares []*ShareDetail `protobuf:"bytes,2,rep,name=shares,proto3" json:"shares,omitempty"` } func (x *StatusReply) Reset() { @@ -289,9 +265,16 @@ func (*StatusReply) Descriptor() ([]byte, []int) { return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{3} } -func (x *StatusReply) GetV() []string { +func (x *StatusReply) GetAccesses() []*AccessDetail { if x != nil { - return x.V + return x.Accesses + } + return nil +} + +func (x *StatusReply) GetShares() []*ShareDetail { + if x != nil { + return x.Shares } return nil } @@ -393,7 +376,7 @@ var file_agent_agentGrpc_agent_proto_rawDesc = []byte{ 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, - 0xa5, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, + 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, @@ -401,34 +384,34 @@ var file_agent_agentGrpc_agent_proto_rawDesc = []byte{ 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x4e, 0x61, 0x6d, - 0x65, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x66, 0x72, 0x6f, + 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, - 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, - 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x60, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, - 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x1b, 0x0a, 0x0b, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x01, 0x76, 0x22, 0x10, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0x34, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, - 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, - 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, - 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, + 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5e, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, + 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x0c, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0x5e, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, + 0x74, 0x12, 0x28, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, + 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, + 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -453,12 +436,14 @@ var file_agent_agentGrpc_agent_proto_goTypes = []any{ (*VersionReply)(nil), // 5: VersionReply } var file_agent_agentGrpc_agent_proto_depIdxs = []int32{ - 0, // 0: StatusRequest.accesses:type_name -> AccessDetail - 1, // 1: StatusRequest.shares:type_name -> ShareDetail - 4, // 2: Agent.Version:input_type -> VersionRequest - 5, // 3: Agent.Version:output_type -> VersionReply - 3, // [3:4] is the sub-list for method output_type - 2, // [2:3] is the sub-list for method input_type + 0, // 0: StatusReply.accesses:type_name -> AccessDetail + 1, // 1: StatusReply.shares:type_name -> ShareDetail + 2, // 2: Agent.Status:input_type -> StatusRequest + 4, // 3: Agent.Version:input_type -> VersionRequest + 3, // 4: Agent.Status:output_type -> StatusReply + 5, // 5: Agent.Version:output_type -> VersionReply + 4, // [4:6] is the sub-list for method output_type + 2, // [2:4] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name diff --git a/agent/agentGrpc/agent.proto b/agent/agentGrpc/agent.proto index ae3676f9..a022e63d 100644 --- a/agent/agentGrpc/agent.proto +++ b/agent/agentGrpc/agent.proto @@ -3,6 +3,7 @@ syntax = "proto3"; option go_package = "github.com/openziti/zrok/agent/agentGrpc"; service Agent { + rpc Status(StatusRequest) returns (StatusReply) {} rpc Version(VersionRequest) returns (VersionReply) {} } @@ -17,20 +18,18 @@ message ShareDetail { string shareMode = 2; string backendMode = 3; bool reserved = 4; - string uniqueName = 5; - repeated string frontendEndpoint = 6; - string backendEndpoint = 7; - bool closed = 8; - string status = 9; + repeated string frontendEndpoint = 5; + string backendEndpoint = 6; + bool closed = 7; + string status = 8; } message StatusRequest { - repeated AccessDetail accesses = 1; - repeated ShareDetail shares = 2; } message StatusReply { - repeated string v = 1; + repeated AccessDetail accesses = 1; + repeated ShareDetail shares = 2; } message VersionRequest { diff --git a/agent/agentGrpc/agent_grpc.pb.go b/agent/agentGrpc/agent_grpc.pb.go index 397aa46c..26cefa8f 100644 --- a/agent/agentGrpc/agent_grpc.pb.go +++ b/agent/agentGrpc/agent_grpc.pb.go @@ -19,6 +19,7 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( + Agent_Status_FullMethodName = "/Agent/Status" Agent_Version_FullMethodName = "/Agent/Version" ) @@ -26,6 +27,7 @@ const ( // // 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. type AgentClient interface { + Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionReply, error) } @@ -37,6 +39,16 @@ func NewAgentClient(cc grpc.ClientConnInterface) AgentClient { return &agentClient{cc} } +func (c *agentClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(StatusReply) + err := c.cc.Invoke(ctx, Agent_Status_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *agentClient) Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(VersionReply) @@ -51,6 +63,7 @@ func (c *agentClient) Version(ctx context.Context, in *VersionRequest, opts ...g // All implementations must embed UnimplementedAgentServer // for forward compatibility. type AgentServer interface { + Status(context.Context, *StatusRequest) (*StatusReply, error) Version(context.Context, *VersionRequest) (*VersionReply, error) mustEmbedUnimplementedAgentServer() } @@ -62,6 +75,9 @@ type AgentServer interface { // pointer dereference when methods are called. type UnimplementedAgentServer struct{} +func (UnimplementedAgentServer) Status(context.Context, *StatusRequest) (*StatusReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") +} func (UnimplementedAgentServer) Version(context.Context, *VersionRequest) (*VersionReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Version not implemented") } @@ -86,6 +102,24 @@ func RegisterAgentServer(s grpc.ServiceRegistrar, srv AgentServer) { s.RegisterService(&Agent_ServiceDesc, srv) } +func _Agent_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AgentServer).Status(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Agent_Status_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AgentServer).Status(ctx, req.(*StatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Agent_Version_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(VersionRequest) if err := dec(in); err != nil { @@ -111,6 +145,10 @@ var Agent_ServiceDesc = grpc.ServiceDesc{ ServiceName: "Agent", HandlerType: (*AgentServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "Status", + Handler: _Agent_Status_Handler, + }, { MethodName: "Version", Handler: _Agent_Version_Handler, diff --git a/agent/model.go b/agent/model.go index 1c103705..fd0bf81d 100644 --- a/agent/model.go +++ b/agent/model.go @@ -1,16 +1,20 @@ package agent import ( + "github.com/openziti/zrok/agent/agentGrpc" "github.com/openziti/zrok/sdk/golang/sdk" "time" ) type share struct { - token string + token string + target string basicAuth []string frontendSelection []string + shareMode sdk.ShareMode backendMode sdk.BackendMode + reserved bool insecure bool oauthProvider string oauthEmailAddressPatterns []string @@ -25,3 +29,8 @@ type access struct { bindAddress string responseHeaders []string } + +type agentGrpcImpl struct { + agentGrpc.UnimplementedAgentServer + a *Agent +} diff --git a/agent/status.go b/agent/status.go new file mode 100644 index 00000000..e0824bc9 --- /dev/null +++ b/agent/status.go @@ -0,0 +1,32 @@ +package agent + +import ( + "context" + "github.com/openziti/zrok/agent/agentGrpc" +) + +func (i *agentGrpcImpl) Status(_ context.Context, _ *agentGrpc.StatusRequest) (*agentGrpc.StatusReply, error) { + var accesses []*agentGrpc.AccessDetail + for token, acc := range i.a.accesses { + accesses = append(accesses, &agentGrpc.AccessDetail{ + Token: token, + BindAddress: acc.bindAddress, + ResponseHeaders: acc.responseHeaders, + }) + } + + var shares []*agentGrpc.ShareDetail + for token, shr := range i.a.shares { + shares = append(shares, &agentGrpc.ShareDetail{ + Token: token, + ShareMode: string(shr.shareMode), + BackendMode: string(shr.backendMode), + Reserved: shr.reserved, + FrontendEndpoint: shr.frontendSelection, + BackendEndpoint: shr.target, + Closed: shr.closed, + }) + } + + return &agentGrpc.StatusReply{Accesses: accesses, Shares: shares}, nil +} diff --git a/agent/grpcImpl.go b/agent/version.go similarity index 71% rename from agent/grpcImpl.go rename to agent/version.go index ba7ff568..02788c24 100644 --- a/agent/grpcImpl.go +++ b/agent/version.go @@ -7,11 +7,7 @@ import ( "github.com/sirupsen/logrus" ) -type agentGrpcImpl struct { - agentGrpc.UnimplementedAgentServer -} - -func (s *agentGrpcImpl) Version(_ context.Context, _ *agentGrpc.VersionRequest) (*agentGrpc.VersionReply, error) { +func (i *agentGrpcImpl) Version(_ context.Context, _ *agentGrpc.VersionRequest) (*agentGrpc.VersionReply, error) { v := build.String() logrus.Infof("responding to version inquiry with '%v'", v) return &agentGrpc.VersionReply{V: v}, nil diff --git a/cmd/zrok/agentStatus.go b/cmd/zrok/agentStatus.go new file mode 100644 index 00000000..184dbe14 --- /dev/null +++ b/cmd/zrok/agentStatus.go @@ -0,0 +1,74 @@ +package main + +import ( + "context" + "fmt" + "github.com/jedib0t/go-pretty/v6/table" + "github.com/openziti/zrok/agent/agentClient" + "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/environment" + "github.com/openziti/zrok/tui" + "github.com/spf13/cobra" + "os" +) + +func init() { + agentCmd.AddCommand(newAgentStatusCommand().cmd) +} + +type agentStatusCommand struct { + cmd *cobra.Command +} + +func newAgentStatusCommand() *agentStatusCommand { + cmd := &cobra.Command{ + Use: "status", + Short: "Show the status of the running zrok Agent", + Args: cobra.NoArgs, + } + command := &agentStatusCommand{cmd: cmd} + cmd.Run = command.run + return command +} + +func (cmd *agentStatusCommand) run(_ *cobra.Command, _ []string) { + root, err := environment.LoadRoot() + if err != nil { + tui.Error("error loading zrokdir", err) + } + + client, conn, err := agentClient.NewClient(root) + if err != nil { + tui.Error("error connecting to agent", err) + } + defer conn.Close() + + status, err := client.Status(context.Background(), &agentGrpc.StatusRequest{}) + if err != nil { + tui.Error("error getting status", err) + } + + fmt.Println() + t := table.NewWriter() + t.SetOutputMirror(os.Stdout) + t.SetStyle(table.StyleColoredDark) + t.AppendHeader(table.Row{"Token", "Bind Address"}) + for _, access := range status.GetAccesses() { + t.AppendRow(table.Row{access.Token, access.BindAddress}) + } + t.Render() + fmt.Printf("%d accesses in agent\n", len(status.GetAccesses())) + + fmt.Println() + t = table.NewWriter() + t.SetOutputMirror(os.Stdout) + t.SetStyle(table.StyleColoredDark) + t.AppendHeader(table.Row{"Token", "Reserved", "Share Mode", "Backend Mode", "Target"}) + for _, share := range status.GetShares() { + t.AppendRow(table.Row{share.Token, share.Reserved, share.ShareMode, share.BackendMode, share.BackendEndpoint}) + } + t.Render() + fmt.Printf("%d shares in agent\n", len(status.GetShares())) + + fmt.Println() +} diff --git a/cmd/zrok/agentVersion.go b/cmd/zrok/agentVersion.go index a25afa27..dc522a63 100644 --- a/cmd/zrok/agentVersion.go +++ b/cmd/zrok/agentVersion.go @@ -36,7 +36,7 @@ func (cmd *agentVersionCommand) run(_ *cobra.Command, _ []string) { client, conn, err := agentClient.NewClient(root) if err != nil { - tui.Error("error getting agent client", err) + tui.Error("error connecting to agent", err) } defer conn.Close() From a9bac040bb46da0211ba9fe79c856ff6484d2d15 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 26 Aug 2024 14:18:17 -0400 Subject: [PATCH 18/51] most minimal public sharing (proxy only) to elaborate plumbing (#463) --- agent/agentGrpc/agent.pb.go | 365 +++++++++++++++++++++++++------ agent/agentGrpc/agent.proto | 18 ++ agent/agentGrpc/agent_grpc.pb.go | 42 +++- agent/model.go | 6 + agent/publicShare.go | 93 ++++++++ cmd/zrok/agentSharePublic.go | 111 ++++++++++ cmd/zrok/main.go | 6 + 7 files changed, 569 insertions(+), 72 deletions(-) create mode 100644 agent/publicShare.go create mode 100644 cmd/zrok/agentSharePublic.go diff --git a/agent/agentGrpc/agent.pb.go b/agent/agentGrpc/agent.pb.go index 7c24933d..c96c229d 100644 --- a/agent/agentGrpc/agent.pb.go +++ b/agent/agentGrpc/agent.pb.go @@ -83,6 +83,172 @@ func (x *AccessDetail) GetResponseHeaders() []string { return nil } +type PublicShareReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` +} + +func (x *PublicShareReply) Reset() { + *x = PublicShareReply{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PublicShareReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PublicShareReply) ProtoMessage() {} + +func (x *PublicShareReply) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 PublicShareReply.ProtoReflect.Descriptor instead. +func (*PublicShareReply) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{1} +} + +func (x *PublicShareReply) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +type PublicShareRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` + BasicAuth []string `protobuf:"bytes,2,rep,name=basicAuth,proto3" json:"basicAuth,omitempty"` + FrontendSelection []string `protobuf:"bytes,3,rep,name=frontendSelection,proto3" json:"frontendSelection,omitempty"` + BackendMode string `protobuf:"bytes,4,opt,name=backendMode,proto3" json:"backendMode,omitempty"` + Insecure bool `protobuf:"varint,5,opt,name=insecure,proto3" json:"insecure,omitempty"` + OauthProvider string `protobuf:"bytes,6,opt,name=oauthProvider,proto3" json:"oauthProvider,omitempty"` + OauthEmailAddressPatterns []string `protobuf:"bytes,7,rep,name=oauthEmailAddressPatterns,proto3" json:"oauthEmailAddressPatterns,omitempty"` + OauthCheckInterval string `protobuf:"bytes,8,opt,name=oauthCheckInterval,proto3" json:"oauthCheckInterval,omitempty"` + Closed bool `protobuf:"varint,9,opt,name=closed,proto3" json:"closed,omitempty"` + AccessGrants []string `protobuf:"bytes,10,rep,name=accessGrants,proto3" json:"accessGrants,omitempty"` +} + +func (x *PublicShareRequest) Reset() { + *x = PublicShareRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PublicShareRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PublicShareRequest) ProtoMessage() {} + +func (x *PublicShareRequest) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 PublicShareRequest.ProtoReflect.Descriptor instead. +func (*PublicShareRequest) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{2} +} + +func (x *PublicShareRequest) GetTarget() string { + if x != nil { + return x.Target + } + return "" +} + +func (x *PublicShareRequest) GetBasicAuth() []string { + if x != nil { + return x.BasicAuth + } + return nil +} + +func (x *PublicShareRequest) GetFrontendSelection() []string { + if x != nil { + return x.FrontendSelection + } + return nil +} + +func (x *PublicShareRequest) GetBackendMode() string { + if x != nil { + return x.BackendMode + } + return "" +} + +func (x *PublicShareRequest) GetInsecure() bool { + if x != nil { + return x.Insecure + } + return false +} + +func (x *PublicShareRequest) GetOauthProvider() string { + if x != nil { + return x.OauthProvider + } + return "" +} + +func (x *PublicShareRequest) GetOauthEmailAddressPatterns() []string { + if x != nil { + return x.OauthEmailAddressPatterns + } + return nil +} + +func (x *PublicShareRequest) GetOauthCheckInterval() string { + if x != nil { + return x.OauthCheckInterval + } + return "" +} + +func (x *PublicShareRequest) GetClosed() bool { + if x != nil { + return x.Closed + } + return false +} + +func (x *PublicShareRequest) GetAccessGrants() []string { + if x != nil { + return x.AccessGrants + } + return nil +} + type ShareDetail struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -101,7 +267,7 @@ type ShareDetail struct { func (x *ShareDetail) Reset() { *x = ShareDetail{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[1] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114,7 +280,7 @@ func (x *ShareDetail) String() string { func (*ShareDetail) ProtoMessage() {} func (x *ShareDetail) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[1] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -127,7 +293,7 @@ func (x *ShareDetail) ProtoReflect() protoreflect.Message { // Deprecated: Use ShareDetail.ProtoReflect.Descriptor instead. func (*ShareDetail) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{1} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{3} } func (x *ShareDetail) GetToken() string { @@ -195,7 +361,7 @@ type StatusRequest struct { func (x *StatusRequest) Reset() { *x = StatusRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[2] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -208,7 +374,7 @@ func (x *StatusRequest) String() string { func (*StatusRequest) ProtoMessage() {} func (x *StatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[2] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -221,7 +387,7 @@ func (x *StatusRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead. func (*StatusRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{2} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{4} } type StatusReply struct { @@ -236,7 +402,7 @@ type StatusReply struct { func (x *StatusReply) Reset() { *x = StatusReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[3] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -249,7 +415,7 @@ func (x *StatusReply) String() string { func (*StatusReply) ProtoMessage() {} func (x *StatusReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[3] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -262,7 +428,7 @@ func (x *StatusReply) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusReply.ProtoReflect.Descriptor instead. func (*StatusReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{3} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{5} } func (x *StatusReply) GetAccesses() []*AccessDetail { @@ -288,7 +454,7 @@ type VersionRequest struct { func (x *VersionRequest) Reset() { *x = VersionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[4] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -301,7 +467,7 @@ func (x *VersionRequest) String() string { func (*VersionRequest) ProtoMessage() {} func (x *VersionRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[4] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -314,7 +480,7 @@ func (x *VersionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionRequest.ProtoReflect.Descriptor instead. func (*VersionRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{4} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{6} } type VersionReply struct { @@ -328,7 +494,7 @@ type VersionReply struct { func (x *VersionReply) Reset() { *x = VersionReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -341,7 +507,7 @@ func (x *VersionReply) String() string { func (*VersionReply) ProtoMessage() {} func (x *VersionReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -354,7 +520,7 @@ func (x *VersionReply) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionReply.ProtoReflect.Descriptor instead. func (*VersionReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{5} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{7} } func (x *VersionReply) GetV() string { @@ -376,42 +542,73 @@ var file_agent_agentGrpc_agent_proto_rawDesc = []byte{ 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, - 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, - 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, - 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, - 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, - 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, - 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x66, 0x72, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x28, 0x0a, - 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, - 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, - 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, - 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5e, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, - 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x0c, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0x5e, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, - 0x74, 0x12, 0x28, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, - 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, - 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x28, 0x0a, 0x10, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x86, 0x03, 0x0a, 0x12, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x69, + 0x63, 0x41, 0x75, 0x74, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x62, 0x61, 0x73, + 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, 0x2c, 0x0a, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, + 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, + 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, + 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, + 0x72, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6f, 0x61, 0x75, 0x74, 0x68, + 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x19, 0x6f, 0x61, 0x75, 0x74, + 0x68, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x19, 0x6f, 0x61, 0x75, + 0x74, 0x68, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x12, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x12, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, + 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x22, + 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x0a, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, + 0x74, 0x73, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x68, 0x61, + 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, + 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, + 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, + 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, + 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, + 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, + 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, + 0x6f, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, + 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5e, 0x0a, 0x0b, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, + 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, + 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0x97, 0x01, 0x0a, 0x05, + 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, + 0x68, 0x61, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, + 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x50, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x28, + 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, + 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, + 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -426,24 +623,28 @@ func file_agent_agentGrpc_agent_proto_rawDescGZIP() []byte { return file_agent_agentGrpc_agent_proto_rawDescData } -var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_agent_agentGrpc_agent_proto_goTypes = []any{ - (*AccessDetail)(nil), // 0: AccessDetail - (*ShareDetail)(nil), // 1: ShareDetail - (*StatusRequest)(nil), // 2: StatusRequest - (*StatusReply)(nil), // 3: StatusReply - (*VersionRequest)(nil), // 4: VersionRequest - (*VersionReply)(nil), // 5: VersionReply + (*AccessDetail)(nil), // 0: AccessDetail + (*PublicShareReply)(nil), // 1: PublicShareReply + (*PublicShareRequest)(nil), // 2: PublicShareRequest + (*ShareDetail)(nil), // 3: ShareDetail + (*StatusRequest)(nil), // 4: StatusRequest + (*StatusReply)(nil), // 5: StatusReply + (*VersionRequest)(nil), // 6: VersionRequest + (*VersionReply)(nil), // 7: VersionReply } var file_agent_agentGrpc_agent_proto_depIdxs = []int32{ 0, // 0: StatusReply.accesses:type_name -> AccessDetail - 1, // 1: StatusReply.shares:type_name -> ShareDetail - 2, // 2: Agent.Status:input_type -> StatusRequest - 4, // 3: Agent.Version:input_type -> VersionRequest - 3, // 4: Agent.Status:output_type -> StatusReply - 5, // 5: Agent.Version:output_type -> VersionReply - 4, // [4:6] is the sub-list for method output_type - 2, // [2:4] is the sub-list for method input_type + 3, // 1: StatusReply.shares:type_name -> ShareDetail + 2, // 2: Agent.PublicShare:input_type -> PublicShareRequest + 4, // 3: Agent.Status:input_type -> StatusRequest + 6, // 4: Agent.Version:input_type -> VersionRequest + 1, // 5: Agent.PublicShare:output_type -> PublicShareReply + 5, // 6: Agent.Status:output_type -> StatusReply + 7, // 7: Agent.Version:output_type -> VersionReply + 5, // [5:8] is the sub-list for method output_type + 2, // [2:5] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name @@ -468,7 +669,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*ShareDetail); i { + switch v := v.(*PublicShareReply); i { case 0: return &v.state case 1: @@ -480,7 +681,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*StatusRequest); i { + switch v := v.(*PublicShareRequest); i { case 0: return &v.state case 1: @@ -492,7 +693,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*StatusReply); i { + switch v := v.(*ShareDetail); i { case 0: return &v.state case 1: @@ -504,7 +705,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*VersionRequest); i { + switch v := v.(*StatusRequest); i { case 0: return &v.state case 1: @@ -516,6 +717,30 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[5].Exporter = func(v any, i int) any { + switch v := v.(*StatusReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[6].Exporter = func(v any, i int) any { + switch v := v.(*VersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*VersionReply); i { case 0: return &v.state @@ -534,7 +759,7 @@ func file_agent_agentGrpc_agent_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_agent_agentGrpc_agent_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/agent/agentGrpc/agent.proto b/agent/agentGrpc/agent.proto index a022e63d..421b2141 100644 --- a/agent/agentGrpc/agent.proto +++ b/agent/agentGrpc/agent.proto @@ -3,6 +3,7 @@ syntax = "proto3"; option go_package = "github.com/openziti/zrok/agent/agentGrpc"; service Agent { + rpc PublicShare(PublicShareRequest) returns (PublicShareReply) {} rpc Status(StatusRequest) returns (StatusReply) {} rpc Version(VersionRequest) returns (VersionReply) {} } @@ -13,6 +14,23 @@ message AccessDetail { repeated string responseHeaders = 3; } +message PublicShareReply { + string token = 1; +} + +message PublicShareRequest { + string target = 1; + repeated string basicAuth = 2; + repeated string frontendSelection = 3; + string backendMode = 4; + bool insecure = 5; + string oauthProvider = 6; + repeated string oauthEmailAddressPatterns = 7; + string oauthCheckInterval = 8; + bool closed = 9; + repeated string accessGrants = 10; +} + message ShareDetail { string token = 1; string shareMode = 2; diff --git a/agent/agentGrpc/agent_grpc.pb.go b/agent/agentGrpc/agent_grpc.pb.go index 26cefa8f..d65597b3 100644 --- a/agent/agentGrpc/agent_grpc.pb.go +++ b/agent/agentGrpc/agent_grpc.pb.go @@ -19,14 +19,16 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - Agent_Status_FullMethodName = "/Agent/Status" - Agent_Version_FullMethodName = "/Agent/Version" + Agent_PublicShare_FullMethodName = "/Agent/PublicShare" + Agent_Status_FullMethodName = "/Agent/Status" + Agent_Version_FullMethodName = "/Agent/Version" ) // AgentClient is the client API for Agent 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. type AgentClient interface { + PublicShare(ctx context.Context, in *PublicShareRequest, opts ...grpc.CallOption) (*PublicShareReply, error) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionReply, error) } @@ -39,6 +41,16 @@ func NewAgentClient(cc grpc.ClientConnInterface) AgentClient { return &agentClient{cc} } +func (c *agentClient) PublicShare(ctx context.Context, in *PublicShareRequest, opts ...grpc.CallOption) (*PublicShareReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PublicShareReply) + err := c.cc.Invoke(ctx, Agent_PublicShare_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *agentClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(StatusReply) @@ -63,6 +75,7 @@ func (c *agentClient) Version(ctx context.Context, in *VersionRequest, opts ...g // All implementations must embed UnimplementedAgentServer // for forward compatibility. type AgentServer interface { + PublicShare(context.Context, *PublicShareRequest) (*PublicShareReply, error) Status(context.Context, *StatusRequest) (*StatusReply, error) Version(context.Context, *VersionRequest) (*VersionReply, error) mustEmbedUnimplementedAgentServer() @@ -75,6 +88,9 @@ type AgentServer interface { // pointer dereference when methods are called. type UnimplementedAgentServer struct{} +func (UnimplementedAgentServer) PublicShare(context.Context, *PublicShareRequest) (*PublicShareReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method PublicShare not implemented") +} func (UnimplementedAgentServer) Status(context.Context, *StatusRequest) (*StatusReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") } @@ -102,6 +118,24 @@ func RegisterAgentServer(s grpc.ServiceRegistrar, srv AgentServer) { s.RegisterService(&Agent_ServiceDesc, srv) } +func _Agent_PublicShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PublicShareRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AgentServer).PublicShare(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Agent_PublicShare_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AgentServer).PublicShare(ctx, req.(*PublicShareRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Agent_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(StatusRequest) if err := dec(in); err != nil { @@ -145,6 +179,10 @@ var Agent_ServiceDesc = grpc.ServiceDesc{ ServiceName: "Agent", HandlerType: (*AgentServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "PublicShare", + Handler: _Agent_PublicShare_Handler, + }, { MethodName: "Status", Handler: _Agent_Status_Handler, diff --git a/agent/model.go b/agent/model.go index fd0bf81d..72da4c24 100644 --- a/agent/model.go +++ b/agent/model.go @@ -21,6 +21,8 @@ type share struct { oauthCheckInterval time.Duration closed bool accessGrants []string + + handler backendHandler } type access struct { @@ -34,3 +36,7 @@ type agentGrpcImpl struct { agentGrpc.UnimplementedAgentServer a *Agent } + +type backendHandler interface { + Run() error +} diff --git a/agent/publicShare.go b/agent/publicShare.go new file mode 100644 index 00000000..5b7be474 --- /dev/null +++ b/agent/publicShare.go @@ -0,0 +1,93 @@ +package agent + +import ( + "context" + "errors" + "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/endpoints/proxy" + "github.com/openziti/zrok/environment" + "github.com/openziti/zrok/sdk/golang/sdk" + "github.com/sirupsen/logrus" + "time" +) + +func (i *agentGrpcImpl) PublicShare(_ context.Context, req *agentGrpc.PublicShareRequest) (*agentGrpc.PublicShareReply, error) { + root, err := environment.LoadRoot() + if err != nil { + return nil, err + } + + if !root.IsEnabled() { + return nil, errors.New("unable to load environment; did you 'zrok enable'?") + } + + zif, err := root.ZitiIdentityNamed(root.EnvironmentIdentityName()) + if err != nil { + return nil, err + } + + shrReq := &sdk.ShareRequest{ + BackendMode: sdk.BackendMode(req.BackendMode), + ShareMode: sdk.PublicShareMode, + Frontends: req.FrontendSelection, + BasicAuth: req.BasicAuth, + Target: req.Target, + } + if req.Closed { + shrReq.PermissionMode = sdk.ClosedPermissionMode + shrReq.AccessGrants = req.AccessGrants + } + if req.OauthProvider != "" { + shrReq.OauthProvider = req.OauthProvider + shrReq.OauthEmailAddressPatterns = req.OauthEmailAddressPatterns + checkInterval, err := time.ParseDuration(req.GetOauthCheckInterval()) + if err != nil { + return nil, err + } + shrReq.OauthAuthorizationCheckInterval = checkInterval + } + shr, err := sdk.CreateShare(root, shrReq) + if err != nil { + return nil, err + } + + switch req.BackendMode { + case "proxy": + cfg := &proxy.BackendConfig{ + IdentityPath: zif, + EndpointAddress: req.Target, + ShrToken: shr.Token, + Insecure: req.Insecure, + } + + be, err := proxy.NewBackend(cfg) + if err != nil { + return nil, err + } + + agentShr := &share{ + token: shr.Token, + target: req.Target, + basicAuth: req.BasicAuth, + frontendSelection: shr.FrontendEndpoints, + shareMode: sdk.PublicShareMode, + backendMode: sdk.BackendMode(req.BackendMode), + insecure: req.Insecure, + oauthProvider: req.OauthProvider, + oauthEmailAddressPatterns: req.OauthEmailAddressPatterns, + oauthCheckInterval: shrReq.OauthAuthorizationCheckInterval, + closed: req.Closed, + accessGrants: req.AccessGrants, + handler: be, + } + + i.a.shares[shr.Token] = agentShr + go func() { + if err := agentShr.handler.Run(); err != nil { + logrus.Errorf("error running proxy backend: %v", err) + } + }() + } + + return &agentGrpc.PublicShareReply{Token: shr.Token}, nil +} diff --git a/cmd/zrok/agentSharePublic.go b/cmd/zrok/agentSharePublic.go new file mode 100644 index 00000000..03da860f --- /dev/null +++ b/cmd/zrok/agentSharePublic.go @@ -0,0 +1,111 @@ +package main + +import ( + "context" + "fmt" + "github.com/openziti/zrok/agent/agentClient" + "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/environment" + "github.com/openziti/zrok/tui" + "github.com/spf13/cobra" + "time" +) + +func init() { + agentShareCmd.AddCommand(newAgentSharePublicCommand().cmd) +} + +type agentSharePublicCommand struct { + basicAuth []string + frontendSelection []string + backendMode string + headless bool + insecure bool + oauthProvider string + oauthEmailAddressPatterns []string + oauthCheckInterval time.Duration + closed bool + accessGrants []string + cmd *cobra.Command +} + +func newAgentSharePublicCommand() *agentSharePublicCommand { + cmd := &cobra.Command{ + Use: "public ", + Short: "Create a public share in the zrok Agent", + Args: cobra.ExactArgs(1), + } + command := &agentSharePublicCommand{cmd: cmd} + defaultFrontends := []string{"public"} + if root, err := environment.LoadRoot(); err == nil { + defaultFrontend, _ := root.DefaultFrontend() + defaultFrontends = []string{defaultFrontend} + } + cmd.Flags().StringArrayVar(&command.frontendSelection, "frontend", defaultFrontends, "Selected frontends to use for the share") + cmd.Flags().StringVarP(&command.backendMode, "backend-mode", "b", "proxy", "The backend mode {proxy, web, caddy, drive}") + cmd.Flags().BoolVar(&command.headless, "headless", false, "Disable TUI and run headless") + cmd.Flags().BoolVar(&command.insecure, "insecure", false, "Enable insecure TLS certificate validation for ") + cmd.Flags().BoolVar(&command.closed, "closed", false, "Enable closed permission mode (see --access-grant)") + cmd.Flags().StringArrayVar(&command.accessGrants, "access-grant", []string{}, "zrok accounts that are allowed to access this share (see --closed)") + + cmd.Flags().StringArrayVar(&command.basicAuth, "basic-auth", []string{}, "Basic authentication users (,...)") + cmd.Flags().StringVar(&command.oauthProvider, "oauth-provider", "", "Enable OAuth provider [google, github]") + cmd.Flags().StringArrayVar(&command.oauthEmailAddressPatterns, "oauth-email-address-patterns", []string{}, "Allow only these email domain globs to authenticate via OAuth") + cmd.Flags().DurationVar(&command.oauthCheckInterval, "oauth-check-interval", 3*time.Hour, "Maximum lifetime for OAuth authentication; reauthenticate after expiry") + cmd.MarkFlagsMutuallyExclusive("basic-auth", "oauth-provider") + + cmd.Run = command.run + return command +} + +func (cmd *agentSharePublicCommand) run(_ *cobra.Command, args []string) { + var target string + + switch cmd.backendMode { + case "proxy": + v, err := parseUrl(args[0]) + if err != nil { + if !panicInstead { + tui.Error("invalid target endpoint URL", err) + } + panic(err) + } + target = v + } + + root, err := environment.LoadRoot() + if err != nil { + if !panicInstead { + tui.Error("unable to load environment", err) + } + panic(err) + } + + if !root.IsEnabled() { + tui.Error("unable to load environment; did you 'zrok enable'?", nil) + } + + client, conn, err := agentClient.NewClient(root) + if err != nil { + tui.Error("error connecting to agent", err) + } + defer conn.Close() + + shr, err := client.PublicShare(context.Background(), &agentGrpc.PublicShareRequest{ + Target: target, + BasicAuth: cmd.basicAuth, + FrontendSelection: cmd.frontendSelection, + BackendMode: cmd.backendMode, + Insecure: cmd.insecure, + OauthProvider: cmd.oauthProvider, + OauthEmailAddressPatterns: cmd.oauthEmailAddressPatterns, + OauthCheckInterval: cmd.oauthCheckInterval.String(), + Closed: cmd.closed, + AccessGrants: cmd.accessGrants, + }) + if err != nil { + tui.Error("error creating share", err) + } + + fmt.Println(shr.GetToken()) +} diff --git a/cmd/zrok/main.go b/cmd/zrok/main.go index 9fe7eb4a..1c540a76 100644 --- a/cmd/zrok/main.go +++ b/cmd/zrok/main.go @@ -24,6 +24,7 @@ func init() { adminCmd.AddCommand(adminListCmd) adminCmd.AddCommand(adminUpdateCmd) rootCmd.AddCommand(agentCmd) + agentCmd.AddCommand(agentShareCmd) testCmd.AddCommand(loopCmd) rootCmd.AddCommand(adminCmd) rootCmd.AddCommand(configCmd) @@ -82,6 +83,11 @@ var agentCmd = &cobra.Command{ Aliases: []string{"daemon"}, } +var agentShareCmd = &cobra.Command{ + Use: "share", + Short: "zrok Agent sharing commands", +} + var configCmd = &cobra.Command{ Use: "config", Short: "Configure your zrok environment", From e58524572f37365283fb611e4c56d471419dffeb Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Tue, 10 Sep 2024 12:53:45 -0400 Subject: [PATCH 19/51] scaffolding for 'zrok agent release share' (#463) --- agent/agentGrpc/agent.pb.go | 277 ++++++++++++++++++++++--------- agent/agentGrpc/agent.proto | 8 + agent/agentGrpc/agent_grpc.pb.go | 46 ++++- agent/releaseShare.go | 12 ++ cmd/zrok/agentReleaseShare.go | 55 ++++++ cmd/zrok/main.go | 6 + 6 files changed, 322 insertions(+), 82 deletions(-) create mode 100755 agent/releaseShare.go create mode 100755 cmd/zrok/agentReleaseShare.go diff --git a/agent/agentGrpc/agent.pb.go b/agent/agentGrpc/agent.pb.go index c96c229d..82b95f38 100644 --- a/agent/agentGrpc/agent.pb.go +++ b/agent/agentGrpc/agent.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.34.2 -// protoc v5.27.3 +// protoc v5.27.4 // source: agent/agentGrpc/agent.proto package agentGrpc @@ -249,6 +249,91 @@ func (x *PublicShareRequest) GetAccessGrants() []string { return nil } +type ReleaseShareRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` +} + +func (x *ReleaseShareRequest) Reset() { + *x = ReleaseShareRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReleaseShareRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReleaseShareRequest) ProtoMessage() {} + +func (x *ReleaseShareRequest) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 ReleaseShareRequest.ProtoReflect.Descriptor instead. +func (*ReleaseShareRequest) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{3} +} + +func (x *ReleaseShareRequest) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +type ReleaseShareReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ReleaseShareReply) Reset() { + *x = ReleaseShareReply{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReleaseShareReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReleaseShareReply) ProtoMessage() {} + +func (x *ReleaseShareReply) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 ReleaseShareReply.ProtoReflect.Descriptor instead. +func (*ReleaseShareReply) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{4} +} + type ShareDetail struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -267,7 +352,7 @@ type ShareDetail struct { func (x *ShareDetail) Reset() { *x = ShareDetail{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[3] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -280,7 +365,7 @@ func (x *ShareDetail) String() string { func (*ShareDetail) ProtoMessage() {} func (x *ShareDetail) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[3] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -293,7 +378,7 @@ func (x *ShareDetail) ProtoReflect() protoreflect.Message { // Deprecated: Use ShareDetail.ProtoReflect.Descriptor instead. func (*ShareDetail) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{3} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{5} } func (x *ShareDetail) GetToken() string { @@ -361,7 +446,7 @@ type StatusRequest struct { func (x *StatusRequest) Reset() { *x = StatusRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[4] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -374,7 +459,7 @@ func (x *StatusRequest) String() string { func (*StatusRequest) ProtoMessage() {} func (x *StatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[4] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -387,7 +472,7 @@ func (x *StatusRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead. func (*StatusRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{4} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{6} } type StatusReply struct { @@ -402,7 +487,7 @@ type StatusReply struct { func (x *StatusReply) Reset() { *x = StatusReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -415,7 +500,7 @@ func (x *StatusReply) String() string { func (*StatusReply) ProtoMessage() {} func (x *StatusReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -428,7 +513,7 @@ func (x *StatusReply) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusReply.ProtoReflect.Descriptor instead. func (*StatusReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{5} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{7} } func (x *StatusReply) GetAccesses() []*AccessDetail { @@ -454,7 +539,7 @@ type VersionRequest struct { func (x *VersionRequest) Reset() { *x = VersionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[6] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -467,7 +552,7 @@ func (x *VersionRequest) String() string { func (*VersionRequest) ProtoMessage() {} func (x *VersionRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[6] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -480,7 +565,7 @@ func (x *VersionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionRequest.ProtoReflect.Descriptor instead. func (*VersionRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{6} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{8} } type VersionReply struct { @@ -494,7 +579,7 @@ type VersionReply struct { func (x *VersionReply) Reset() { *x = VersionReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -507,7 +592,7 @@ func (x *VersionReply) String() string { func (*VersionReply) ProtoMessage() {} func (x *VersionReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -520,7 +605,7 @@ func (x *VersionReply) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionReply.ProtoReflect.Descriptor instead. func (*VersionReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{7} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{9} } func (x *VersionReply) GetV() string { @@ -569,46 +654,54 @@ var file_agent_agentGrpc_agent_proto_rawDesc = []byte{ 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, - 0x74, 0x73, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, - 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, - 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x68, 0x61, - 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, - 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, - 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, - 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, - 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, - 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, - 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, - 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, - 0x6f, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, - 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5e, 0x0a, 0x0b, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, - 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, - 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, - 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0x97, 0x01, 0x0a, 0x05, - 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, - 0x68, 0x61, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, - 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x50, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x28, - 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, - 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, - 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x73, 0x22, 0x2b, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, + 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, + 0x13, 0x0a, 0x11, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, + 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, + 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, + 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, + 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, + 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, + 0x6f, 0x73, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x0f, 0x0a, 0x0d, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5e, 0x0a, + 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x29, 0x0a, 0x08, + 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, + 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, + 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, + 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, + 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0xd3, 0x01, + 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, + 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, + 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, + 0x12, 0x3a, 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, + 0x12, 0x14, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, + 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x06, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, + 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -623,28 +716,32 @@ func file_agent_agentGrpc_agent_proto_rawDescGZIP() []byte { return file_agent_agentGrpc_agent_proto_rawDescData } -var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_agent_agentGrpc_agent_proto_goTypes = []any{ - (*AccessDetail)(nil), // 0: AccessDetail - (*PublicShareReply)(nil), // 1: PublicShareReply - (*PublicShareRequest)(nil), // 2: PublicShareRequest - (*ShareDetail)(nil), // 3: ShareDetail - (*StatusRequest)(nil), // 4: StatusRequest - (*StatusReply)(nil), // 5: StatusReply - (*VersionRequest)(nil), // 6: VersionRequest - (*VersionReply)(nil), // 7: VersionReply + (*AccessDetail)(nil), // 0: AccessDetail + (*PublicShareReply)(nil), // 1: PublicShareReply + (*PublicShareRequest)(nil), // 2: PublicShareRequest + (*ReleaseShareRequest)(nil), // 3: ReleaseShareRequest + (*ReleaseShareReply)(nil), // 4: ReleaseShareReply + (*ShareDetail)(nil), // 5: ShareDetail + (*StatusRequest)(nil), // 6: StatusRequest + (*StatusReply)(nil), // 7: StatusReply + (*VersionRequest)(nil), // 8: VersionRequest + (*VersionReply)(nil), // 9: VersionReply } var file_agent_agentGrpc_agent_proto_depIdxs = []int32{ 0, // 0: StatusReply.accesses:type_name -> AccessDetail - 3, // 1: StatusReply.shares:type_name -> ShareDetail + 5, // 1: StatusReply.shares:type_name -> ShareDetail 2, // 2: Agent.PublicShare:input_type -> PublicShareRequest - 4, // 3: Agent.Status:input_type -> StatusRequest - 6, // 4: Agent.Version:input_type -> VersionRequest - 1, // 5: Agent.PublicShare:output_type -> PublicShareReply - 5, // 6: Agent.Status:output_type -> StatusReply - 7, // 7: Agent.Version:output_type -> VersionReply - 5, // [5:8] is the sub-list for method output_type - 2, // [2:5] is the sub-list for method input_type + 3, // 3: Agent.ReleaseShare:input_type -> ReleaseShareRequest + 6, // 4: Agent.Status:input_type -> StatusRequest + 8, // 5: Agent.Version:input_type -> VersionRequest + 1, // 6: Agent.PublicShare:output_type -> PublicShareReply + 4, // 7: Agent.ReleaseShare:output_type -> ReleaseShareReply + 7, // 8: Agent.Status:output_type -> StatusReply + 9, // 9: Agent.Version:output_type -> VersionReply + 6, // [6:10] is the sub-list for method output_type + 2, // [2:6] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name @@ -693,7 +790,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*ShareDetail); i { + switch v := v.(*ReleaseShareRequest); i { case 0: return &v.state case 1: @@ -705,7 +802,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*StatusRequest); i { + switch v := v.(*ReleaseShareReply); i { case 0: return &v.state case 1: @@ -717,7 +814,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*StatusReply); i { + switch v := v.(*ShareDetail); i { case 0: return &v.state case 1: @@ -729,7 +826,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*VersionRequest); i { + switch v := v.(*StatusRequest); i { case 0: return &v.state case 1: @@ -741,6 +838,30 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[7].Exporter = func(v any, i int) any { + switch v := v.(*StatusReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[8].Exporter = func(v any, i int) any { + switch v := v.(*VersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[9].Exporter = func(v any, i int) any { switch v := v.(*VersionReply); i { case 0: return &v.state @@ -759,7 +880,7 @@ func file_agent_agentGrpc_agent_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_agent_agentGrpc_agent_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 1, }, diff --git a/agent/agentGrpc/agent.proto b/agent/agentGrpc/agent.proto index 421b2141..65ea8e16 100644 --- a/agent/agentGrpc/agent.proto +++ b/agent/agentGrpc/agent.proto @@ -4,6 +4,7 @@ option go_package = "github.com/openziti/zrok/agent/agentGrpc"; service Agent { rpc PublicShare(PublicShareRequest) returns (PublicShareReply) {} + rpc ReleaseShare(ReleaseShareRequest) returns (ReleaseShareReply) {} rpc Status(StatusRequest) returns (StatusReply) {} rpc Version(VersionRequest) returns (VersionReply) {} } @@ -31,6 +32,13 @@ message PublicShareRequest { repeated string accessGrants = 10; } +message ReleaseShareRequest { + string token = 1; +} + +message ReleaseShareReply { +} + message ShareDetail { string token = 1; string shareMode = 2; diff --git a/agent/agentGrpc/agent_grpc.pb.go b/agent/agentGrpc/agent_grpc.pb.go index d65597b3..6e7116d7 100644 --- a/agent/agentGrpc/agent_grpc.pb.go +++ b/agent/agentGrpc/agent_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v5.27.3 +// - protoc v5.27.4 // source: agent/agentGrpc/agent.proto package agentGrpc @@ -19,9 +19,10 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - Agent_PublicShare_FullMethodName = "/Agent/PublicShare" - Agent_Status_FullMethodName = "/Agent/Status" - Agent_Version_FullMethodName = "/Agent/Version" + Agent_PublicShare_FullMethodName = "/Agent/PublicShare" + Agent_ReleaseShare_FullMethodName = "/Agent/ReleaseShare" + Agent_Status_FullMethodName = "/Agent/Status" + Agent_Version_FullMethodName = "/Agent/Version" ) // AgentClient is the client API for Agent service. @@ -29,6 +30,7 @@ const ( // 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. type AgentClient interface { PublicShare(ctx context.Context, in *PublicShareRequest, opts ...grpc.CallOption) (*PublicShareReply, error) + ReleaseShare(ctx context.Context, in *ReleaseShareRequest, opts ...grpc.CallOption) (*ReleaseShareReply, error) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionReply, error) } @@ -51,6 +53,16 @@ func (c *agentClient) PublicShare(ctx context.Context, in *PublicShareRequest, o return out, nil } +func (c *agentClient) ReleaseShare(ctx context.Context, in *ReleaseShareRequest, opts ...grpc.CallOption) (*ReleaseShareReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReleaseShareReply) + err := c.cc.Invoke(ctx, Agent_ReleaseShare_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *agentClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(StatusReply) @@ -76,6 +88,7 @@ func (c *agentClient) Version(ctx context.Context, in *VersionRequest, opts ...g // for forward compatibility. type AgentServer interface { PublicShare(context.Context, *PublicShareRequest) (*PublicShareReply, error) + ReleaseShare(context.Context, *ReleaseShareRequest) (*ReleaseShareReply, error) Status(context.Context, *StatusRequest) (*StatusReply, error) Version(context.Context, *VersionRequest) (*VersionReply, error) mustEmbedUnimplementedAgentServer() @@ -91,6 +104,9 @@ type UnimplementedAgentServer struct{} func (UnimplementedAgentServer) PublicShare(context.Context, *PublicShareRequest) (*PublicShareReply, error) { return nil, status.Errorf(codes.Unimplemented, "method PublicShare not implemented") } +func (UnimplementedAgentServer) ReleaseShare(context.Context, *ReleaseShareRequest) (*ReleaseShareReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReleaseShare not implemented") +} func (UnimplementedAgentServer) Status(context.Context, *StatusRequest) (*StatusReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") } @@ -136,6 +152,24 @@ func _Agent_PublicShare_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Agent_ReleaseShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReleaseShareRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AgentServer).ReleaseShare(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Agent_ReleaseShare_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AgentServer).ReleaseShare(ctx, req.(*ReleaseShareRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Agent_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(StatusRequest) if err := dec(in); err != nil { @@ -183,6 +217,10 @@ var Agent_ServiceDesc = grpc.ServiceDesc{ MethodName: "PublicShare", Handler: _Agent_PublicShare_Handler, }, + { + MethodName: "ReleaseShare", + Handler: _Agent_ReleaseShare_Handler, + }, { MethodName: "Status", Handler: _Agent_Status_Handler, diff --git a/agent/releaseShare.go b/agent/releaseShare.go new file mode 100755 index 00000000..4abde1d9 --- /dev/null +++ b/agent/releaseShare.go @@ -0,0 +1,12 @@ +package agent + +import ( + "context" + "github.com/openziti/zrok/agent/agentGrpc" + "github.com/sirupsen/logrus" +) + +func (i *agentGrpcImpl) ReleaseShare(_ context.Context, req *agentGrpc.ReleaseShareRequest) (*agentGrpc.ReleaseShareReply, error) { + logrus.Infof("releasing '%v'", req.Token) + return nil, nil +} diff --git a/cmd/zrok/agentReleaseShare.go b/cmd/zrok/agentReleaseShare.go new file mode 100755 index 00000000..09c0968b --- /dev/null +++ b/cmd/zrok/agentReleaseShare.go @@ -0,0 +1,55 @@ +package main + +import ( + "context" + "fmt" + "github.com/openziti/zrok/agent/agentClient" + "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/environment" + "github.com/openziti/zrok/tui" + "github.com/spf13/cobra" +) + +func init() { + agentReleaseCmd.AddCommand(newAgentReleaseShareCommand().cmd) +} + +type agentReleaseShareCommand struct { + cmd *cobra.Command +} + +func newAgentReleaseShareCommand() *agentReleaseShareCommand { + cmd := &cobra.Command{ + Use: "share ", + Short: "Release a share from the zrok Agent", + Args: cobra.ExactArgs(1), + } + command := &agentReleaseShareCommand{cmd: cmd} + cmd.Run = command.run + return command +} + +func (cmd *agentReleaseShareCommand) run(_ *cobra.Command, args []string) { + root, err := environment.LoadRoot() + if err != nil { + if !panicInstead { + tui.Error("unable to load environment", err) + } + panic(err) + } + + client, conn, err := agentClient.NewClient(root) + if err != nil { + tui.Error("error connecting to agent", err) + } + defer conn.Close() + + _, err = client.ReleaseShare(context.Background(), &agentGrpc.ReleaseShareRequest{ + Token: args[0], + }) + if err != nil { + tui.Error("error releasing share", err) + } + + fmt.Println("success.") +} diff --git a/cmd/zrok/main.go b/cmd/zrok/main.go index 64d69804..0a92da47 100644 --- a/cmd/zrok/main.go +++ b/cmd/zrok/main.go @@ -26,6 +26,7 @@ func init() { adminCmd.AddCommand(adminUpdateCmd) rootCmd.AddCommand(agentCmd) agentCmd.AddCommand(agentShareCmd) + agentCmd.AddCommand(agentReleaseCmd) testCmd.AddCommand(loopCmd) rootCmd.AddCommand(adminCmd) rootCmd.AddCommand(configCmd) @@ -90,6 +91,11 @@ var agentShareCmd = &cobra.Command{ Short: "zrok Agent sharing commands", } +var agentReleaseCmd = &cobra.Command{ + Use: "release", + Short: "zrok Agent release commands", +} + var configCmd = &cobra.Command{ Use: "config", Short: "Configure your zrok environment", From e7405cd9bb733c50970607cd16580655fd194d18 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Tue, 10 Sep 2024 13:46:17 -0400 Subject: [PATCH 20/51] stop the backend handler (#463) --- agent/model.go | 1 + agent/releaseShare.go | 12 +++++++++++- endpoints/proxy/backend.go | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/agent/model.go b/agent/model.go index 72da4c24..093fa729 100644 --- a/agent/model.go +++ b/agent/model.go @@ -39,4 +39,5 @@ type agentGrpcImpl struct { type backendHandler interface { Run() error + Stop() error } diff --git a/agent/releaseShare.go b/agent/releaseShare.go index 4abde1d9..9b826101 100755 --- a/agent/releaseShare.go +++ b/agent/releaseShare.go @@ -3,10 +3,20 @@ package agent import ( "context" "github.com/openziti/zrok/agent/agentGrpc" + "github.com/pkg/errors" "github.com/sirupsen/logrus" ) func (i *agentGrpcImpl) ReleaseShare(_ context.Context, req *agentGrpc.ReleaseShareRequest) (*agentGrpc.ReleaseShareReply, error) { - logrus.Infof("releasing '%v'", req.Token) + if shr, found := i.a.shares[req.Token]; found { + logrus.Infof("stopping share '%v'", shr.token) + if err := shr.handler.Stop(); err != nil { + logrus.Error(err) + } + delete(i.a.shares, shr.token) + logrus.Infof("released share '%v'", shr.token) + } else { + return nil, errors.Errorf("agent has no share with token '%v'", req.Token) + } return nil, nil } diff --git a/endpoints/proxy/backend.go b/endpoints/proxy/backend.go index a181b025..4d3491d3 100644 --- a/endpoints/proxy/backend.go +++ b/endpoints/proxy/backend.go @@ -67,6 +67,10 @@ func (b *Backend) Run() error { return nil } +func (b *Backend) Stop() error { + return b.listener.Close() +} + func newReverseProxy(cfg *BackendConfig) (*httputil.ReverseProxy, error) { targetURL, err := url.Parse(cfg.EndpointAddress) if err != nil { From 597776a835be4287904850cd9a9c0da1db061eb3 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Tue, 10 Sep 2024 13:54:38 -0400 Subject: [PATCH 21/51] roughed in share release (#463) --- agent/model.go | 2 +- agent/publicShare.go | 2 +- agent/releaseShare.go | 24 ++++++++++++++++++++---- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/agent/model.go b/agent/model.go index 093fa729..bba1014e 100644 --- a/agent/model.go +++ b/agent/model.go @@ -7,7 +7,7 @@ import ( ) type share struct { - token string + shr *sdk.Share target string basicAuth []string diff --git a/agent/publicShare.go b/agent/publicShare.go index 5b7be474..a4bdb471 100644 --- a/agent/publicShare.go +++ b/agent/publicShare.go @@ -66,7 +66,7 @@ func (i *agentGrpcImpl) PublicShare(_ context.Context, req *agentGrpc.PublicShar } agentShr := &share{ - token: shr.Token, + shr: shr, target: req.Target, basicAuth: req.BasicAuth, frontendSelection: shr.FrontendEndpoints, diff --git a/agent/releaseShare.go b/agent/releaseShare.go index 9b826101..048cf526 100755 --- a/agent/releaseShare.go +++ b/agent/releaseShare.go @@ -3,18 +3,34 @@ package agent import ( "context" "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/environment" + "github.com/openziti/zrok/sdk/golang/sdk" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) func (i *agentGrpcImpl) ReleaseShare(_ context.Context, req *agentGrpc.ReleaseShareRequest) (*agentGrpc.ReleaseShareReply, error) { if shr, found := i.a.shares[req.Token]; found { - logrus.Infof("stopping share '%v'", shr.token) + logrus.Infof("stopping share '%v'", shr.shr.Token) if err := shr.handler.Stop(); err != nil { - logrus.Error(err) + logrus.Errorf("error stopping share '%v': %v", shr.shr.Token, err) } - delete(i.a.shares, shr.token) - logrus.Infof("released share '%v'", shr.token) + + root, err := environment.LoadRoot() + if err != nil { + return nil, err + } + + if !root.IsEnabled() { + return nil, errors.New("unable to load environment; did you 'zrok enable'?") + } + + if err := sdk.DeleteShare(root, shr.shr); err != nil { + logrus.Errorf("error releasing share '%v': %v", shr.shr.Token, err) + } + + delete(i.a.shares, shr.shr.Token) + logrus.Infof("released share '%v'", shr.shr.Token) } else { return nil, errors.Errorf("agent has no share with token '%v'", req.Token) } From 82d8f4ba2e681df9d08f2772bb90ced297a4e525 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Tue, 10 Sep 2024 14:11:43 -0400 Subject: [PATCH 22/51] web shares (#463) --- agent/publicShare.go | 35 ++++++++++++++++++++++++++++++ endpoints/proxy/caddyWebBackend.go | 4 ++++ 2 files changed, 39 insertions(+) diff --git a/agent/publicShare.go b/agent/publicShare.go index a4bdb471..03953008 100644 --- a/agent/publicShare.go +++ b/agent/publicShare.go @@ -87,6 +87,41 @@ func (i *agentGrpcImpl) PublicShare(_ context.Context, req *agentGrpc.PublicShar logrus.Errorf("error running proxy backend: %v", err) } }() + + case "web": + cfg := &proxy.CaddyWebBackendConfig{ + IdentityPath: zif, + WebRoot: req.Target, + ShrToken: shr.Token, + } + + be, err := proxy.NewCaddyWebBackend(cfg) + if err != nil { + return nil, err + } + + agentShr := &share{ + shr: shr, + target: req.Target, + basicAuth: req.BasicAuth, + frontendSelection: shr.FrontendEndpoints, + shareMode: sdk.PublicShareMode, + backendMode: sdk.BackendMode(req.BackendMode), + insecure: req.Insecure, + oauthProvider: req.OauthProvider, + oauthEmailAddressPatterns: req.OauthEmailAddressPatterns, + oauthCheckInterval: shrReq.OauthAuthorizationCheckInterval, + closed: req.Closed, + accessGrants: req.AccessGrants, + handler: be, + } + + i.a.shares[shr.Token] = agentShr + go func() { + if err := agentShr.handler.Run(); err != nil { + logrus.Errorf("error running web backend: %v", err) + } + }() } return &agentGrpc.PublicShareReply{Token: shr.Token}, nil diff --git a/endpoints/proxy/caddyWebBackend.go b/endpoints/proxy/caddyWebBackend.go index ebae913a..e5d6a663 100644 --- a/endpoints/proxy/caddyWebBackend.go +++ b/endpoints/proxy/caddyWebBackend.go @@ -81,6 +81,10 @@ func (c *CaddyWebBackend) Run() error { return caddy.Run(c.caddyCfg) } +func (c *CaddyWebBackend) Stop() error { + return caddy.Stop() +} + func (c *CaddyWebBackend) Requests() func() int32 { return func() int32 { return 0 } } From 42c3ec48b0ac85ed736cb8906489c9c53c448598 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Thu, 12 Sep 2024 12:44:54 -0400 Subject: [PATCH 23/51] rough proctree implementation (#748) --- agent/proctree/impl_posix.go | 59 +++++++++++++++++++++++++ agent/proctree/impl_windows.go | 79 ++++++++++++++++++++++++++++++++++ agent/proctree/proctree.go | 66 ++++++++++++++++++++++++++++ 3 files changed, 204 insertions(+) create mode 100644 agent/proctree/impl_posix.go create mode 100755 agent/proctree/impl_windows.go create mode 100755 agent/proctree/proctree.go diff --git a/agent/proctree/impl_posix.go b/agent/proctree/impl_posix.go new file mode 100644 index 00000000..aa8596c5 --- /dev/null +++ b/agent/proctree/impl_posix.go @@ -0,0 +1,59 @@ +//go:build !windows + +package proctree + +import ( + "os/exec" + "sync" +) + +func Init(_ string) error { + return nil +} + +func StartChild(tail TailFunction, args ...string) (*Child, error) { + cmd := exec.Command(args[0], args[1:]...) + + cld := &Child{ + TailFunction: tail, + cmd: cmd, + outStream: make(chan []byte), + errStream: make(chan []byte), + wg: new(sync.WaitGroup), + } + + stdout, err := cmd.StdoutPipe() + if err != nil { + return nil, err + } + stderr, err := cmd.StderrPipe() + if err != nil { + return nil, err + } + + if err := cmd.Start(); err != nil { + return nil, err + } + + cld.wg.Add(3) + go reader(stdout, cld.outStream, cld.wg) + go reader(stderr, cld.errStream, cld.wg) + go cld.combiner(cld.wg) + + return cld, nil +} + +func WaitChild(c *Child) error { + c.wg.Wait() + if err := c.cmd.Wait(); err != nil { + return err + } + return nil +} + +func StopChild(c *Child) error { + if err := c.cmd.Process.Kill(); err != nil { + return err + } + return nil +} diff --git a/agent/proctree/impl_windows.go b/agent/proctree/impl_windows.go new file mode 100755 index 00000000..6a446fe8 --- /dev/null +++ b/agent/proctree/impl_windows.go @@ -0,0 +1,79 @@ +//go:build windows + +package proctree + +import ( + "github.com/kolesnikovae/go-winjob" + "golang.org/x/sys/windows" + "os/exec" + "sync" +) + +var job *winjob.JobObject + +func Init(name string) error { + var err error + if job == nil { + job, err = winjob.Create(name, winjob.LimitKillOnJobClose, winjob.LimitBreakawayOK) + if err != nil { + return err + } + } + return nil +} + +func StartChild(tail TailFunction, args ...string) (*Child, error) { + cmd := exec.Command(args[0], args[1:]...) + cmd.SysProcAttr = &windows.SysProcAttr{CreationFlags: windows.CREATE_SUSPENDED} + + cld := &Child{ + TailFunction: tail, + cmd: cmd, + outStream: make(chan []byte), + errStream: make(chan []byte), + wg: new(sync.WaitGroup), + } + + stdout, err := cmd.StdoutPipe() + if err != nil { + return nil, err + } + stderr, err := cmd.StderrPipe() + if err != nil { + return nil, err + } + + if err := cmd.Start(); err != nil { + return nil, err + } + + if err := job.Assign(cmd.Process); err != nil { + return nil, err + } + + if err := winjob.ResumeProcess(cmd.Process.Pid); err != nil { + return nil, err + } + + cld.wg.Add(3) + go reader(stdout, cld.outStream, cld.wg) + go reader(stderr, cld.errStream, cld.wg) + go cld.combiner(cld.wg) + + return cld, nil +} + +func WaitChild(c *Child) error { + c.wg.Wait() + if err := c.cmd.Wait(); err != nil { + return err + } + return nil +} + +func StopChild(c *Child) error { + if err := c.cmd.Process.Kill(); err != nil { + return err + } + return nil +} diff --git a/agent/proctree/proctree.go b/agent/proctree/proctree.go new file mode 100755 index 00000000..201517e7 --- /dev/null +++ b/agent/proctree/proctree.go @@ -0,0 +1,66 @@ +package proctree + +import ( + "fmt" + "io" + "os/exec" + "sync" +) + +type Child struct { + TailFunction TailFunction + cmd *exec.Cmd + outStream chan []byte + errStream chan []byte + wg *sync.WaitGroup +} + +type TailFunction func(data []byte) + +func (c *Child) combiner(wg *sync.WaitGroup) { + defer wg.Done() + + outDone := false + errDone := false + for { + select { + case data := <-c.outStream: + if data != nil { + if c.TailFunction != nil { + c.TailFunction(data) + } + } else { + outDone = true + } + case data := <-c.errStream: + if data != nil { + if c.TailFunction != nil { + c.TailFunction(data) + } + } else { + errDone = true + } + } + if outDone && errDone { + return + } + } +} + +func reader(r io.ReadCloser, o chan []byte, wg *sync.WaitGroup) { + defer close(o) + defer wg.Done() + + buf := make([]byte, 64*1024) + for { + n, err := r.Read(buf) + if err != nil { + if err == io.EOF { + return + } + fmt.Printf("error reading: %v", err) + return + } + o <- buf[:n] + } +} From cf7cce0e70727b054a4b1a8e70803a4843db789b Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Thu, 12 Sep 2024 13:07:27 -0400 Subject: [PATCH 24/51] removed previous agent innards (#748) --- agent/model.go | 5 +- agent/publicShare.go | 109 +----------------------------------------- agent/releaseShare.go | 23 ++------- 3 files changed, 7 insertions(+), 130 deletions(-) diff --git a/agent/model.go b/agent/model.go index bba1014e..f2dcf093 100644 --- a/agent/model.go +++ b/agent/model.go @@ -7,9 +7,8 @@ import ( ) type share struct { - shr *sdk.Share - target string - + token string + target string basicAuth []string frontendSelection []string shareMode sdk.ShareMode diff --git a/agent/publicShare.go b/agent/publicShare.go index 03953008..6bf8a18e 100644 --- a/agent/publicShare.go +++ b/agent/publicShare.go @@ -4,11 +4,7 @@ import ( "context" "errors" "github.com/openziti/zrok/agent/agentGrpc" - "github.com/openziti/zrok/endpoints/proxy" "github.com/openziti/zrok/environment" - "github.com/openziti/zrok/sdk/golang/sdk" - "github.com/sirupsen/logrus" - "time" ) func (i *agentGrpcImpl) PublicShare(_ context.Context, req *agentGrpc.PublicShareRequest) (*agentGrpc.PublicShareReply, error) { @@ -21,108 +17,5 @@ func (i *agentGrpcImpl) PublicShare(_ context.Context, req *agentGrpc.PublicShar return nil, errors.New("unable to load environment; did you 'zrok enable'?") } - zif, err := root.ZitiIdentityNamed(root.EnvironmentIdentityName()) - if err != nil { - return nil, err - } - - shrReq := &sdk.ShareRequest{ - BackendMode: sdk.BackendMode(req.BackendMode), - ShareMode: sdk.PublicShareMode, - Frontends: req.FrontendSelection, - BasicAuth: req.BasicAuth, - Target: req.Target, - } - if req.Closed { - shrReq.PermissionMode = sdk.ClosedPermissionMode - shrReq.AccessGrants = req.AccessGrants - } - if req.OauthProvider != "" { - shrReq.OauthProvider = req.OauthProvider - shrReq.OauthEmailAddressPatterns = req.OauthEmailAddressPatterns - checkInterval, err := time.ParseDuration(req.GetOauthCheckInterval()) - if err != nil { - return nil, err - } - shrReq.OauthAuthorizationCheckInterval = checkInterval - } - shr, err := sdk.CreateShare(root, shrReq) - if err != nil { - return nil, err - } - - switch req.BackendMode { - case "proxy": - cfg := &proxy.BackendConfig{ - IdentityPath: zif, - EndpointAddress: req.Target, - ShrToken: shr.Token, - Insecure: req.Insecure, - } - - be, err := proxy.NewBackend(cfg) - if err != nil { - return nil, err - } - - agentShr := &share{ - shr: shr, - target: req.Target, - basicAuth: req.BasicAuth, - frontendSelection: shr.FrontendEndpoints, - shareMode: sdk.PublicShareMode, - backendMode: sdk.BackendMode(req.BackendMode), - insecure: req.Insecure, - oauthProvider: req.OauthProvider, - oauthEmailAddressPatterns: req.OauthEmailAddressPatterns, - oauthCheckInterval: shrReq.OauthAuthorizationCheckInterval, - closed: req.Closed, - accessGrants: req.AccessGrants, - handler: be, - } - - i.a.shares[shr.Token] = agentShr - go func() { - if err := agentShr.handler.Run(); err != nil { - logrus.Errorf("error running proxy backend: %v", err) - } - }() - - case "web": - cfg := &proxy.CaddyWebBackendConfig{ - IdentityPath: zif, - WebRoot: req.Target, - ShrToken: shr.Token, - } - - be, err := proxy.NewCaddyWebBackend(cfg) - if err != nil { - return nil, err - } - - agentShr := &share{ - shr: shr, - target: req.Target, - basicAuth: req.BasicAuth, - frontendSelection: shr.FrontendEndpoints, - shareMode: sdk.PublicShareMode, - backendMode: sdk.BackendMode(req.BackendMode), - insecure: req.Insecure, - oauthProvider: req.OauthProvider, - oauthEmailAddressPatterns: req.OauthEmailAddressPatterns, - oauthCheckInterval: shrReq.OauthAuthorizationCheckInterval, - closed: req.Closed, - accessGrants: req.AccessGrants, - handler: be, - } - - i.a.shares[shr.Token] = agentShr - go func() { - if err := agentShr.handler.Run(); err != nil { - logrus.Errorf("error running web backend: %v", err) - } - }() - } - - return &agentGrpc.PublicShareReply{Token: shr.Token}, nil + return &agentGrpc.PublicShareReply{}, nil } diff --git a/agent/releaseShare.go b/agent/releaseShare.go index 048cf526..deb5af59 100755 --- a/agent/releaseShare.go +++ b/agent/releaseShare.go @@ -3,34 +3,19 @@ package agent import ( "context" "github.com/openziti/zrok/agent/agentGrpc" - "github.com/openziti/zrok/environment" - "github.com/openziti/zrok/sdk/golang/sdk" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) func (i *agentGrpcImpl) ReleaseShare(_ context.Context, req *agentGrpc.ReleaseShareRequest) (*agentGrpc.ReleaseShareReply, error) { if shr, found := i.a.shares[req.Token]; found { - logrus.Infof("stopping share '%v'", shr.shr.Token) + logrus.Infof("stopping share '%v'", shr.token) if err := shr.handler.Stop(); err != nil { - logrus.Errorf("error stopping share '%v': %v", shr.shr.Token, err) + logrus.Errorf("error stopping share '%v': %v", shr.token, err) } - root, err := environment.LoadRoot() - if err != nil { - return nil, err - } - - if !root.IsEnabled() { - return nil, errors.New("unable to load environment; did you 'zrok enable'?") - } - - if err := sdk.DeleteShare(root, shr.shr); err != nil { - logrus.Errorf("error releasing share '%v': %v", shr.shr.Token, err) - } - - delete(i.a.shares, shr.shr.Token) - logrus.Infof("released share '%v'", shr.shr.Token) + delete(i.a.shares, shr.token) + logrus.Infof("released share '%v'", shr.token) } else { return nil, errors.Errorf("agent has no share with token '%v'", req.Token) } From 56c58ee8876f9b61c041ab4c33a8e6005ce1d1c1 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Thu, 12 Sep 2024 14:05:17 -0400 Subject: [PATCH 25/51] minimal sub-process based agent implementatio (#748) --- agent/model.go | 46 +++++++++++++++++++++++---- agent/publicShare.go | 60 +++++++++++++++++++++++++++++++++++- agent/releaseShare.go | 10 ++++-- cmd/zrok/agentSharePublic.go | 1 - cmd/zrok/sharePublic.go | 32 +++++++++++++++++-- 5 files changed, 137 insertions(+), 12 deletions(-) diff --git a/agent/model.go b/agent/model.go index f2dcf093..1c3989a5 100644 --- a/agent/model.go +++ b/agent/model.go @@ -1,13 +1,18 @@ package agent import ( + "bytes" + "encoding/json" + "github.com/michaelquigley/pfxlog" "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/agent/proctree" "github.com/openziti/zrok/sdk/golang/sdk" "time" ) type share struct { token string + frontendEndpoints []string target string basicAuth []string frontendSelection []string @@ -21,7 +26,39 @@ type share struct { closed bool accessGrants []string - handler backendHandler + process *proctree.Child + readBuffer bytes.Buffer + ready chan struct{} +} + +func (s *share) tail(data []byte) { + s.readBuffer.Write(data) + if line, err := s.readBuffer.ReadString('\n'); err == nil { + if s.token == "" { + in := make(map[string]interface{}) + if err := json.Unmarshal([]byte(line), &in); err == nil { + if v, found := in["token"]; found { + if str, ok := v.(string); ok { + s.token = str + } + } + if v, found := in["frontend_endpoints"]; found { + if vArr, ok := v.([]interface{}); ok { + for _, v := range vArr { + if str, ok := v.(string); ok { + s.frontendEndpoints = append(s.frontendEndpoints, str) + } + } + } + } + } + close(s.ready) + } else { + pfxlog.ChannelLogger(s.token).Info(string(line)) + } + } else { + s.readBuffer.WriteString(line) + } } type access struct { @@ -29,14 +66,11 @@ type access struct { bindAddress string responseHeaders []string + + process *proctree.Child } type agentGrpcImpl struct { agentGrpc.UnimplementedAgentServer a *Agent } - -type backendHandler interface { - Run() error - Stop() error -} diff --git a/agent/publicShare.go b/agent/publicShare.go index 6bf8a18e..94c5113c 100644 --- a/agent/publicShare.go +++ b/agent/publicShare.go @@ -4,7 +4,10 @@ import ( "context" "errors" "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/agent/proctree" "github.com/openziti/zrok/environment" + "github.com/sirupsen/logrus" + "os" ) func (i *agentGrpcImpl) PublicShare(_ context.Context, req *agentGrpc.PublicShareRequest) (*agentGrpc.PublicShareReply, error) { @@ -17,5 +20,60 @@ func (i *agentGrpcImpl) PublicShare(_ context.Context, req *agentGrpc.PublicShar return nil, errors.New("unable to load environment; did you 'zrok enable'?") } - return &agentGrpc.PublicShareReply{}, nil + shr := &share{ready: make(chan struct{})} + shrCmd := []string{os.Args[0], "share", "public", "--agent", "-b", req.BackendMode} + + for _, basicAuth := range req.BasicAuth { + shrCmd = append(shrCmd, "--basic-auth", basicAuth) + } + shr.basicAuth = req.BasicAuth + + for _, frontendSelection := range req.FrontendSelection { + shrCmd = append(shrCmd, "--frontend", frontendSelection) + } + shr.frontendSelection = req.FrontendSelection + + if req.Insecure { + shrCmd = append(shrCmd, "--insecure") + } + shr.insecure = req.Insecure + + if req.OauthProvider != "" { + shrCmd = append(shrCmd, "--oauth-provider", req.OauthProvider) + } + shr.oauthProvider = req.OauthProvider + + for _, pattern := range req.OauthEmailAddressPatterns { + shrCmd = append(shrCmd, "--oauth-email-address-patterns", pattern) + } + shr.oauthEmailAddressPatterns = req.OauthEmailAddressPatterns + + if req.OauthCheckInterval != "" { + shrCmd = append(shrCmd, "--oauth-check-interval", req.OauthCheckInterval) + } + + if req.Closed { + shrCmd = append(shrCmd, "--closed") + } + shr.closed = req.Closed + + for _, grant := range req.AccessGrants { + shrCmd = append(shrCmd, "--access-grant", grant) + } + shr.accessGrants = req.AccessGrants + + shrCmd = append(shrCmd, req.Target) + shr.target = req.Target + + logrus.Infof("executing '%v'", shrCmd) + + shr.process, err = proctree.StartChild(shr.tail, shrCmd...) + if err != nil { + return nil, err + } + + <-shr.ready + i.a.shares[shr.token] = shr + + return &agentGrpc.PublicShareReply{Token: shr.token}, nil } diff --git a/agent/releaseShare.go b/agent/releaseShare.go index deb5af59..7dcd1d49 100755 --- a/agent/releaseShare.go +++ b/agent/releaseShare.go @@ -3,6 +3,7 @@ package agent import ( "context" "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/agent/proctree" "github.com/pkg/errors" "github.com/sirupsen/logrus" ) @@ -10,8 +11,13 @@ import ( func (i *agentGrpcImpl) ReleaseShare(_ context.Context, req *agentGrpc.ReleaseShareRequest) (*agentGrpc.ReleaseShareReply, error) { if shr, found := i.a.shares[req.Token]; found { logrus.Infof("stopping share '%v'", shr.token) - if err := shr.handler.Stop(); err != nil { - logrus.Errorf("error stopping share '%v': %v", shr.token, err) + + if err := proctree.StopChild(shr.process); err != nil { + logrus.Error(err) + } + + if err := proctree.WaitChild(shr.process); err != nil { + logrus.Error(err) } delete(i.a.shares, shr.token) diff --git a/cmd/zrok/agentSharePublic.go b/cmd/zrok/agentSharePublic.go index 03da860f..ae0bbf1d 100644 --- a/cmd/zrok/agentSharePublic.go +++ b/cmd/zrok/agentSharePublic.go @@ -47,7 +47,6 @@ func newAgentSharePublicCommand() *agentSharePublicCommand { cmd.Flags().BoolVar(&command.insecure, "insecure", false, "Enable insecure TLS certificate validation for ") cmd.Flags().BoolVar(&command.closed, "closed", false, "Enable closed permission mode (see --access-grant)") cmd.Flags().StringArrayVar(&command.accessGrants, "access-grant", []string{}, "zrok accounts that are allowed to access this share (see --closed)") - cmd.Flags().StringArrayVar(&command.basicAuth, "basic-auth", []string{}, "Basic authentication users (,...)") cmd.Flags().StringVar(&command.oauthProvider, "oauth-provider", "", "Enable OAuth provider [google, github]") cmd.Flags().StringArrayVar(&command.oauthEmailAddressPatterns, "oauth-email-address-patterns", []string{}, "Allow only these email domain globs to authenticate via OAuth") diff --git a/cmd/zrok/sharePublic.go b/cmd/zrok/sharePublic.go index d66867df..ac566238 100644 --- a/cmd/zrok/sharePublic.go +++ b/cmd/zrok/sharePublic.go @@ -1,6 +1,7 @@ package main import ( + "encoding/json" "fmt" tea "github.com/charmbracelet/bubbletea" "github.com/gobwas/glob" @@ -29,6 +30,7 @@ type sharePublicCommand struct { frontendSelection []string backendMode string headless bool + agent bool insecure bool oauthProvider string oauthEmailAddressPatterns []string @@ -53,10 +55,11 @@ func newSharePublicCommand() *sharePublicCommand { cmd.Flags().StringArrayVar(&command.frontendSelection, "frontend", defaultFrontends, "Selected frontends to use for the share") cmd.Flags().StringVarP(&command.backendMode, "backend-mode", "b", "proxy", "The backend mode {proxy, web, caddy, drive}") cmd.Flags().BoolVar(&command.headless, "headless", false, "Disable TUI and run headless") + cmd.Flags().BoolVar(&command.agent, "agent", false, "Enable agent mode") + cmd.MarkFlagsMutuallyExclusive("headless", "agent") cmd.Flags().BoolVar(&command.insecure, "insecure", false, "Enable insecure TLS certificate validation for ") cmd.Flags().BoolVar(&command.closed, "closed", false, "Enable closed permission mode (see --access-grant)") cmd.Flags().StringArrayVar(&command.accessGrants, "access-grant", []string{}, "zrok accounts that are allowed to access this share (see --closed)") - cmd.Flags().StringArrayVar(&command.basicAuth, "basic-auth", []string{}, "Basic authentication users (,...)") cmd.Flags().StringVar(&command.oauthProvider, "oauth-provider", "", "Enable OAuth provider [google, github]") cmd.Flags().StringArrayVar(&command.oauthEmailAddressPatterns, "oauth-email-address-patterns", []string{}, "Allow only these email domain globs to authenticate via OAuth") @@ -150,7 +153,7 @@ func (cmd *sharePublicCommand) run(_ *cobra.Command, args []string) { } mdl := newShareModel(shr.Token, shr.FrontendEndpoints, sdk.PublicShareMode, sdk.BackendMode(cmd.backendMode)) - if !cmd.headless { + if !cmd.headless && !cmd.agent { proxy.SetCaddyLoggingWriter(mdl) } @@ -267,6 +270,31 @@ func (cmd *sharePublicCommand) run(_ *cobra.Command, args []string) { } } + } else if cmd.agent { + data := make(map[string]interface{}) + data["token"] = shr.Token + data["frontend_endpoints"] = shr.FrontendEndpoints + jsonData, err := json.Marshal(data) + if err != nil { + panic(err) + } + fmt.Println(string(jsonData)) + + for { + select { + case req := <-requests: + data := make(map[string]interface{}) + data["remote-address"] = req.RemoteAddr + data["method"] = req.Method + data["path"] = req.Path + jsonData, err := json.Marshal(data) + if err != nil { + fmt.Println(err) + } + fmt.Println(string(jsonData)) + } + } + } else { logrus.SetOutput(mdl) prg := tea.NewProgram(mdl, tea.WithAltScreen()) From d26de73464e5fc4d3b7926e2c1e913e6fce669d7 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Thu, 12 Sep 2024 14:08:22 -0400 Subject: [PATCH 26/51] return frontend endpoints, also (#748) --- agent/agentGrpc/agent.pb.go | 163 +++++++++++++++++-------------- agent/agentGrpc/agent.proto | 1 + agent/agentGrpc/agent_grpc.pb.go | 2 +- agent/publicShare.go | 5 +- cmd/zrok/agentSharePublic.go | 2 +- 5 files changed, 94 insertions(+), 79 deletions(-) diff --git a/agent/agentGrpc/agent.pb.go b/agent/agentGrpc/agent.pb.go index 82b95f38..2e7ecc1a 100644 --- a/agent/agentGrpc/agent.pb.go +++ b/agent/agentGrpc/agent.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.34.2 -// protoc v5.27.4 +// protoc v5.27.3 // source: agent/agentGrpc/agent.proto package agentGrpc @@ -88,7 +88,8 @@ type PublicShareReply struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + FrontendEndpoints []string `protobuf:"bytes,2,rep,name=frontendEndpoints,proto3" json:"frontendEndpoints,omitempty"` } func (x *PublicShareReply) Reset() { @@ -130,6 +131,13 @@ func (x *PublicShareReply) GetToken() string { return "" } +func (x *PublicShareReply) GetFrontendEndpoints() []string { + if x != nil { + return x.FrontendEndpoints + } + return nil +} + type PublicShareRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -627,81 +635,84 @@ var file_agent_agentGrpc_agent_proto_rawDesc = []byte{ 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, - 0x28, 0x0a, 0x10, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, + 0x56, 0x0a, 0x10, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x86, 0x03, 0x0a, 0x12, 0x50, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x69, - 0x63, 0x41, 0x75, 0x74, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x62, 0x61, 0x73, - 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, 0x2c, 0x0a, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, - 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, - 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, - 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, - 0x72, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, - 0x64, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6f, 0x61, 0x75, 0x74, 0x68, - 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x19, 0x6f, 0x61, 0x75, 0x74, - 0x68, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x19, 0x6f, 0x61, 0x75, - 0x74, 0x68, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x12, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x08, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x12, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, - 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, - 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x22, - 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x0a, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, - 0x74, 0x73, 0x22, 0x2b, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, - 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, - 0x13, 0x0a, 0x11, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, - 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, - 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, - 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, - 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, - 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, - 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, - 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, - 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, - 0x6f, 0x73, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x0f, 0x0a, 0x0d, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5e, 0x0a, - 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x29, 0x0a, 0x08, - 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, - 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, - 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, - 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, - 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, - 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0xd3, 0x01, - 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, - 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, - 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x50, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, - 0x12, 0x3a, 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, - 0x12, 0x14, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, - 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x06, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, - 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2c, 0x0a, 0x11, 0x66, 0x72, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, + 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x22, 0x86, 0x03, 0x0a, 0x12, 0x50, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, + 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x69, 0x63, 0x41, + 0x75, 0x74, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x62, 0x61, 0x73, 0x69, 0x63, + 0x41, 0x75, 0x74, 0x68, 0x12, 0x2c, 0x0a, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, + 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, + 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, + 0x12, 0x24, 0x0a, 0x0d, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x50, 0x72, + 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x19, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x45, + 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x19, 0x6f, 0x61, 0x75, 0x74, 0x68, + 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x12, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x12, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, + 0x72, 0x76, 0x61, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, + 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x0a, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, + 0x22, 0x2b, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x13, 0x0a, + 0x11, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x68, 0x61, + 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, + 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, + 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, + 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, + 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, + 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, + 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, + 0x6f, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, + 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5e, 0x0a, 0x0b, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, + 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, + 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0xd3, 0x01, 0x0a, 0x05, + 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, + 0x68, 0x61, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, + 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x50, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, + 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, + 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, + 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x06, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, + 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, + 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/agent/agentGrpc/agent.proto b/agent/agentGrpc/agent.proto index 65ea8e16..f373dde5 100644 --- a/agent/agentGrpc/agent.proto +++ b/agent/agentGrpc/agent.proto @@ -17,6 +17,7 @@ message AccessDetail { message PublicShareReply { string token = 1; + repeated string frontendEndpoints = 2; } message PublicShareRequest { diff --git a/agent/agentGrpc/agent_grpc.pb.go b/agent/agentGrpc/agent_grpc.pb.go index 6e7116d7..c643ce71 100644 --- a/agent/agentGrpc/agent_grpc.pb.go +++ b/agent/agentGrpc/agent_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.5.1 -// - protoc v5.27.4 +// - protoc v5.27.3 // source: agent/agentGrpc/agent.proto package agentGrpc diff --git a/agent/publicShare.go b/agent/publicShare.go index 94c5113c..4337eb90 100644 --- a/agent/publicShare.go +++ b/agent/publicShare.go @@ -75,5 +75,8 @@ func (i *agentGrpcImpl) PublicShare(_ context.Context, req *agentGrpc.PublicShar <-shr.ready i.a.shares[shr.token] = shr - return &agentGrpc.PublicShareReply{Token: shr.token}, nil + return &agentGrpc.PublicShareReply{ + Token: shr.token, + FrontendEndpoints: shr.frontendEndpoints, + }, nil } diff --git a/cmd/zrok/agentSharePublic.go b/cmd/zrok/agentSharePublic.go index ae0bbf1d..352d4c43 100644 --- a/cmd/zrok/agentSharePublic.go +++ b/cmd/zrok/agentSharePublic.go @@ -106,5 +106,5 @@ func (cmd *agentSharePublicCommand) run(_ *cobra.Command, args []string) { tui.Error("error creating share", err) } - fmt.Println(shr.GetToken()) + fmt.Println(shr) } From 054788cd1897f749aa0d94206c86b7bccc751461 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Thu, 12 Sep 2024 14:12:46 -0400 Subject: [PATCH 27/51] tail function (#748) --- agent/model.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/agent/model.go b/agent/model.go index 1c3989a5..bf63520f 100644 --- a/agent/model.go +++ b/agent/model.go @@ -7,6 +7,7 @@ import ( "github.com/openziti/zrok/agent/agentGrpc" "github.com/openziti/zrok/agent/proctree" "github.com/openziti/zrok/sdk/golang/sdk" + "strings" "time" ) @@ -54,7 +55,14 @@ func (s *share) tail(data []byte) { } close(s.ready) } else { - pfxlog.ChannelLogger(s.token).Info(string(line)) + if strings.HasPrefix(line, "{") { + in := make(map[string]interface{}) + if err := json.Unmarshal([]byte(line), &in); err == nil { + pfxlog.ChannelLogger(s.token).Info(in) + } + } else { + pfxlog.ChannelLogger(s.token).Info(strings.Trim(line, "\n")) + } } } else { s.readBuffer.WriteString(line) From 8525348d2168c33e1b22d0cb4de87625949b13d3 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Thu, 12 Sep 2024 14:25:25 -0400 Subject: [PATCH 28/51] lint (#463) --- agent/publicShare.go | 7 ++++++- cmd/zrok/agentSharePublic.go | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/agent/publicShare.go b/agent/publicShare.go index 4337eb90..e35c6ec9 100644 --- a/agent/publicShare.go +++ b/agent/publicShare.go @@ -6,6 +6,7 @@ import ( "github.com/openziti/zrok/agent/agentGrpc" "github.com/openziti/zrok/agent/proctree" "github.com/openziti/zrok/environment" + "github.com/openziti/zrok/sdk/golang/sdk" "github.com/sirupsen/logrus" "os" ) @@ -20,8 +21,12 @@ func (i *agentGrpcImpl) PublicShare(_ context.Context, req *agentGrpc.PublicShar return nil, errors.New("unable to load environment; did you 'zrok enable'?") } - shr := &share{ready: make(chan struct{})} shrCmd := []string{os.Args[0], "share", "public", "--agent", "-b", req.BackendMode} + shr := &share{ + shareMode: sdk.PublicShareMode, + backendMode: sdk.BackendMode(req.BackendMode), + ready: make(chan struct{}), + } for _, basicAuth := range req.BasicAuth { shrCmd = append(shrCmd, "--basic-auth", basicAuth) diff --git a/cmd/zrok/agentSharePublic.go b/cmd/zrok/agentSharePublic.go index 352d4c43..b770630e 100644 --- a/cmd/zrok/agentSharePublic.go +++ b/cmd/zrok/agentSharePublic.go @@ -8,6 +8,7 @@ import ( "github.com/openziti/zrok/environment" "github.com/openziti/zrok/tui" "github.com/spf13/cobra" + "path/filepath" "time" ) @@ -70,6 +71,16 @@ func (cmd *agentSharePublicCommand) run(_ *cobra.Command, args []string) { panic(err) } target = v + + case "web": + var err error + target, err = filepath.Abs(args[0]) + if err != nil { + panic(err) + } + + default: + target = args[0] } root, err := environment.LoadRoot() From 2cf484e1c5e40585415bbd116d2b4efea046b71f Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 13 Sep 2024 14:39:30 -0400 Subject: [PATCH 29/51] better share lifecycle monitoring and error handling (#463) --- agent/agent.go | 33 ++++++++++++++++++++++++++++++--- agent/model.go | 27 ++++++++++++++++++++++----- agent/publicShare.go | 25 +++++++++++++++---------- 3 files changed, 67 insertions(+), 18 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index adea2da9..7eb30359 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -14,7 +14,11 @@ type Agent struct { root env_core.Root agentSocket string shares map[string]*share + inShares chan *share + outShares chan *share accesses map[string]*access + inAccesses chan *access + outAccesses chan *access } func NewAgent(root env_core.Root) (*Agent, error) { @@ -22,15 +26,21 @@ func NewAgent(root env_core.Root) (*Agent, error) { return nil, errors.Errorf("unable to load environment; did you 'zrok enable'?") } return &Agent{ - root: root, - shares: make(map[string]*share), - accesses: make(map[string]*access), + root: root, + shares: make(map[string]*share), + inShares: make(chan *share), + outShares: make(chan *share), + accesses: make(map[string]*access), + inAccesses: make(chan *access), + outAccesses: make(chan *access), }, nil } func (a *Agent) Run() error { logrus.Infof("started") + go a.manager() + agentSocket, err := a.root.AgentSocket() if err != nil { return err @@ -55,3 +65,20 @@ func (a *Agent) Shutdown() { logrus.Warnf("unable to remove agent socket: %v", err) } } + +func (a *Agent) manager() { + logrus.Info("started") + defer logrus.Warn("exited") + + for { + select { + case inShare := <-a.inShares: + logrus.Infof("adding new share '%v'", inShare.token) + a.shares[inShare.token] = inShare + + case outShare := <-a.outShares: + logrus.Infof("removing share '%v'", outShare.token) + delete(a.shares, outShare.token) + } + } +} diff --git a/agent/model.go b/agent/model.go index bf63520f..42371ea3 100644 --- a/agent/model.go +++ b/agent/model.go @@ -7,6 +7,7 @@ import ( "github.com/openziti/zrok/agent/agentGrpc" "github.com/openziti/zrok/agent/proctree" "github.com/openziti/zrok/sdk/golang/sdk" + "github.com/pkg/errors" "strings" "time" ) @@ -27,15 +28,27 @@ type share struct { closed bool accessGrants []string - process *proctree.Child - readBuffer bytes.Buffer - ready chan struct{} + process *proctree.Child + readBuffer bytes.Buffer + booted bool + bootComplete chan struct{} + bootErr error + + a *Agent +} + +func (s *share) monitor() { + if err := proctree.WaitChild(s.process); err != nil { + pfxlog.ChannelLogger(s.token).Error(err) + } + s.a.outShares <- s } func (s *share) tail(data []byte) { s.readBuffer.Write(data) if line, err := s.readBuffer.ReadString('\n'); err == nil { - if s.token == "" { + line = strings.Trim(line, "\n") + if !s.booted { in := make(map[string]interface{}) if err := json.Unmarshal([]byte(line), &in); err == nil { if v, found := in["token"]; found { @@ -52,8 +65,12 @@ func (s *share) tail(data []byte) { } } } + s.booted = true + } else { + s.bootErr = errors.New(line) } - close(s.ready) + close(s.bootComplete) + } else { if strings.HasPrefix(line, "{") { in := make(map[string]interface{}) diff --git a/agent/publicShare.go b/agent/publicShare.go index e35c6ec9..5253b85b 100644 --- a/agent/publicShare.go +++ b/agent/publicShare.go @@ -23,9 +23,10 @@ func (i *agentGrpcImpl) PublicShare(_ context.Context, req *agentGrpc.PublicShar shrCmd := []string{os.Args[0], "share", "public", "--agent", "-b", req.BackendMode} shr := &share{ - shareMode: sdk.PublicShareMode, - backendMode: sdk.BackendMode(req.BackendMode), - ready: make(chan struct{}), + shareMode: sdk.PublicShareMode, + backendMode: sdk.BackendMode(req.BackendMode), + bootComplete: make(chan struct{}), + a: i.a, } for _, basicAuth := range req.BasicAuth { @@ -74,14 +75,18 @@ func (i *agentGrpcImpl) PublicShare(_ context.Context, req *agentGrpc.PublicShar shr.process, err = proctree.StartChild(shr.tail, shrCmd...) if err != nil { - return nil, err + return &agentGrpc.PublicShareReply{}, err } - <-shr.ready - i.a.shares[shr.token] = shr + go shr.monitor() + <-shr.bootComplete - return &agentGrpc.PublicShareReply{ - Token: shr.token, - FrontendEndpoints: shr.frontendEndpoints, - }, nil + if shr.bootErr == nil { + i.a.inShares <- shr + return &agentGrpc.PublicShareReply{ + Token: shr.token, + FrontendEndpoints: shr.frontendEndpoints, + }, nil + } + return &agentGrpc.PublicShareReply{}, shr.bootErr } From 9a909150343fbe394af401685d6966f2773a2803 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 13 Sep 2024 14:40:55 -0400 Subject: [PATCH 30/51] better file names (#463) --- agent/access.go | 20 ++++++++++++++++++++ agent/{model.go => share.go} | 17 +---------------- 2 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 agent/access.go rename agent/{model.go => share.go} (88%) diff --git a/agent/access.go b/agent/access.go new file mode 100644 index 00000000..739c3488 --- /dev/null +++ b/agent/access.go @@ -0,0 +1,20 @@ +package agent + +import ( + "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/agent/proctree" +) + +type access struct { + token string + + bindAddress string + responseHeaders []string + + process *proctree.Child +} + +type agentGrpcImpl struct { + agentGrpc.UnimplementedAgentServer + a *Agent +} diff --git a/agent/model.go b/agent/share.go similarity index 88% rename from agent/model.go rename to agent/share.go index 42371ea3..d1f74d97 100644 --- a/agent/model.go +++ b/agent/share.go @@ -3,11 +3,10 @@ package agent import ( "bytes" "encoding/json" + "errors" "github.com/michaelquigley/pfxlog" - "github.com/openziti/zrok/agent/agentGrpc" "github.com/openziti/zrok/agent/proctree" "github.com/openziti/zrok/sdk/golang/sdk" - "github.com/pkg/errors" "strings" "time" ) @@ -85,17 +84,3 @@ func (s *share) tail(data []byte) { s.readBuffer.WriteString(line) } } - -type access struct { - token string - - bindAddress string - responseHeaders []string - - process *proctree.Child -} - -type agentGrpcImpl struct { - agentGrpc.UnimplementedAgentServer - a *Agent -} From 70d5fd7698d66788a5932af53d9d8730b8641595 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 13 Sep 2024 14:48:01 -0400 Subject: [PATCH 31/51] target handling (#463) --- cmd/zrok/agentSharePublic.go | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/cmd/zrok/agentSharePublic.go b/cmd/zrok/agentSharePublic.go index b770630e..2d91774c 100644 --- a/cmd/zrok/agentSharePublic.go +++ b/cmd/zrok/agentSharePublic.go @@ -73,14 +73,37 @@ func (cmd *agentSharePublicCommand) run(_ *cobra.Command, args []string) { target = v case "web": - var err error - target, err = filepath.Abs(args[0]) + v, err := filepath.Abs(args[0]) if err != nil { + if !panicInstead { + tui.Error("invalid target endpoint URL", err) + } panic(err) } + target = v + + case "caddy": + v, err := filepath.Abs(args[0]) + if err != nil { + if !panicInstead { + tui.Error("invalid target endpoint URL", err) + } + panic(err) + } + target = v + + case "drive": + v, err := filepath.Abs(args[0]) + if err != nil { + if !panicInstead { + tui.Error("invalid target endpoint URL", err) + } + panic(err) + } + target = v default: - target = args[0] + tui.Error(fmt.Sprintf("invalid backend mode '%v'", cmd.backendMode), nil) } root, err := environment.LoadRoot() From 5f81992283749b8323bdce49bcbef226695e9e5b Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Fri, 13 Sep 2024 15:59:41 -0400 Subject: [PATCH 32/51] emit the '--agent' bootstrap information as soon as its available (#463) --- cmd/zrok/sharePublic.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/cmd/zrok/sharePublic.go b/cmd/zrok/sharePublic.go index ac566238..e537cbe2 100644 --- a/cmd/zrok/sharePublic.go +++ b/cmd/zrok/sharePublic.go @@ -152,6 +152,17 @@ func (cmd *sharePublicCommand) run(_ *cobra.Command, args []string) { panic(err) } + if cmd.agent { + data := make(map[string]interface{}) + data["token"] = shr.Token + data["frontend_endpoints"] = shr.FrontendEndpoints + jsonData, err := json.Marshal(data) + if err != nil { + panic(err) + } + fmt.Println(string(jsonData)) + } + mdl := newShareModel(shr.Token, shr.FrontendEndpoints, sdk.PublicShareMode, sdk.BackendMode(cmd.backendMode)) if !cmd.headless && !cmd.agent { proxy.SetCaddyLoggingWriter(mdl) @@ -271,15 +282,6 @@ func (cmd *sharePublicCommand) run(_ *cobra.Command, args []string) { } } else if cmd.agent { - data := make(map[string]interface{}) - data["token"] = shr.Token - data["frontend_endpoints"] = shr.FrontendEndpoints - jsonData, err := json.Marshal(data) - if err != nil { - panic(err) - } - fmt.Println(string(jsonData)) - for { select { case req := <-requests: From 9653980a30ff496013e8c720a2db9a6b25514135 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 16 Sep 2024 13:12:12 -0400 Subject: [PATCH 33/51] agent shutdown lifecycle management improvements (#463, #748) --- agent/agent.go | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index 7eb30359..e88f3e84 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -2,6 +2,7 @@ package agent import ( "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/agent/proctree" "github.com/openziti/zrok/environment/env_core" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -61,9 +62,19 @@ func (a *Agent) Run() error { } func (a *Agent) Shutdown() { + logrus.Infof("stopping") + if err := os.Remove(a.agentSocket); err != nil { logrus.Warnf("unable to remove agent socket: %v", err) } + for _, shr := range a.shares { + logrus.Infof("stopping share '%v'", shr.token) + a.outShares <- shr + } + for _, acc := range a.accesses { + logrus.Infof("stopping access '%v'", acc.token) + a.outAccesses <- acc + } } func (a *Agent) manager() { @@ -77,8 +88,18 @@ func (a *Agent) manager() { a.shares[inShare.token] = inShare case outShare := <-a.outShares: - logrus.Infof("removing share '%v'", outShare.token) - delete(a.shares, outShare.token) + if outShare.token != "" { + logrus.Infof("removing share '%v'", outShare.token) + if err := proctree.StopChild(outShare.process); err != nil { + logrus.Errorf("error stopping share '%v': %v", outShare.token, err) + } + if err := proctree.WaitChild(outShare.process); err != nil { + logrus.Errorf("error joining share '%v': %v", outShare.token, err) + } + delete(a.shares, outShare.token) + } else { + logrus.Debug("skipping unidentified (orphaned) share removal") + } } } } From 7747c3a452b46c0016cef4a56644747fdbb54791 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 16 Sep 2024 13:19:12 -0400 Subject: [PATCH 34/51] log lint (#463) --- agent/agent.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index e88f3e84..48220294 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -68,11 +68,11 @@ func (a *Agent) Shutdown() { logrus.Warnf("unable to remove agent socket: %v", err) } for _, shr := range a.shares { - logrus.Infof("stopping share '%v'", shr.token) + logrus.Debugf("stopping share '%v'", shr.token) a.outShares <- shr } for _, acc := range a.accesses { - logrus.Infof("stopping access '%v'", acc.token) + logrus.Debugf("stopping access '%v'", acc.token) a.outAccesses <- acc } } From 14719c18ecb97389375ff4c7c203e87133dd6392 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 16 Sep 2024 13:39:27 -0400 Subject: [PATCH 35/51] ensure that proctree is fully configured (for windows) (#748) --- agent/agent.go | 3 +++ go.mod | 5 +++-- go.sum | 16 ++++------------ 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index 48220294..a8097366 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -40,6 +40,9 @@ func NewAgent(root env_core.Root) (*Agent, error) { func (a *Agent) Run() error { logrus.Infof("started") + if err := proctree.Init("zrok Agent"); err != nil { + return err + } go a.manager() agentSocket, err := a.root.AgentSocket() diff --git a/go.mod b/go.mod index 035e8e94..2e78e7cc 100644 --- a/go.mod +++ b/go.mod @@ -27,6 +27,7 @@ require ( github.com/jedib0t/go-pretty/v6 v6.4.3 github.com/jessevdk/go-flags v1.6.1 github.com/jmoiron/sqlx v1.3.5 + github.com/kolesnikovae/go-winjob v1.0.0 github.com/lib/pq v1.10.9 github.com/mattn/go-sqlite3 v1.14.16 github.com/michaelquigley/cf v0.0.13 @@ -44,7 +45,6 @@ require ( github.com/openziti/transport/v2 v2.0.138 github.com/orcaman/concurrent-map/v2 v2.0.1 github.com/pkg/errors v0.9.1 - github.com/prometheus/common v0.45.0 github.com/rabbitmq/amqp091-go v1.8.1 github.com/rubenv/sql-migrate v1.6.0 github.com/shirou/gopsutil/v3 v3.24.5 @@ -58,6 +58,7 @@ require ( golang.org/x/crypto v0.25.0 golang.org/x/net v0.27.0 golang.org/x/oauth2 v0.21.0 + golang.org/x/sys v0.24.0 golang.org/x/time v0.5.0 google.golang.org/grpc v1.65.0 google.golang.org/protobuf v1.34.2 @@ -198,6 +199,7 @@ require ( github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect github.com/prometheus/client_golang v1.17.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect + github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect github.com/quic-go/qpack v0.4.0 // indirect github.com/quic-go/qtls-go1-20 v0.4.1 // indirect @@ -255,7 +257,6 @@ require ( golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.24.0 // indirect golang.org/x/term v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect diff --git a/go.sum b/go.sum index b00ad2c3..0f477ffb 100644 --- a/go.sum +++ b/go.sum @@ -119,8 +119,6 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charmbracelet/bubbles v0.14.0 h1:DJfCwnARfWjZLvMglhSQzo76UZ2gucuHPy9jLWX45Og= @@ -300,8 +298,6 @@ github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= -github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/glog v1.2.1 h1:OptwRhECazUx5ix5TTWC3EZhsZEHWcYWY4FQHTIubm4= github.com/golang/glog v1.2.1/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -555,6 +551,8 @@ github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6K github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c= github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/kolesnikovae/go-winjob v1.0.0 h1:OKEtCHB3sYNAiqNwGDhf08Y6luM7C8mP+42rp1N6SeE= +github.com/kolesnikovae/go-winjob v1.0.0/go.mod h1:k0joOLP3/NBrRmDQjPV2+oN1TPmEWt6arTNtFjVeQuM= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= @@ -1186,6 +1184,7 @@ golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1406,14 +1405,9 @@ google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 h1:wpZ8pe2x1Q3f2KyT5f8oP/fa9rHAKgFPr/HZdNuS+PQ= -google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f h1:Vn+VyHU5guc9KjB5KrjI2q0wCOWEOIh0OEsleqakHJg= -google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f/go.mod h1:nWSwAFPb+qfNJXsoeO3Io7zf4tMSfN8EA8RlDA04GhY= -google.golang.org/genproto/googleapis/api v0.0.0-20231127180814-3a041ad873d4 h1:ZcOkrmX74HbKFYnpPY8Qsw93fC29TbJXspYKaBkSXDQ= -google.golang.org/genproto/googleapis/api v0.0.0-20231127180814-3a041ad873d4/go.mod h1:k2dtGpRrbsSyKcNPKKI5sstZkrNCZwpU/ns96JoHbGg= +google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:J7XzRzVy1+IPwWHZUzoD0IccYZIrXILAQpc+Qy9CMhY= google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157 h1:7whR9kGa5LUwFtpLm2ArCEejtnxlGeLbAyjFY8sGNFw= google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157/go.mod h1:99sLkeliLXfdj2J75X3Ho+rrVCaJze0uwN7zDDkjPVU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 h1:DC7wcm+i+P1rN3Ff07vL+OndGg5OhNddHyTA+ocPqYE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4/go.mod h1:eJVxU6o+4G1PSczBr85xmyvSNYAKvAYgkub40YGomFM= google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8= google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -1436,8 +1430,6 @@ google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= From 254251a3dc2fe590bf68d4d24b0e119f8721dbb7 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 16 Sep 2024 13:58:24 -0400 Subject: [PATCH 36/51] updated grpc for private shares (#463) --- agent/agentGrpc/agent.pb.go | 369 ++++++++++++++++++++++--------- agent/agentGrpc/agent.proto | 13 ++ agent/agentGrpc/agent_grpc.pb.go | 38 ++++ 3 files changed, 321 insertions(+), 99 deletions(-) diff --git a/agent/agentGrpc/agent.pb.go b/agent/agentGrpc/agent.pb.go index 2e7ecc1a..7518313c 100644 --- a/agent/agentGrpc/agent.pb.go +++ b/agent/agentGrpc/agent.pb.go @@ -257,6 +257,132 @@ func (x *PublicShareRequest) GetAccessGrants() []string { return nil } +type PrivateShareReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` +} + +func (x *PrivateShareReply) Reset() { + *x = PrivateShareReply{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PrivateShareReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrivateShareReply) ProtoMessage() {} + +func (x *PrivateShareReply) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 PrivateShareReply.ProtoReflect.Descriptor instead. +func (*PrivateShareReply) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{3} +} + +func (x *PrivateShareReply) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +type PrivateShareRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` + BackendMode string `protobuf:"bytes,2,opt,name=backendMode,proto3" json:"backendMode,omitempty"` + Insecure bool `protobuf:"varint,3,opt,name=insecure,proto3" json:"insecure,omitempty"` + Closed bool `protobuf:"varint,4,opt,name=closed,proto3" json:"closed,omitempty"` + AccessGrants []string `protobuf:"bytes,5,rep,name=accessGrants,proto3" json:"accessGrants,omitempty"` +} + +func (x *PrivateShareRequest) Reset() { + *x = PrivateShareRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PrivateShareRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrivateShareRequest) ProtoMessage() {} + +func (x *PrivateShareRequest) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 PrivateShareRequest.ProtoReflect.Descriptor instead. +func (*PrivateShareRequest) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{4} +} + +func (x *PrivateShareRequest) GetTarget() string { + if x != nil { + return x.Target + } + return "" +} + +func (x *PrivateShareRequest) GetBackendMode() string { + if x != nil { + return x.BackendMode + } + return "" +} + +func (x *PrivateShareRequest) GetInsecure() bool { + if x != nil { + return x.Insecure + } + return false +} + +func (x *PrivateShareRequest) GetClosed() bool { + if x != nil { + return x.Closed + } + return false +} + +func (x *PrivateShareRequest) GetAccessGrants() []string { + if x != nil { + return x.AccessGrants + } + return nil +} + type ReleaseShareRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -268,7 +394,7 @@ type ReleaseShareRequest struct { func (x *ReleaseShareRequest) Reset() { *x = ReleaseShareRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[3] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -281,7 +407,7 @@ func (x *ReleaseShareRequest) String() string { func (*ReleaseShareRequest) ProtoMessage() {} func (x *ReleaseShareRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[3] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -294,7 +420,7 @@ func (x *ReleaseShareRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReleaseShareRequest.ProtoReflect.Descriptor instead. func (*ReleaseShareRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{3} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{5} } func (x *ReleaseShareRequest) GetToken() string { @@ -313,7 +439,7 @@ type ReleaseShareReply struct { func (x *ReleaseShareReply) Reset() { *x = ReleaseShareReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[4] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -326,7 +452,7 @@ func (x *ReleaseShareReply) String() string { func (*ReleaseShareReply) ProtoMessage() {} func (x *ReleaseShareReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[4] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -339,7 +465,7 @@ func (x *ReleaseShareReply) ProtoReflect() protoreflect.Message { // Deprecated: Use ReleaseShareReply.ProtoReflect.Descriptor instead. func (*ReleaseShareReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{4} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{6} } type ShareDetail struct { @@ -360,7 +486,7 @@ type ShareDetail struct { func (x *ShareDetail) Reset() { *x = ShareDetail{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -373,7 +499,7 @@ func (x *ShareDetail) String() string { func (*ShareDetail) ProtoMessage() {} func (x *ShareDetail) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -386,7 +512,7 @@ func (x *ShareDetail) ProtoReflect() protoreflect.Message { // Deprecated: Use ShareDetail.ProtoReflect.Descriptor instead. func (*ShareDetail) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{5} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{7} } func (x *ShareDetail) GetToken() string { @@ -454,7 +580,7 @@ type StatusRequest struct { func (x *StatusRequest) Reset() { *x = StatusRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[6] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -467,7 +593,7 @@ func (x *StatusRequest) String() string { func (*StatusRequest) ProtoMessage() {} func (x *StatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[6] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -480,7 +606,7 @@ func (x *StatusRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead. func (*StatusRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{6} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{8} } type StatusReply struct { @@ -495,7 +621,7 @@ type StatusReply struct { func (x *StatusReply) Reset() { *x = StatusReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -508,7 +634,7 @@ func (x *StatusReply) String() string { func (*StatusReply) ProtoMessage() {} func (x *StatusReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -521,7 +647,7 @@ func (x *StatusReply) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusReply.ProtoReflect.Descriptor instead. func (*StatusReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{7} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{9} } func (x *StatusReply) GetAccesses() []*AccessDetail { @@ -547,7 +673,7 @@ type VersionRequest struct { func (x *VersionRequest) Reset() { *x = VersionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[8] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -560,7 +686,7 @@ func (x *VersionRequest) String() string { func (*VersionRequest) ProtoMessage() {} func (x *VersionRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[8] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -573,7 +699,7 @@ func (x *VersionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionRequest.ProtoReflect.Descriptor instead. func (*VersionRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{8} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{10} } type VersionReply struct { @@ -587,7 +713,7 @@ type VersionReply struct { func (x *VersionReply) Reset() { *x = VersionReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[9] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -600,7 +726,7 @@ func (x *VersionReply) String() string { func (*VersionReply) ProtoMessage() {} func (x *VersionReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[9] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -613,7 +739,7 @@ func (x *VersionReply) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionReply.ProtoReflect.Descriptor instead. func (*VersionReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{9} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{11} } func (x *VersionReply) GetV() string { @@ -665,54 +791,71 @@ var file_agent_agentGrpc_agent_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, - 0x22, 0x2b, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x13, 0x0a, - 0x11, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, - 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, - 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x68, 0x61, - 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, - 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, - 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, - 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, - 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, - 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, - 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, - 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, - 0x6f, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, - 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5e, 0x0a, 0x0b, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, - 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, - 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, - 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0xd3, 0x01, 0x0a, 0x05, - 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, - 0x68, 0x61, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, - 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x50, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, - 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, - 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, - 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x06, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, - 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, - 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x22, 0x29, 0x0a, 0x11, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xa7, 0x01, 0x0a, 0x13, + 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x62, + 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, + 0x73, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, + 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, + 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, + 0x72, 0x61, 0x6e, 0x74, 0x73, 0x22, 0x2b, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, + 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x22, 0x13, 0x0a, 0x11, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, + 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, + 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, + 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, + 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, + 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, + 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, + 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, + 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x22, 0x5e, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, + 0x29, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, + 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, + 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, + 0x22, 0x10, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, + 0x32, 0x8f, 0x02, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x0b, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, + 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, + 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, + 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x50, 0x72, 0x69, 0x76, + 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, + 0x3a, 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, + 0x14, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, + 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x06, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, + 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -727,35 +870,39 @@ func file_agent_agentGrpc_agent_proto_rawDescGZIP() []byte { return file_agent_agentGrpc_agent_proto_rawDescData } -var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 12) var file_agent_agentGrpc_agent_proto_goTypes = []any{ (*AccessDetail)(nil), // 0: AccessDetail (*PublicShareReply)(nil), // 1: PublicShareReply (*PublicShareRequest)(nil), // 2: PublicShareRequest - (*ReleaseShareRequest)(nil), // 3: ReleaseShareRequest - (*ReleaseShareReply)(nil), // 4: ReleaseShareReply - (*ShareDetail)(nil), // 5: ShareDetail - (*StatusRequest)(nil), // 6: StatusRequest - (*StatusReply)(nil), // 7: StatusReply - (*VersionRequest)(nil), // 8: VersionRequest - (*VersionReply)(nil), // 9: VersionReply + (*PrivateShareReply)(nil), // 3: PrivateShareReply + (*PrivateShareRequest)(nil), // 4: PrivateShareRequest + (*ReleaseShareRequest)(nil), // 5: ReleaseShareRequest + (*ReleaseShareReply)(nil), // 6: ReleaseShareReply + (*ShareDetail)(nil), // 7: ShareDetail + (*StatusRequest)(nil), // 8: StatusRequest + (*StatusReply)(nil), // 9: StatusReply + (*VersionRequest)(nil), // 10: VersionRequest + (*VersionReply)(nil), // 11: VersionReply } var file_agent_agentGrpc_agent_proto_depIdxs = []int32{ - 0, // 0: StatusReply.accesses:type_name -> AccessDetail - 5, // 1: StatusReply.shares:type_name -> ShareDetail - 2, // 2: Agent.PublicShare:input_type -> PublicShareRequest - 3, // 3: Agent.ReleaseShare:input_type -> ReleaseShareRequest - 6, // 4: Agent.Status:input_type -> StatusRequest - 8, // 5: Agent.Version:input_type -> VersionRequest - 1, // 6: Agent.PublicShare:output_type -> PublicShareReply - 4, // 7: Agent.ReleaseShare:output_type -> ReleaseShareReply - 7, // 8: Agent.Status:output_type -> StatusReply - 9, // 9: Agent.Version:output_type -> VersionReply - 6, // [6:10] is the sub-list for method output_type - 2, // [2:6] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 0, // 0: StatusReply.accesses:type_name -> AccessDetail + 7, // 1: StatusReply.shares:type_name -> ShareDetail + 2, // 2: Agent.PublicShare:input_type -> PublicShareRequest + 4, // 3: Agent.PrivateShare:input_type -> PrivateShareRequest + 5, // 4: Agent.ReleaseShare:input_type -> ReleaseShareRequest + 8, // 5: Agent.Status:input_type -> StatusRequest + 10, // 6: Agent.Version:input_type -> VersionRequest + 1, // 7: Agent.PublicShare:output_type -> PublicShareReply + 3, // 8: Agent.PrivateShare:output_type -> PrivateShareReply + 6, // 9: Agent.ReleaseShare:output_type -> ReleaseShareReply + 9, // 10: Agent.Status:output_type -> StatusReply + 11, // 11: Agent.Version:output_type -> VersionReply + 7, // [7:12] is the sub-list for method output_type + 2, // [2:7] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_agent_agentGrpc_agent_proto_init() } @@ -801,7 +948,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*ReleaseShareRequest); i { + switch v := v.(*PrivateShareReply); i { case 0: return &v.state case 1: @@ -813,7 +960,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*ReleaseShareReply); i { + switch v := v.(*PrivateShareRequest); i { case 0: return &v.state case 1: @@ -825,7 +972,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*ShareDetail); i { + switch v := v.(*ReleaseShareRequest); i { case 0: return &v.state case 1: @@ -837,7 +984,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*StatusRequest); i { + switch v := v.(*ReleaseShareReply); i { case 0: return &v.state case 1: @@ -849,7 +996,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*StatusReply); i { + switch v := v.(*ShareDetail); i { case 0: return &v.state case 1: @@ -861,7 +1008,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*VersionRequest); i { + switch v := v.(*StatusRequest); i { case 0: return &v.state case 1: @@ -873,6 +1020,30 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[9].Exporter = func(v any, i int) any { + switch v := v.(*StatusReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[10].Exporter = func(v any, i int) any { + switch v := v.(*VersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[11].Exporter = func(v any, i int) any { switch v := v.(*VersionReply); i { case 0: return &v.state @@ -891,7 +1062,7 @@ func file_agent_agentGrpc_agent_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_agent_agentGrpc_agent_proto_rawDesc, NumEnums: 0, - NumMessages: 10, + NumMessages: 12, NumExtensions: 0, NumServices: 1, }, diff --git a/agent/agentGrpc/agent.proto b/agent/agentGrpc/agent.proto index f373dde5..dfa77a3e 100644 --- a/agent/agentGrpc/agent.proto +++ b/agent/agentGrpc/agent.proto @@ -4,6 +4,7 @@ option go_package = "github.com/openziti/zrok/agent/agentGrpc"; service Agent { rpc PublicShare(PublicShareRequest) returns (PublicShareReply) {} + rpc PrivateShare(PrivateShareRequest) returns (PrivateShareReply) {} rpc ReleaseShare(ReleaseShareRequest) returns (ReleaseShareReply) {} rpc Status(StatusRequest) returns (StatusReply) {} rpc Version(VersionRequest) returns (VersionReply) {} @@ -33,6 +34,18 @@ message PublicShareRequest { repeated string accessGrants = 10; } +message PrivateShareReply { + string token = 1; +} + +message PrivateShareRequest { + string target = 1; + string backendMode = 2; + bool insecure = 3; + bool closed = 4; + repeated string accessGrants = 5; +} + message ReleaseShareRequest { string token = 1; } diff --git a/agent/agentGrpc/agent_grpc.pb.go b/agent/agentGrpc/agent_grpc.pb.go index c643ce71..97eb85a6 100644 --- a/agent/agentGrpc/agent_grpc.pb.go +++ b/agent/agentGrpc/agent_grpc.pb.go @@ -20,6 +20,7 @@ const _ = grpc.SupportPackageIsVersion9 const ( Agent_PublicShare_FullMethodName = "/Agent/PublicShare" + Agent_PrivateShare_FullMethodName = "/Agent/PrivateShare" Agent_ReleaseShare_FullMethodName = "/Agent/ReleaseShare" Agent_Status_FullMethodName = "/Agent/Status" Agent_Version_FullMethodName = "/Agent/Version" @@ -30,6 +31,7 @@ const ( // 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. type AgentClient interface { PublicShare(ctx context.Context, in *PublicShareRequest, opts ...grpc.CallOption) (*PublicShareReply, error) + PrivateShare(ctx context.Context, in *PrivateShareRequest, opts ...grpc.CallOption) (*PrivateShareReply, error) ReleaseShare(ctx context.Context, in *ReleaseShareRequest, opts ...grpc.CallOption) (*ReleaseShareReply, error) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionReply, error) @@ -53,6 +55,16 @@ func (c *agentClient) PublicShare(ctx context.Context, in *PublicShareRequest, o return out, nil } +func (c *agentClient) PrivateShare(ctx context.Context, in *PrivateShareRequest, opts ...grpc.CallOption) (*PrivateShareReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PrivateShareReply) + err := c.cc.Invoke(ctx, Agent_PrivateShare_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *agentClient) ReleaseShare(ctx context.Context, in *ReleaseShareRequest, opts ...grpc.CallOption) (*ReleaseShareReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ReleaseShareReply) @@ -88,6 +100,7 @@ func (c *agentClient) Version(ctx context.Context, in *VersionRequest, opts ...g // for forward compatibility. type AgentServer interface { PublicShare(context.Context, *PublicShareRequest) (*PublicShareReply, error) + PrivateShare(context.Context, *PrivateShareRequest) (*PrivateShareReply, error) ReleaseShare(context.Context, *ReleaseShareRequest) (*ReleaseShareReply, error) Status(context.Context, *StatusRequest) (*StatusReply, error) Version(context.Context, *VersionRequest) (*VersionReply, error) @@ -104,6 +117,9 @@ type UnimplementedAgentServer struct{} func (UnimplementedAgentServer) PublicShare(context.Context, *PublicShareRequest) (*PublicShareReply, error) { return nil, status.Errorf(codes.Unimplemented, "method PublicShare not implemented") } +func (UnimplementedAgentServer) PrivateShare(context.Context, *PrivateShareRequest) (*PrivateShareReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method PrivateShare not implemented") +} func (UnimplementedAgentServer) ReleaseShare(context.Context, *ReleaseShareRequest) (*ReleaseShareReply, error) { return nil, status.Errorf(codes.Unimplemented, "method ReleaseShare not implemented") } @@ -152,6 +168,24 @@ func _Agent_PublicShare_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Agent_PrivateShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PrivateShareRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AgentServer).PrivateShare(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Agent_PrivateShare_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AgentServer).PrivateShare(ctx, req.(*PrivateShareRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Agent_ReleaseShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ReleaseShareRequest) if err := dec(in); err != nil { @@ -217,6 +251,10 @@ var Agent_ServiceDesc = grpc.ServiceDesc{ MethodName: "PublicShare", Handler: _Agent_PublicShare_Handler, }, + { + MethodName: "PrivateShare", + Handler: _Agent_PrivateShare_Handler, + }, { MethodName: "ReleaseShare", Handler: _Agent_ReleaseShare_Handler, From dffb7832f364718138a3bc1070cdacc031129437 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 16 Sep 2024 14:21:23 -0400 Subject: [PATCH 37/51] infrastructure for private sharing commands (#463) --- agent/privateShare.go | 66 ++++++++++++++ agent/publicShare.go | 5 +- agent/share.go | 6 ++ cmd/zrok/agentSharePrivate.go | 164 ++++++++++++++++++++++++++++++++++ cmd/zrok/sharePrivate.go | 3 - 5 files changed, 239 insertions(+), 5 deletions(-) create mode 100644 agent/privateShare.go create mode 100644 cmd/zrok/agentSharePrivate.go diff --git a/agent/privateShare.go b/agent/privateShare.go new file mode 100644 index 00000000..b04a5351 --- /dev/null +++ b/agent/privateShare.go @@ -0,0 +1,66 @@ +package agent + +import ( + "context" + "errors" + "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/agent/proctree" + "github.com/openziti/zrok/environment" + "github.com/openziti/zrok/sdk/golang/sdk" + "github.com/sirupsen/logrus" + "os" +) + +func (i *agentGrpcImpl) PrivateShare(_ context.Context, req *agentGrpc.PrivateShareRequest) (*agentGrpc.PrivateShareReply, error) { + root, err := environment.LoadRoot() + if err != nil { + return nil, err + } + + if !root.IsEnabled() { + return nil, errors.New("unable to load environment; did you 'zrok enable'?") + } + + shrCmd := []string{os.Args[0], "share", "private", "--agent", "-b", req.BackendMode} + shr := &share{ + shareMode: sdk.PrivateShareMode, + backendMode: sdk.BackendMode(req.BackendMode), + bootComplete: make(chan struct{}), + a: i.a, + } + + if req.Insecure { + shrCmd = append(shrCmd, "--insecure") + } + shr.insecure = req.Insecure + + if req.Closed { + shrCmd = append(shrCmd, "--closed") + } + shr.closed = req.Closed + + for _, grant := range req.AccessGrants { + shrCmd = append(shrCmd, "--access-grant", grant) + } + shr.accessGrants = req.AccessGrants + + shrCmd = append(shrCmd, req.Target) + shr.target = req.Target + + logrus.Infof("executing '%v'", shrCmd) + + shr.process, err = proctree.StartChild(shr.tail, shrCmd...) + if err != nil { + return nil, err + } + + go shr.monitor() + <-shr.bootComplete + + if shr.bootErr == nil { + i.a.inShares <- shr + return &agentGrpc.PrivateShareReply{Token: shr.token}, nil + } + + return nil, shr.bootErr +} diff --git a/agent/publicShare.go b/agent/publicShare.go index 5253b85b..f72325dc 100644 --- a/agent/publicShare.go +++ b/agent/publicShare.go @@ -75,7 +75,7 @@ func (i *agentGrpcImpl) PublicShare(_ context.Context, req *agentGrpc.PublicShar shr.process, err = proctree.StartChild(shr.tail, shrCmd...) if err != nil { - return &agentGrpc.PublicShareReply{}, err + return nil, err } go shr.monitor() @@ -88,5 +88,6 @@ func (i *agentGrpcImpl) PublicShare(_ context.Context, req *agentGrpc.PublicShar FrontendEndpoints: shr.frontendEndpoints, }, nil } - return &agentGrpc.PublicShareReply{}, shr.bootErr + + return nil, shr.bootErr } diff --git a/agent/share.go b/agent/share.go index d1f74d97..5debc70f 100644 --- a/agent/share.go +++ b/agent/share.go @@ -7,6 +7,7 @@ import ( "github.com/michaelquigley/pfxlog" "github.com/openziti/zrok/agent/proctree" "github.com/openziti/zrok/sdk/golang/sdk" + "github.com/sirupsen/logrus" "strings" "time" ) @@ -44,6 +45,11 @@ func (s *share) monitor() { } func (s *share) tail(data []byte) { + defer func() { + if r := recover(); r != nil { + logrus.Errorf("recovering: %v", r) + } + }() s.readBuffer.Write(data) if line, err := s.readBuffer.ReadString('\n'); err == nil { line = strings.Trim(line, "\n") diff --git a/cmd/zrok/agentSharePrivate.go b/cmd/zrok/agentSharePrivate.go new file mode 100644 index 00000000..8021c04f --- /dev/null +++ b/cmd/zrok/agentSharePrivate.go @@ -0,0 +1,164 @@ +package main + +import ( + "context" + "fmt" + "github.com/openziti/zrok/agent/agentClient" + "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/endpoints/vpn" + "github.com/openziti/zrok/environment" + "github.com/openziti/zrok/tui" + "github.com/spf13/cobra" + "net" + "path/filepath" +) + +func init() { + agentShareCmd.AddCommand(newAgentSharePrivateCommand().cmd) +} + +type agentSharePrivateCommand struct { + backendMode string + headless bool + insecure bool + closed bool + accessGrants []string + cmd *cobra.Command +} + +func newAgentSharePrivateCommand() *agentSharePrivateCommand { + cmd := &cobra.Command{ + Use: "private ", + Short: "Create a private share in the zrok Agent", + Args: cobra.RangeArgs(0, 1), + } + command := &agentSharePrivateCommand{cmd: cmd} + cmd.Flags().StringVarP(&command.backendMode, "backend-mode", "b", "proxy", "The backend mode {proxy, web, tcpTunnel, udpTunnel, caddy, drive, socks, vpn}") + cmd.Flags().BoolVar(&command.headless, "headless", false, "Disable TUI and run headless") + cmd.Flags().BoolVar(&command.insecure, "insecure", false, "Enable insecure TLS certificate validation for ") + cmd.Flags().BoolVar(&command.closed, "closed", false, "Enable closed permission mode (see --access-grant)") + cmd.Flags().StringArrayVar(&command.accessGrants, "access-grant", []string{}, "zrok accounts that are allowed to access this share (see --closed)") + cmd.Run = command.run + return command +} + +func (cmd *agentSharePrivateCommand) run(_ *cobra.Command, args []string) { + var target string + + switch cmd.backendMode { + case "proxy": + if len(args) != 1 { + tui.Error("the 'proxy' backend mode expects a ", nil) + } + v, err := parseUrl(args[0]) + if err != nil { + if !panicInstead { + tui.Error("invalid target endpoint URL", err) + } + panic(err) + } + target = v + + case "web": + if len(args) != 1 { + tui.Error("the 'web' backend mode expects a ", nil) + } + v, err := filepath.Abs(args[0]) + if err != nil { + if !panicInstead { + tui.Error("invalid target endpoint URL", err) + } + panic(err) + } + target = v + + case "tcpTunnel": + if len(args) != 1 { + tui.Error("the 'tcpTunnel' backend mode expects a ", nil) + } + target = args[0] + + case "udpTunnel": + if len(args) != 1 { + tui.Error("the 'udpTunnel' backend mode expects a ", nil) + } + target = args[0] + + case "caddy": + if len(args) != 1 { + tui.Error("the 'caddy' backend mode expects a ", nil) + } + v, err := filepath.Abs(args[0]) + if err != nil { + if !panicInstead { + tui.Error("invalid target endpoint URL", err) + } + panic(err) + } + target = v + + case "drive": + if len(args) != 1 { + tui.Error("the 'drive' backend mode expects a ", nil) + } + v, err := filepath.Abs(args[0]) + if err != nil { + if !panicInstead { + tui.Error("invalid target endpoint URL", err) + } + panic(err) + } + target = v + + case "socks": + if len(args) != 0 { + tui.Error("the 'socks' backend mode does not expect ", nil) + } + target = "socks" + + case "vpn": + if len(args) == 1 { + _, _, err := net.ParseCIDR(args[0]) + if err != nil { + tui.Error("the 'vpn' backend expect valid CIDR ", err) + } + target = args[0] + } else { + target = vpn.DefaultTarget() + } + + default: + tui.Error(fmt.Sprintf("invalid backend mode '%v'", cmd.backendMode), nil) + } + + root, err := environment.LoadRoot() + if err != nil { + if !panicInstead { + tui.Error("unable to load environment", err) + } + panic(err) + } + + if !root.IsEnabled() { + tui.Error("unable to load environment; did you 'zrok enable'?", nil) + } + + client, conn, err := agentClient.NewClient(root) + if err != nil { + tui.Error("error connecting to agent", err) + } + defer conn.Close() + + shr, err := client.PrivateShare(context.Background(), &agentGrpc.PrivateShareRequest{ + Target: target, + BackendMode: cmd.backendMode, + Insecure: cmd.insecure, + Closed: cmd.closed, + AccessGrants: cmd.accessGrants, + }) + if err != nil { + tui.Error("error creating share", err) + } + + fmt.Println(shr) +} diff --git a/cmd/zrok/sharePrivate.go b/cmd/zrok/sharePrivate.go index fe71eb2a..304a7a6f 100644 --- a/cmd/zrok/sharePrivate.go +++ b/cmd/zrok/sharePrivate.go @@ -27,7 +27,6 @@ func init() { } type sharePrivateCommand struct { - basicAuth []string backendMode string headless bool insecure bool @@ -43,7 +42,6 @@ func newSharePrivateCommand() *sharePrivateCommand { Args: cobra.RangeArgs(0, 1), } command := &sharePrivateCommand{cmd: cmd} - cmd.Flags().StringArrayVar(&command.basicAuth, "basic-auth", []string{}, "Basic authentication users (,...") cmd.Flags().StringVarP(&command.backendMode, "backend-mode", "b", "proxy", "The backend mode {proxy, web, tcpTunnel, udpTunnel, caddy, drive, socks, vpn}") cmd.Flags().BoolVar(&command.headless, "headless", false, "Disable TUI and run headless") cmd.Flags().BoolVar(&command.insecure, "insecure", false, "Enable insecure TLS certificate validation for ") @@ -145,7 +143,6 @@ func (cmd *sharePrivateCommand) run(_ *cobra.Command, args []string) { req := &sdk.ShareRequest{ BackendMode: sdk.BackendMode(cmd.backendMode), ShareMode: sdk.PrivateShareMode, - BasicAuth: cmd.basicAuth, Target: target, } if cmd.closed { From 98814018442f690fb43fe7fc98165521af903e0f Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 16 Sep 2024 14:29:17 -0400 Subject: [PATCH 38/51] support '--agent' for 'zrok share private' (#463) --- cmd/zrok/sharePrivate.go | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/cmd/zrok/sharePrivate.go b/cmd/zrok/sharePrivate.go index 304a7a6f..2a1135b8 100644 --- a/cmd/zrok/sharePrivate.go +++ b/cmd/zrok/sharePrivate.go @@ -1,6 +1,7 @@ package main import ( + "encoding/json" "fmt" tea "github.com/charmbracelet/bubbletea" "github.com/openziti/zrok/endpoints" @@ -29,6 +30,7 @@ func init() { type sharePrivateCommand struct { backendMode string headless bool + agent bool insecure bool closed bool accessGrants []string @@ -44,6 +46,8 @@ func newSharePrivateCommand() *sharePrivateCommand { command := &sharePrivateCommand{cmd: cmd} cmd.Flags().StringVarP(&command.backendMode, "backend-mode", "b", "proxy", "The backend mode {proxy, web, tcpTunnel, udpTunnel, caddy, drive, socks, vpn}") cmd.Flags().BoolVar(&command.headless, "headless", false, "Disable TUI and run headless") + cmd.Flags().BoolVar(&command.agent, "agent", false, "Enable agent mode") + cmd.MarkFlagsMutuallyExclusive("headless", "agent") cmd.Flags().BoolVar(&command.insecure, "insecure", false, "Enable insecure TLS certificate validation for ") cmd.Flags().BoolVar(&command.closed, "closed", false, "Enable closed permission mode (see --access-grant)") cmd.Flags().StringArrayVar(&command.accessGrants, "access-grant", []string{}, "zrok accounts that are allowed to access this share (see --closed)") @@ -157,9 +161,20 @@ func (cmd *sharePrivateCommand) run(_ *cobra.Command, args []string) { panic(err) } + if cmd.agent { + data := make(map[string]interface{}) + data["token"] = shr.Token + data["frontend_endpoints"] = shr.FrontendEndpoints + jsonData, err := json.Marshal(data) + if err != nil { + panic(err) + } + fmt.Println(string(jsonData)) + } + shareDescription := fmt.Sprintf("access your share with: %v", tui.Code.Render(fmt.Sprintf("zrok access private %v", shr.Token))) mdl := newShareModel(shr.Token, []string{shareDescription}, sdk.PrivateShareMode, sdk.BackendMode(cmd.backendMode)) - if !cmd.headless { + if !cmd.headless && !cmd.agent { proxy.SetCaddyLoggingWriter(mdl) } @@ -363,6 +378,22 @@ func (cmd *sharePrivateCommand) run(_ *cobra.Command, args []string) { } } + } else if cmd.agent { + for { + select { + case req := <-requests: + data := make(map[string]interface{}) + data["remote-address"] = req.RemoteAddr + data["method"] = req.Method + data["path"] = req.Path + jsonData, err := json.Marshal(data) + if err != nil { + fmt.Println(err) + } + fmt.Println(string(jsonData)) + } + } + } else { logrus.SetOutput(mdl) prg := tea.NewProgram(mdl, tea.WithAltScreen()) From 9d829c173a220c905e8b4f7de2ecd59ac7fd3735 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 16 Sep 2024 21:32:17 -0400 Subject: [PATCH 39/51] private access wiring (#463) --- agent/access.go | 65 +++- agent/agent.go | 5 + agent/agentGrpc/agent.pb.go | 637 +++++++++++++++++++------------ agent/agentGrpc/agent.proto | 37 +- agent/agentGrpc/agent_grpc.pb.go | 76 +++- agent/privateAccess.go | 48 +++ 6 files changed, 587 insertions(+), 281 deletions(-) create mode 100644 agent/privateAccess.go diff --git a/agent/access.go b/agent/access.go index 739c3488..d0815a60 100644 --- a/agent/access.go +++ b/agent/access.go @@ -1,20 +1,71 @@ package agent import ( - "github.com/openziti/zrok/agent/agentGrpc" + "bytes" + "encoding/json" + "errors" + "github.com/michaelquigley/pfxlog" "github.com/openziti/zrok/agent/proctree" + "github.com/sirupsen/logrus" + "strings" ) type access struct { - token string - + frontendToken string + token string bindAddress string responseHeaders []string - process *proctree.Child -} + process *proctree.Child + readBuffer bytes.Buffer + booted bool + bootComplete chan struct{} + bootErr error -type agentGrpcImpl struct { - agentGrpc.UnimplementedAgentServer a *Agent } + +func (a *access) monitor() { + if err := proctree.WaitChild(a.process); err != nil { + pfxlog.ChannelLogger(a.token).Error(err) + } + a.a.outAccesses <- a +} + +func (a *access) tail(data []byte) { + defer func() { + if r := recover(); r != nil { + logrus.Errorf("recovering: %v", r) + } + }() + a.readBuffer.Write(data) + if line, err := a.readBuffer.ReadString('\n'); err == nil { + line = strings.Trim(line, "\n") + if !a.booted { + in := make(map[string]interface{}) + if err := json.Unmarshal([]byte(line), &in); err == nil { + if v, found := in["frontend-token"]; found { + if str, ok := v.(string); ok { + a.frontendToken = str + } + } + a.booted = true + } else { + a.bootErr = errors.New(line) + } + close(a.bootComplete) + + } else { + if strings.HasPrefix(line, "{") { + in := make(map[string]interface{}) + if err := json.Unmarshal([]byte(line), &in); err == nil { + pfxlog.ChannelLogger(a.token).Info(in) + } + } else { + pfxlog.ChannelLogger(a.token).Info(strings.Trim(line, "\n")) + } + } + } else { + a.readBuffer.WriteString(line) + } +} diff --git a/agent/agent.go b/agent/agent.go index a8097366..72d9175e 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -106,3 +106,8 @@ func (a *Agent) manager() { } } } + +type agentGrpcImpl struct { + agentGrpc.UnimplementedAgentServer + a *Agent +} diff --git a/agent/agentGrpc/agent.pb.go b/agent/agentGrpc/agent.pb.go index 7518313c..b0f12a95 100644 --- a/agent/agentGrpc/agent.pb.go +++ b/agent/agentGrpc/agent.pb.go @@ -83,17 +83,16 @@ func (x *AccessDetail) GetResponseHeaders() []string { return nil } -type PublicShareReply struct { +type PrivateAccessReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` - FrontendEndpoints []string `protobuf:"bytes,2,rep,name=frontendEndpoints,proto3" json:"frontendEndpoints,omitempty"` + FrontendToken string `protobuf:"bytes,1,opt,name=frontendToken,proto3" json:"frontendToken,omitempty"` } -func (x *PublicShareReply) Reset() { - *x = PublicShareReply{} +func (x *PrivateAccessReply) Reset() { + *x = PrivateAccessReply{} if protoimpl.UnsafeEnabled { mi := &file_agent_agentGrpc_agent_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -101,13 +100,13 @@ func (x *PublicShareReply) Reset() { } } -func (x *PublicShareReply) String() string { +func (x *PrivateAccessReply) String() string { return protoimpl.X.MessageStringOf(x) } -func (*PublicShareReply) ProtoMessage() {} +func (*PrivateAccessReply) ProtoMessage() {} -func (x *PublicShareReply) ProtoReflect() protoreflect.Message { +func (x *PrivateAccessReply) ProtoReflect() protoreflect.Message { mi := &file_agent_agentGrpc_agent_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -119,44 +118,30 @@ func (x *PublicShareReply) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use PublicShareReply.ProtoReflect.Descriptor instead. -func (*PublicShareReply) Descriptor() ([]byte, []int) { +// Deprecated: Use PrivateAccessReply.ProtoReflect.Descriptor instead. +func (*PrivateAccessReply) Descriptor() ([]byte, []int) { return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{1} } -func (x *PublicShareReply) GetToken() string { +func (x *PrivateAccessReply) GetFrontendToken() string { if x != nil { - return x.Token + return x.FrontendToken } return "" } -func (x *PublicShareReply) GetFrontendEndpoints() []string { - if x != nil { - return x.FrontendEndpoints - } - return nil -} - -type PublicShareRequest struct { +type PrivateAccessRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` - BasicAuth []string `protobuf:"bytes,2,rep,name=basicAuth,proto3" json:"basicAuth,omitempty"` - FrontendSelection []string `protobuf:"bytes,3,rep,name=frontendSelection,proto3" json:"frontendSelection,omitempty"` - BackendMode string `protobuf:"bytes,4,opt,name=backendMode,proto3" json:"backendMode,omitempty"` - Insecure bool `protobuf:"varint,5,opt,name=insecure,proto3" json:"insecure,omitempty"` - OauthProvider string `protobuf:"bytes,6,opt,name=oauthProvider,proto3" json:"oauthProvider,omitempty"` - OauthEmailAddressPatterns []string `protobuf:"bytes,7,rep,name=oauthEmailAddressPatterns,proto3" json:"oauthEmailAddressPatterns,omitempty"` - OauthCheckInterval string `protobuf:"bytes,8,opt,name=oauthCheckInterval,proto3" json:"oauthCheckInterval,omitempty"` - Closed bool `protobuf:"varint,9,opt,name=closed,proto3" json:"closed,omitempty"` - AccessGrants []string `protobuf:"bytes,10,rep,name=accessGrants,proto3" json:"accessGrants,omitempty"` + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + BindAddress string `protobuf:"bytes,2,opt,name=bindAddress,proto3" json:"bindAddress,omitempty"` + ResponseHeaders []string `protobuf:"bytes,3,rep,name=responseHeaders,proto3" json:"responseHeaders,omitempty"` } -func (x *PublicShareRequest) Reset() { - *x = PublicShareRequest{} +func (x *PrivateAccessRequest) Reset() { + *x = PrivateAccessRequest{} if protoimpl.UnsafeEnabled { mi := &file_agent_agentGrpc_agent_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -164,13 +149,13 @@ func (x *PublicShareRequest) Reset() { } } -func (x *PublicShareRequest) String() string { +func (x *PrivateAccessRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*PublicShareRequest) ProtoMessage() {} +func (*PrivateAccessRequest) ProtoMessage() {} -func (x *PublicShareRequest) ProtoReflect() protoreflect.Message { +func (x *PrivateAccessRequest) ProtoReflect() protoreflect.Message { mi := &file_agent_agentGrpc_agent_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -182,77 +167,28 @@ func (x *PublicShareRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use PublicShareRequest.ProtoReflect.Descriptor instead. -func (*PublicShareRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use PrivateAccessRequest.ProtoReflect.Descriptor instead. +func (*PrivateAccessRequest) Descriptor() ([]byte, []int) { return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{2} } -func (x *PublicShareRequest) GetTarget() string { +func (x *PrivateAccessRequest) GetToken() string { if x != nil { - return x.Target + return x.Token } return "" } -func (x *PublicShareRequest) GetBasicAuth() []string { +func (x *PrivateAccessRequest) GetBindAddress() string { if x != nil { - return x.BasicAuth - } - return nil -} - -func (x *PublicShareRequest) GetFrontendSelection() []string { - if x != nil { - return x.FrontendSelection - } - return nil -} - -func (x *PublicShareRequest) GetBackendMode() string { - if x != nil { - return x.BackendMode + return x.BindAddress } return "" } -func (x *PublicShareRequest) GetInsecure() bool { +func (x *PrivateAccessRequest) GetResponseHeaders() []string { if x != nil { - return x.Insecure - } - return false -} - -func (x *PublicShareRequest) GetOauthProvider() string { - if x != nil { - return x.OauthProvider - } - return "" -} - -func (x *PublicShareRequest) GetOauthEmailAddressPatterns() []string { - if x != nil { - return x.OauthEmailAddressPatterns - } - return nil -} - -func (x *PublicShareRequest) GetOauthCheckInterval() string { - if x != nil { - return x.OauthCheckInterval - } - return "" -} - -func (x *PublicShareRequest) GetClosed() bool { - if x != nil { - return x.Closed - } - return false -} - -func (x *PublicShareRequest) GetAccessGrants() []string { - if x != nil { - return x.AccessGrants + return x.ResponseHeaders } return nil } @@ -383,6 +319,180 @@ func (x *PrivateShareRequest) GetAccessGrants() []string { return nil } +type PublicShareReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + FrontendEndpoints []string `protobuf:"bytes,2,rep,name=frontendEndpoints,proto3" json:"frontendEndpoints,omitempty"` +} + +func (x *PublicShareReply) Reset() { + *x = PublicShareReply{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PublicShareReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PublicShareReply) ProtoMessage() {} + +func (x *PublicShareReply) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 PublicShareReply.ProtoReflect.Descriptor instead. +func (*PublicShareReply) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{5} +} + +func (x *PublicShareReply) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *PublicShareReply) GetFrontendEndpoints() []string { + if x != nil { + return x.FrontendEndpoints + } + return nil +} + +type PublicShareRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` + BasicAuth []string `protobuf:"bytes,2,rep,name=basicAuth,proto3" json:"basicAuth,omitempty"` + FrontendSelection []string `protobuf:"bytes,3,rep,name=frontendSelection,proto3" json:"frontendSelection,omitempty"` + BackendMode string `protobuf:"bytes,4,opt,name=backendMode,proto3" json:"backendMode,omitempty"` + Insecure bool `protobuf:"varint,5,opt,name=insecure,proto3" json:"insecure,omitempty"` + OauthProvider string `protobuf:"bytes,6,opt,name=oauthProvider,proto3" json:"oauthProvider,omitempty"` + OauthEmailAddressPatterns []string `protobuf:"bytes,7,rep,name=oauthEmailAddressPatterns,proto3" json:"oauthEmailAddressPatterns,omitempty"` + OauthCheckInterval string `protobuf:"bytes,8,opt,name=oauthCheckInterval,proto3" json:"oauthCheckInterval,omitempty"` + Closed bool `protobuf:"varint,9,opt,name=closed,proto3" json:"closed,omitempty"` + AccessGrants []string `protobuf:"bytes,10,rep,name=accessGrants,proto3" json:"accessGrants,omitempty"` +} + +func (x *PublicShareRequest) Reset() { + *x = PublicShareRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PublicShareRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PublicShareRequest) ProtoMessage() {} + +func (x *PublicShareRequest) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 PublicShareRequest.ProtoReflect.Descriptor instead. +func (*PublicShareRequest) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{6} +} + +func (x *PublicShareRequest) GetTarget() string { + if x != nil { + return x.Target + } + return "" +} + +func (x *PublicShareRequest) GetBasicAuth() []string { + if x != nil { + return x.BasicAuth + } + return nil +} + +func (x *PublicShareRequest) GetFrontendSelection() []string { + if x != nil { + return x.FrontendSelection + } + return nil +} + +func (x *PublicShareRequest) GetBackendMode() string { + if x != nil { + return x.BackendMode + } + return "" +} + +func (x *PublicShareRequest) GetInsecure() bool { + if x != nil { + return x.Insecure + } + return false +} + +func (x *PublicShareRequest) GetOauthProvider() string { + if x != nil { + return x.OauthProvider + } + return "" +} + +func (x *PublicShareRequest) GetOauthEmailAddressPatterns() []string { + if x != nil { + return x.OauthEmailAddressPatterns + } + return nil +} + +func (x *PublicShareRequest) GetOauthCheckInterval() string { + if x != nil { + return x.OauthCheckInterval + } + return "" +} + +func (x *PublicShareRequest) GetClosed() bool { + if x != nil { + return x.Closed + } + return false +} + +func (x *PublicShareRequest) GetAccessGrants() []string { + if x != nil { + return x.AccessGrants + } + return nil +} + type ReleaseShareRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -394,7 +504,7 @@ type ReleaseShareRequest struct { func (x *ReleaseShareRequest) Reset() { *x = ReleaseShareRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -407,7 +517,7 @@ func (x *ReleaseShareRequest) String() string { func (*ReleaseShareRequest) ProtoMessage() {} func (x *ReleaseShareRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -420,7 +530,7 @@ func (x *ReleaseShareRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReleaseShareRequest.ProtoReflect.Descriptor instead. func (*ReleaseShareRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{5} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{7} } func (x *ReleaseShareRequest) GetToken() string { @@ -439,7 +549,7 @@ type ReleaseShareReply struct { func (x *ReleaseShareReply) Reset() { *x = ReleaseShareReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[6] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -452,7 +562,7 @@ func (x *ReleaseShareReply) String() string { func (*ReleaseShareReply) ProtoMessage() {} func (x *ReleaseShareReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[6] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -465,7 +575,7 @@ func (x *ReleaseShareReply) ProtoReflect() protoreflect.Message { // Deprecated: Use ReleaseShareReply.ProtoReflect.Descriptor instead. func (*ReleaseShareReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{6} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{8} } type ShareDetail struct { @@ -486,7 +596,7 @@ type ShareDetail struct { func (x *ShareDetail) Reset() { *x = ShareDetail{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -499,7 +609,7 @@ func (x *ShareDetail) String() string { func (*ShareDetail) ProtoMessage() {} func (x *ShareDetail) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -512,7 +622,7 @@ func (x *ShareDetail) ProtoReflect() protoreflect.Message { // Deprecated: Use ShareDetail.ProtoReflect.Descriptor instead. func (*ShareDetail) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{7} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{9} } func (x *ShareDetail) GetToken() string { @@ -580,7 +690,7 @@ type StatusRequest struct { func (x *StatusRequest) Reset() { *x = StatusRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[8] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -593,7 +703,7 @@ func (x *StatusRequest) String() string { func (*StatusRequest) ProtoMessage() {} func (x *StatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[8] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -606,7 +716,7 @@ func (x *StatusRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead. func (*StatusRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{8} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{10} } type StatusReply struct { @@ -621,7 +731,7 @@ type StatusReply struct { func (x *StatusReply) Reset() { *x = StatusReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[9] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -634,7 +744,7 @@ func (x *StatusReply) String() string { func (*StatusReply) ProtoMessage() {} func (x *StatusReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[9] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -647,7 +757,7 @@ func (x *StatusReply) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusReply.ProtoReflect.Descriptor instead. func (*StatusReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{9} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{11} } func (x *StatusReply) GetAccesses() []*AccessDetail { @@ -673,7 +783,7 @@ type VersionRequest struct { func (x *VersionRequest) Reset() { *x = VersionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[10] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -686,7 +796,7 @@ func (x *VersionRequest) String() string { func (*VersionRequest) ProtoMessage() {} func (x *VersionRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[10] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -699,7 +809,7 @@ func (x *VersionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionRequest.ProtoReflect.Descriptor instead. func (*VersionRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{10} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{12} } type VersionReply struct { @@ -713,7 +823,7 @@ type VersionReply struct { func (x *VersionReply) Reset() { *x = VersionReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -726,7 +836,7 @@ func (x *VersionReply) String() string { func (*VersionReply) ProtoMessage() {} func (x *VersionReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -739,7 +849,7 @@ func (x *VersionReply) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionReply.ProtoReflect.Descriptor instead. func (*VersionReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{11} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{13} } func (x *VersionReply) GetV() string { @@ -761,101 +871,116 @@ var file_agent_agentGrpc_agent_proto_rawDesc = []byte{ 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, - 0x56, 0x0a, 0x10, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2c, 0x0a, 0x11, 0x66, 0x72, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, - 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x22, 0x86, 0x03, 0x0a, 0x12, 0x50, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, - 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x69, 0x63, 0x41, - 0x75, 0x74, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x62, 0x61, 0x73, 0x69, 0x63, - 0x41, 0x75, 0x74, 0x68, 0x12, 0x2c, 0x0a, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, - 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, - 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, - 0x12, 0x24, 0x0a, 0x0d, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, - 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x50, 0x72, - 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x19, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x45, - 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x19, 0x6f, 0x61, 0x75, 0x74, 0x68, - 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x12, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x43, 0x68, 0x65, - 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x12, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x76, 0x61, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x09, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, - 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x0a, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, - 0x22, 0x29, 0x0a, 0x11, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xa7, 0x01, 0x0a, 0x13, - 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x62, - 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, - 0x73, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, - 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, - 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, - 0x72, 0x61, 0x6e, 0x74, 0x73, 0x22, 0x2b, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, - 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, - 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x22, 0x13, 0x0a, 0x11, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, - 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, - 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, - 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, - 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, - 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, - 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, - 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, - 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x22, 0x5e, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, - 0x29, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, - 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, - 0x61, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, - 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, - 0x22, 0x10, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, - 0x32, 0x8f, 0x02, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x0b, 0x50, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, 0x6c, - 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, - 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, - 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, - 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x50, 0x72, 0x69, 0x76, - 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, - 0x3a, 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, - 0x14, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, - 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x06, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, - 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x3a, 0x0a, 0x12, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x24, 0x0a, 0x0d, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x66, 0x72, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x78, 0x0a, 0x14, 0x50, + 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x69, 0x6e, + 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x62, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x72, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, 0x29, 0x0a, 0x11, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x22, 0xa7, 0x01, 0x0a, 0x13, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, + 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, + 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, + 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x22, 0x56, 0x0a, 0x10, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, + 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2c, 0x0a, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, + 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, + 0x74, 0x73, 0x22, 0x86, 0x03, 0x0a, 0x12, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, + 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, + 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x62, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, + 0x2c, 0x0a, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x66, 0x72, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, + 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, + 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x6f, + 0x61, 0x75, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0d, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, + 0x72, 0x12, 0x3c, 0x0a, 0x19, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x18, 0x07, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x19, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x45, 0x6d, 0x61, 0x69, 0x6c, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x12, + 0x2e, 0x0a, 0x12, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, + 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6f, 0x61, 0x75, + 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, + 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x22, 0x2b, 0x0a, 0x13, 0x52, + 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x13, 0x0a, 0x11, 0x52, 0x65, 0x6c, 0x65, + 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x85, 0x02, + 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, + 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, + 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, + 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, + 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x62, + 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x16, 0x0a, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5e, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, + 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, + 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0xce, 0x02, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, + 0x12, 0x3d, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x12, 0x15, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, + 0x3a, 0x0a, 0x0c, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, + 0x14, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, + 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0b, 0x50, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x11, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, + 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, + 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x52, 0x65, 0x6c, + 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, + 0x12, 0x28, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, + 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, + 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -870,36 +995,40 @@ func file_agent_agentGrpc_agent_proto_rawDescGZIP() []byte { return file_agent_agentGrpc_agent_proto_rawDescData } -var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_agent_agentGrpc_agent_proto_goTypes = []any{ - (*AccessDetail)(nil), // 0: AccessDetail - (*PublicShareReply)(nil), // 1: PublicShareReply - (*PublicShareRequest)(nil), // 2: PublicShareRequest - (*PrivateShareReply)(nil), // 3: PrivateShareReply - (*PrivateShareRequest)(nil), // 4: PrivateShareRequest - (*ReleaseShareRequest)(nil), // 5: ReleaseShareRequest - (*ReleaseShareReply)(nil), // 6: ReleaseShareReply - (*ShareDetail)(nil), // 7: ShareDetail - (*StatusRequest)(nil), // 8: StatusRequest - (*StatusReply)(nil), // 9: StatusReply - (*VersionRequest)(nil), // 10: VersionRequest - (*VersionReply)(nil), // 11: VersionReply + (*AccessDetail)(nil), // 0: AccessDetail + (*PrivateAccessReply)(nil), // 1: PrivateAccessReply + (*PrivateAccessRequest)(nil), // 2: PrivateAccessRequest + (*PrivateShareReply)(nil), // 3: PrivateShareReply + (*PrivateShareRequest)(nil), // 4: PrivateShareRequest + (*PublicShareReply)(nil), // 5: PublicShareReply + (*PublicShareRequest)(nil), // 6: PublicShareRequest + (*ReleaseShareRequest)(nil), // 7: ReleaseShareRequest + (*ReleaseShareReply)(nil), // 8: ReleaseShareReply + (*ShareDetail)(nil), // 9: ShareDetail + (*StatusRequest)(nil), // 10: StatusRequest + (*StatusReply)(nil), // 11: StatusReply + (*VersionRequest)(nil), // 12: VersionRequest + (*VersionReply)(nil), // 13: VersionReply } var file_agent_agentGrpc_agent_proto_depIdxs = []int32{ 0, // 0: StatusReply.accesses:type_name -> AccessDetail - 7, // 1: StatusReply.shares:type_name -> ShareDetail - 2, // 2: Agent.PublicShare:input_type -> PublicShareRequest + 9, // 1: StatusReply.shares:type_name -> ShareDetail + 2, // 2: Agent.PrivateAccess:input_type -> PrivateAccessRequest 4, // 3: Agent.PrivateShare:input_type -> PrivateShareRequest - 5, // 4: Agent.ReleaseShare:input_type -> ReleaseShareRequest - 8, // 5: Agent.Status:input_type -> StatusRequest - 10, // 6: Agent.Version:input_type -> VersionRequest - 1, // 7: Agent.PublicShare:output_type -> PublicShareReply - 3, // 8: Agent.PrivateShare:output_type -> PrivateShareReply - 6, // 9: Agent.ReleaseShare:output_type -> ReleaseShareReply - 9, // 10: Agent.Status:output_type -> StatusReply - 11, // 11: Agent.Version:output_type -> VersionReply - 7, // [7:12] is the sub-list for method output_type - 2, // [2:7] is the sub-list for method input_type + 6, // 4: Agent.PublicShare:input_type -> PublicShareRequest + 7, // 5: Agent.ReleaseShare:input_type -> ReleaseShareRequest + 10, // 6: Agent.Status:input_type -> StatusRequest + 12, // 7: Agent.Version:input_type -> VersionRequest + 1, // 8: Agent.PrivateAccess:output_type -> PrivateAccessReply + 3, // 9: Agent.PrivateShare:output_type -> PrivateShareReply + 5, // 10: Agent.PublicShare:output_type -> PublicShareReply + 8, // 11: Agent.ReleaseShare:output_type -> ReleaseShareReply + 11, // 12: Agent.Status:output_type -> StatusReply + 13, // 13: Agent.Version:output_type -> VersionReply + 8, // [8:14] is the sub-list for method output_type + 2, // [2:8] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name @@ -924,7 +1053,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*PublicShareReply); i { + switch v := v.(*PrivateAccessReply); i { case 0: return &v.state case 1: @@ -936,7 +1065,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*PublicShareRequest); i { + switch v := v.(*PrivateAccessRequest); i { case 0: return &v.state case 1: @@ -972,7 +1101,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*ReleaseShareRequest); i { + switch v := v.(*PublicShareReply); i { case 0: return &v.state case 1: @@ -984,7 +1113,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*ReleaseShareReply); i { + switch v := v.(*PublicShareRequest); i { case 0: return &v.state case 1: @@ -996,7 +1125,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*ShareDetail); i { + switch v := v.(*ReleaseShareRequest); i { case 0: return &v.state case 1: @@ -1008,7 +1137,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*StatusRequest); i { + switch v := v.(*ReleaseShareReply); i { case 0: return &v.state case 1: @@ -1020,7 +1149,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[9].Exporter = func(v any, i int) any { - switch v := v.(*StatusReply); i { + switch v := v.(*ShareDetail); i { case 0: return &v.state case 1: @@ -1032,7 +1161,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[10].Exporter = func(v any, i int) any { - switch v := v.(*VersionRequest); i { + switch v := v.(*StatusRequest); i { case 0: return &v.state case 1: @@ -1044,6 +1173,30 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[11].Exporter = func(v any, i int) any { + switch v := v.(*StatusReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[12].Exporter = func(v any, i int) any { + switch v := v.(*VersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[13].Exporter = func(v any, i int) any { switch v := v.(*VersionReply); i { case 0: return &v.state @@ -1062,7 +1215,7 @@ func file_agent_agentGrpc_agent_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_agent_agentGrpc_agent_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 14, NumExtensions: 0, NumServices: 1, }, diff --git a/agent/agentGrpc/agent.proto b/agent/agentGrpc/agent.proto index dfa77a3e..b5bc2e1a 100644 --- a/agent/agentGrpc/agent.proto +++ b/agent/agentGrpc/agent.proto @@ -3,8 +3,9 @@ syntax = "proto3"; option go_package = "github.com/openziti/zrok/agent/agentGrpc"; service Agent { - rpc PublicShare(PublicShareRequest) returns (PublicShareReply) {} + rpc PrivateAccess(PrivateAccessRequest) returns (PrivateAccessReply) {} rpc PrivateShare(PrivateShareRequest) returns (PrivateShareReply) {} + rpc PublicShare(PublicShareRequest) returns (PublicShareReply) {} rpc ReleaseShare(ReleaseShareRequest) returns (ReleaseShareReply) {} rpc Status(StatusRequest) returns (StatusReply) {} rpc Version(VersionRequest) returns (VersionReply) {} @@ -16,6 +17,28 @@ message AccessDetail { repeated string responseHeaders = 3; } +message PrivateAccessReply{ + string frontendToken = 1; +} + +message PrivateAccessRequest{ + string token = 1; + string bindAddress = 2; + repeated string responseHeaders = 3; +} + +message PrivateShareReply { + string token = 1; +} + +message PrivateShareRequest { + string target = 1; + string backendMode = 2; + bool insecure = 3; + bool closed = 4; + repeated string accessGrants = 5; +} + message PublicShareReply { string token = 1; repeated string frontendEndpoints = 2; @@ -34,18 +57,6 @@ message PublicShareRequest { repeated string accessGrants = 10; } -message PrivateShareReply { - string token = 1; -} - -message PrivateShareRequest { - string target = 1; - string backendMode = 2; - bool insecure = 3; - bool closed = 4; - repeated string accessGrants = 5; -} - message ReleaseShareRequest { string token = 1; } diff --git a/agent/agentGrpc/agent_grpc.pb.go b/agent/agentGrpc/agent_grpc.pb.go index 97eb85a6..becacf10 100644 --- a/agent/agentGrpc/agent_grpc.pb.go +++ b/agent/agentGrpc/agent_grpc.pb.go @@ -19,19 +19,21 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - Agent_PublicShare_FullMethodName = "/Agent/PublicShare" - Agent_PrivateShare_FullMethodName = "/Agent/PrivateShare" - Agent_ReleaseShare_FullMethodName = "/Agent/ReleaseShare" - Agent_Status_FullMethodName = "/Agent/Status" - Agent_Version_FullMethodName = "/Agent/Version" + Agent_PrivateAccess_FullMethodName = "/Agent/PrivateAccess" + Agent_PrivateShare_FullMethodName = "/Agent/PrivateShare" + Agent_PublicShare_FullMethodName = "/Agent/PublicShare" + Agent_ReleaseShare_FullMethodName = "/Agent/ReleaseShare" + Agent_Status_FullMethodName = "/Agent/Status" + Agent_Version_FullMethodName = "/Agent/Version" ) // AgentClient is the client API for Agent 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. type AgentClient interface { - PublicShare(ctx context.Context, in *PublicShareRequest, opts ...grpc.CallOption) (*PublicShareReply, error) + PrivateAccess(ctx context.Context, in *PrivateAccessRequest, opts ...grpc.CallOption) (*PrivateAccessReply, error) PrivateShare(ctx context.Context, in *PrivateShareRequest, opts ...grpc.CallOption) (*PrivateShareReply, error) + PublicShare(ctx context.Context, in *PublicShareRequest, opts ...grpc.CallOption) (*PublicShareReply, error) ReleaseShare(ctx context.Context, in *ReleaseShareRequest, opts ...grpc.CallOption) (*ReleaseShareReply, error) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionReply, error) @@ -45,10 +47,10 @@ func NewAgentClient(cc grpc.ClientConnInterface) AgentClient { return &agentClient{cc} } -func (c *agentClient) PublicShare(ctx context.Context, in *PublicShareRequest, opts ...grpc.CallOption) (*PublicShareReply, error) { +func (c *agentClient) PrivateAccess(ctx context.Context, in *PrivateAccessRequest, opts ...grpc.CallOption) (*PrivateAccessReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(PublicShareReply) - err := c.cc.Invoke(ctx, Agent_PublicShare_FullMethodName, in, out, cOpts...) + out := new(PrivateAccessReply) + err := c.cc.Invoke(ctx, Agent_PrivateAccess_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -65,6 +67,16 @@ func (c *agentClient) PrivateShare(ctx context.Context, in *PrivateShareRequest, return out, nil } +func (c *agentClient) PublicShare(ctx context.Context, in *PublicShareRequest, opts ...grpc.CallOption) (*PublicShareReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PublicShareReply) + err := c.cc.Invoke(ctx, Agent_PublicShare_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *agentClient) ReleaseShare(ctx context.Context, in *ReleaseShareRequest, opts ...grpc.CallOption) (*ReleaseShareReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ReleaseShareReply) @@ -99,8 +111,9 @@ func (c *agentClient) Version(ctx context.Context, in *VersionRequest, opts ...g // All implementations must embed UnimplementedAgentServer // for forward compatibility. type AgentServer interface { - PublicShare(context.Context, *PublicShareRequest) (*PublicShareReply, error) + PrivateAccess(context.Context, *PrivateAccessRequest) (*PrivateAccessReply, error) PrivateShare(context.Context, *PrivateShareRequest) (*PrivateShareReply, error) + PublicShare(context.Context, *PublicShareRequest) (*PublicShareReply, error) ReleaseShare(context.Context, *ReleaseShareRequest) (*ReleaseShareReply, error) Status(context.Context, *StatusRequest) (*StatusReply, error) Version(context.Context, *VersionRequest) (*VersionReply, error) @@ -114,12 +127,15 @@ type AgentServer interface { // pointer dereference when methods are called. type UnimplementedAgentServer struct{} -func (UnimplementedAgentServer) PublicShare(context.Context, *PublicShareRequest) (*PublicShareReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method PublicShare not implemented") +func (UnimplementedAgentServer) PrivateAccess(context.Context, *PrivateAccessRequest) (*PrivateAccessReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method PrivateAccess not implemented") } func (UnimplementedAgentServer) PrivateShare(context.Context, *PrivateShareRequest) (*PrivateShareReply, error) { return nil, status.Errorf(codes.Unimplemented, "method PrivateShare not implemented") } +func (UnimplementedAgentServer) PublicShare(context.Context, *PublicShareRequest) (*PublicShareReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method PublicShare not implemented") +} func (UnimplementedAgentServer) ReleaseShare(context.Context, *ReleaseShareRequest) (*ReleaseShareReply, error) { return nil, status.Errorf(codes.Unimplemented, "method ReleaseShare not implemented") } @@ -150,20 +166,20 @@ func RegisterAgentServer(s grpc.ServiceRegistrar, srv AgentServer) { s.RegisterService(&Agent_ServiceDesc, srv) } -func _Agent_PublicShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PublicShareRequest) +func _Agent_PrivateAccess_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PrivateAccessRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(AgentServer).PublicShare(ctx, in) + return srv.(AgentServer).PrivateAccess(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Agent_PublicShare_FullMethodName, + FullMethod: Agent_PrivateAccess_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AgentServer).PublicShare(ctx, req.(*PublicShareRequest)) + return srv.(AgentServer).PrivateAccess(ctx, req.(*PrivateAccessRequest)) } return interceptor(ctx, in, info, handler) } @@ -186,6 +202,24 @@ func _Agent_PrivateShare_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Agent_PublicShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PublicShareRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AgentServer).PublicShare(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Agent_PublicShare_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AgentServer).PublicShare(ctx, req.(*PublicShareRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Agent_ReleaseShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ReleaseShareRequest) if err := dec(in); err != nil { @@ -248,13 +282,17 @@ var Agent_ServiceDesc = grpc.ServiceDesc{ HandlerType: (*AgentServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "PublicShare", - Handler: _Agent_PublicShare_Handler, + MethodName: "PrivateAccess", + Handler: _Agent_PrivateAccess_Handler, }, { MethodName: "PrivateShare", Handler: _Agent_PrivateShare_Handler, }, + { + MethodName: "PublicShare", + Handler: _Agent_PublicShare_Handler, + }, { MethodName: "ReleaseShare", Handler: _Agent_ReleaseShare_Handler, diff --git a/agent/privateAccess.go b/agent/privateAccess.go new file mode 100644 index 00000000..76219fbe --- /dev/null +++ b/agent/privateAccess.go @@ -0,0 +1,48 @@ +package agent + +import ( + "context" + "errors" + "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/agent/proctree" + "github.com/openziti/zrok/environment" + "github.com/sirupsen/logrus" + "os" +) + +func (i *agentGrpcImpl) PrivateAccess(_ context.Context, req *agentGrpc.PrivateAccessRequest) (*agentGrpc.PrivateAccessReply, error) { + root, err := environment.LoadRoot() + if err != nil { + return nil, err + } + + if !root.IsEnabled() { + return nil, errors.New("unable to load environment; did you 'zrok enable'?") + } + + accCmd := []string{os.Args[0], "access", "private", "--agent", "-b", req.BindAddress, req.Token} + acc := &access{ + token: req.Token, + bindAddress: req.BindAddress, + responseHeaders: req.ResponseHeaders, + bootComplete: make(chan struct{}), + a: i.a, + } + + logrus.Infof("executing '%v'", accCmd) + + acc.process, err = proctree.StartChild(acc.tail, accCmd...) + if err != nil { + return nil, err + } + + go acc.monitor() + <-acc.bootComplete + + if acc.bootErr == nil { + i.a.inAccesses <- acc + return &agentGrpc.PrivateAccessReply{FrontendToken: acc.frontendToken}, nil + } + + return nil, acc.bootErr +} From e6a74ad5f32a9ae4621b97b2bada8c923bd54ebd Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 16 Sep 2024 21:40:54 -0400 Subject: [PATCH 40/51] '--agent' for 'zrok access private' (#748) --- cmd/zrok/accessPrivate.go | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/cmd/zrok/accessPrivate.go b/cmd/zrok/accessPrivate.go index 1bb41be1..aa7918ac 100644 --- a/cmd/zrok/accessPrivate.go +++ b/cmd/zrok/accessPrivate.go @@ -1,6 +1,8 @@ package main import ( + "encoding/json" + "fmt" tea "github.com/charmbracelet/bubbletea" "github.com/go-openapi/runtime" httptransport "github.com/go-openapi/runtime/client" @@ -30,6 +32,7 @@ func init() { type accessPrivateCommand struct { bindAddress string headless bool + agent bool responseHeaders []string cmd *cobra.Command } @@ -42,6 +45,8 @@ func newAccessPrivateCommand() *accessPrivateCommand { } command := &accessPrivateCommand{cmd: cmd} cmd.Flags().BoolVar(&command.headless, "headless", false, "Disable TUI and run headless") + cmd.Flags().BoolVar(&command.agent, "agent", false, "Enable agent mode") + cmd.MarkFlagsMutuallyExclusive("headless", "agent") cmd.Flags().StringVarP(&command.bindAddress, "bind", "b", "127.0.0.1:9191", "The address to bind the private frontend") cmd.Flags().StringArrayVar(&command.responseHeaders, "response-header", []string{}, "Add a response header ('key:value')") cmd.Run = command.run @@ -81,7 +86,19 @@ func (cmd *accessPrivateCommand) run(_ *cobra.Command, args []string) { } panic(err) } - logrus.Infof("allocated frontend '%v'", accessResp.Payload.FrontendToken) + + if cmd.agent { + data := make(map[string]interface{}) + data["frontend-token"] = accessResp.Payload.FrontendToken + data["bind-address"] = cmd.bindAddress + jsonData, err := json.Marshal(data) + if err != nil { + panic(err) + } + fmt.Println(string(jsonData)) + } else { + logrus.Infof("allocated frontend '%v'", accessResp.Payload.FrontendToken) + } protocol := "http://" switch accessResp.Payload.BackendMode { @@ -231,6 +248,21 @@ func (cmd *accessPrivateCommand) run(_ *cobra.Command, args []string) { } } + } else if cmd.agent { + for { + select { + case req := <-requests: + data := make(map[string]interface{}) + data["remote-address"] = req.RemoteAddr + data["method"] = req.Method + data["path"] = req.Path + jsonData, err := json.Marshal(data) + if err != nil { + fmt.Println(err) + } + fmt.Println(string(jsonData)) + } + } } else { mdl := newAccessModel(shrToken, endpointUrl.String()) logrus.SetOutput(mdl) From fb23d238a0c768e4b5f6c58ad417f28d8ad69071 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 16 Sep 2024 21:58:03 -0400 Subject: [PATCH 41/51] working 'zrok agent access private' (#463) --- agent/agent.go | 18 ++++++++++ cmd/zrok/agentAccessPrivate.go | 65 ++++++++++++++++++++++++++++++++++ cmd/zrok/agentSharePrivate.go | 2 -- cmd/zrok/main.go | 6 ++++ 4 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 cmd/zrok/agentAccessPrivate.go diff --git a/agent/agent.go b/agent/agent.go index 72d9175e..7eb87f75 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -103,6 +103,24 @@ func (a *Agent) manager() { } else { logrus.Debug("skipping unidentified (orphaned) share removal") } + + case inAccess := <-a.inAccesses: + logrus.Infof("adding new access '%v'", inAccess.frontendToken) + a.accesses[inAccess.frontendToken] = inAccess + + case outAccess := <-a.outAccesses: + if outAccess.frontendToken != "" { + logrus.Infof("removing access '%v'", outAccess.frontendToken) + if err := proctree.StopChild(outAccess.process); err != nil { + logrus.Errorf("error stopping access '%v': %v", outAccess.frontendToken, err) + } + if err := proctree.WaitChild(outAccess.process); err != nil { + logrus.Errorf("error joining access '%v': %v", outAccess.frontendToken, err) + } + delete(a.accesses, outAccess.frontendToken) + } else { + logrus.Debug("skipping unidentified (orphaned) access removal") + } } } } diff --git a/cmd/zrok/agentAccessPrivate.go b/cmd/zrok/agentAccessPrivate.go new file mode 100644 index 00000000..d3517ccc --- /dev/null +++ b/cmd/zrok/agentAccessPrivate.go @@ -0,0 +1,65 @@ +package main + +import ( + "context" + "fmt" + "github.com/openziti/zrok/agent/agentClient" + "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/environment" + "github.com/openziti/zrok/tui" + "github.com/spf13/cobra" +) + +func init() { + agentAccessCmd.AddCommand(newAgentAccessPrivateCommand().cmd) +} + +type agentAccessPrivateCommand struct { + bindAddress string + responseHeaders []string + cmd *cobra.Command +} + +func newAgentAccessPrivateCommand() *agentAccessPrivateCommand { + cmd := &cobra.Command{ + Use: "private ", + Short: "Bind a private access in the zrok Agent", + Args: cobra.ExactArgs(1), + } + command := &agentAccessPrivateCommand{cmd: cmd} + cmd.Flags().StringVarP(&command.bindAddress, "bind", "b", "127.0.0.1:9191", "The address to bind the private frontend") + cmd.Flags().StringArrayVar(&command.responseHeaders, "response-header", []string{}, "Add a response header ('key:value')") + cmd.Run = command.run + return command +} + +func (cmd *agentAccessPrivateCommand) run(_ *cobra.Command, args []string) { + root, err := environment.LoadRoot() + if err != nil { + if !panicInstead { + tui.Error("unable to load environment", err) + } + panic(err) + } + + if !root.IsEnabled() { + tui.Error("unable to load environment; did you 'zrok enable'?", nil) + } + + client, conn, err := agentClient.NewClient(root) + if err != nil { + tui.Error("error connecting to agent", err) + } + defer conn.Close() + + acc, err := client.PrivateAccess(context.Background(), &agentGrpc.PrivateAccessRequest{ + Token: args[0], + BindAddress: cmd.bindAddress, + ResponseHeaders: cmd.responseHeaders, + }) + if err != nil { + tui.Error("error creating access", err) + } + + fmt.Println(acc) +} diff --git a/cmd/zrok/agentSharePrivate.go b/cmd/zrok/agentSharePrivate.go index 8021c04f..eae79dea 100644 --- a/cmd/zrok/agentSharePrivate.go +++ b/cmd/zrok/agentSharePrivate.go @@ -19,7 +19,6 @@ func init() { type agentSharePrivateCommand struct { backendMode string - headless bool insecure bool closed bool accessGrants []string @@ -34,7 +33,6 @@ func newAgentSharePrivateCommand() *agentSharePrivateCommand { } command := &agentSharePrivateCommand{cmd: cmd} cmd.Flags().StringVarP(&command.backendMode, "backend-mode", "b", "proxy", "The backend mode {proxy, web, tcpTunnel, udpTunnel, caddy, drive, socks, vpn}") - cmd.Flags().BoolVar(&command.headless, "headless", false, "Disable TUI and run headless") cmd.Flags().BoolVar(&command.insecure, "insecure", false, "Enable insecure TLS certificate validation for ") cmd.Flags().BoolVar(&command.closed, "closed", false, "Enable closed permission mode (see --access-grant)") cmd.Flags().StringArrayVar(&command.accessGrants, "access-grant", []string{}, "zrok accounts that are allowed to access this share (see --closed)") diff --git a/cmd/zrok/main.go b/cmd/zrok/main.go index 0a92da47..03dd946e 100644 --- a/cmd/zrok/main.go +++ b/cmd/zrok/main.go @@ -25,6 +25,7 @@ func init() { adminCmd.AddCommand(adminListCmd) adminCmd.AddCommand(adminUpdateCmd) rootCmd.AddCommand(agentCmd) + agentCmd.AddCommand(agentAccessCmd) agentCmd.AddCommand(agentShareCmd) agentCmd.AddCommand(agentReleaseCmd) testCmd.AddCommand(loopCmd) @@ -80,6 +81,11 @@ var adminUpdateCmd = &cobra.Command{ Short: "Update global resources", } +var agentAccessCmd = &cobra.Command{ + Use: "access", + Short: "zrok Agent access commands", +} + var agentCmd = &cobra.Command{ Use: "agent", Short: "zrok Agent commands", From 9bf5ff53466bb7100b9993ede31f8aa27321e5e2 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 16 Sep 2024 22:01:09 -0400 Subject: [PATCH 42/51] better access listing in agent status (#463) --- agent/agentGrpc/agent.pb.go | 251 +++++++++++++++++++----------------- agent/agentGrpc/agent.proto | 7 +- agent/status.go | 5 +- cmd/zrok/agentStatus.go | 4 +- 4 files changed, 140 insertions(+), 127 deletions(-) diff --git a/agent/agentGrpc/agent.pb.go b/agent/agentGrpc/agent.pb.go index b0f12a95..ad34f969 100644 --- a/agent/agentGrpc/agent.pb.go +++ b/agent/agentGrpc/agent.pb.go @@ -25,9 +25,10 @@ type AccessDetail struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` - BindAddress string `protobuf:"bytes,2,opt,name=bindAddress,proto3" json:"bindAddress,omitempty"` - ResponseHeaders []string `protobuf:"bytes,3,rep,name=responseHeaders,proto3" json:"responseHeaders,omitempty"` + FrontendToken string `protobuf:"bytes,1,opt,name=frontendToken,proto3" json:"frontendToken,omitempty"` + Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` + BindAddress string `protobuf:"bytes,3,opt,name=bindAddress,proto3" json:"bindAddress,omitempty"` + ResponseHeaders []string `protobuf:"bytes,4,rep,name=responseHeaders,proto3" json:"responseHeaders,omitempty"` } func (x *AccessDetail) Reset() { @@ -62,6 +63,13 @@ func (*AccessDetail) Descriptor() ([]byte, []int) { return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{0} } +func (x *AccessDetail) GetFrontendToken() string { + if x != nil { + return x.FrontendToken + } + return "" +} + func (x *AccessDetail) GetToken() string { if x != nil { return x.Token @@ -863,124 +871,127 @@ var File_agent_agentGrpc_agent_proto protoreflect.FileDescriptor var file_agent_agentGrpc_agent_proto_rawDesc = []byte{ 0x0a, 0x1b, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, - 0x63, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x70, 0x0a, - 0x0c, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, - 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x69, 0x6e, 0x64, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, - 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, - 0x3a, 0x0a, 0x12, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x24, 0x0a, 0x0d, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x66, 0x72, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x78, 0x0a, 0x14, 0x50, - 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x69, 0x6e, - 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x62, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x72, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, 0x29, 0x0a, 0x11, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, - 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, + 0x63, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x96, 0x01, + 0x0a, 0x0c, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x24, + 0x0a, 0x0d, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x69, + 0x6e, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x62, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x0f, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, 0x3a, 0x0a, 0x12, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, + 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x24, 0x0a, 0x0d, + 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x22, 0x78, 0x0a, 0x14, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x22, 0xa7, 0x01, 0x0a, 0x13, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, - 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, - 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x12, 0x16, - 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, - 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x22, 0x56, 0x0a, 0x10, 0x50, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, - 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2c, 0x0a, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, - 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, - 0x74, 0x73, 0x22, 0x86, 0x03, 0x0a, 0x12, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, - 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, - 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x62, 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, - 0x2c, 0x0a, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x66, 0x72, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, - 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, - 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x6f, - 0x61, 0x75, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0d, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, - 0x72, 0x12, 0x3c, 0x0a, 0x19, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x19, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x45, 0x6d, 0x61, 0x69, 0x6c, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x12, - 0x2e, 0x0a, 0x12, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6f, 0x61, 0x75, - 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, - 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x22, 0x2b, 0x0a, 0x13, 0x52, - 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x13, 0x0a, 0x11, 0x52, 0x65, 0x6c, 0x65, - 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x85, 0x02, - 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, - 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, - 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, - 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, - 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, - 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, - 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x62, - 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x16, 0x0a, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5e, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, - 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, - 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0xce, 0x02, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, - 0x12, 0x3d, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x12, 0x15, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, - 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, - 0x3a, 0x0a, 0x0c, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, - 0x14, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, - 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0b, 0x50, - 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x11, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, - 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, - 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x52, 0x65, 0x6c, - 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, - 0x12, 0x28, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, - 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, - 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, 0x29, 0x0a, 0x11, + 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xa7, 0x01, 0x0a, 0x13, 0x50, 0x72, 0x69, 0x76, + 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, + 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, + 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, + 0x65, 0x63, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, + 0x65, 0x63, 0x75, 0x72, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x22, 0x0a, + 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, + 0x73, 0x22, 0x56, 0x0a, 0x10, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2c, 0x0a, 0x11, 0x66, + 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, + 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x22, 0x86, 0x03, 0x0a, 0x12, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x69, + 0x63, 0x41, 0x75, 0x74, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x62, 0x61, 0x73, + 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, 0x2c, 0x0a, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, + 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, + 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, + 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, + 0x72, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6f, 0x61, 0x75, 0x74, 0x68, + 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x19, 0x6f, 0x61, 0x75, 0x74, + 0x68, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x19, 0x6f, 0x61, 0x75, + 0x74, 0x68, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x12, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x12, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, + 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x22, + 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x0a, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, + 0x74, 0x73, 0x22, 0x2b, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, + 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, + 0x13, 0x0a, 0x11, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, + 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, + 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, + 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, + 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, + 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, + 0x6f, 0x73, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x0f, 0x0a, 0x0d, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5e, 0x0a, + 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x29, 0x0a, 0x08, + 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, + 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, + 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, + 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, + 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0xce, 0x02, + 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x3d, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x15, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x13, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, + 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x50, + 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, + 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, + 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x52, + 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x52, 0x65, + 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, + 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2a, + 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, + 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, + 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/agent/agentGrpc/agent.proto b/agent/agentGrpc/agent.proto index b5bc2e1a..89505f26 100644 --- a/agent/agentGrpc/agent.proto +++ b/agent/agentGrpc/agent.proto @@ -12,9 +12,10 @@ service Agent { } message AccessDetail { - string token = 1; - string bindAddress = 2; - repeated string responseHeaders = 3; + string frontendToken = 1; + string token = 2; + string bindAddress = 3; + repeated string responseHeaders = 4; } message PrivateAccessReply{ diff --git a/agent/status.go b/agent/status.go index e0824bc9..9ce0d55a 100644 --- a/agent/status.go +++ b/agent/status.go @@ -7,9 +7,10 @@ import ( func (i *agentGrpcImpl) Status(_ context.Context, _ *agentGrpc.StatusRequest) (*agentGrpc.StatusReply, error) { var accesses []*agentGrpc.AccessDetail - for token, acc := range i.a.accesses { + for feToken, acc := range i.a.accesses { accesses = append(accesses, &agentGrpc.AccessDetail{ - Token: token, + FrontendToken: feToken, + Token: acc.token, BindAddress: acc.bindAddress, ResponseHeaders: acc.responseHeaders, }) diff --git a/cmd/zrok/agentStatus.go b/cmd/zrok/agentStatus.go index 184dbe14..5229a26d 100644 --- a/cmd/zrok/agentStatus.go +++ b/cmd/zrok/agentStatus.go @@ -52,9 +52,9 @@ func (cmd *agentStatusCommand) run(_ *cobra.Command, _ []string) { t := table.NewWriter() t.SetOutputMirror(os.Stdout) t.SetStyle(table.StyleColoredDark) - t.AppendHeader(table.Row{"Token", "Bind Address"}) + t.AppendHeader(table.Row{"Frontend Token", "Token", "Bind Address"}) for _, access := range status.GetAccesses() { - t.AppendRow(table.Row{access.Token, access.BindAddress}) + t.AppendRow(table.Row{access.FrontendToken, access.Token, access.BindAddress}) } t.Render() fmt.Printf("%d accesses in agent\n", len(status.GetAccesses())) From fa8c39b177b6dd9a85d823ada9627407c82787b9 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 16 Sep 2024 22:03:29 -0400 Subject: [PATCH 43/51] grpc for 'zrok agent release access' (#463) --- agent/agentGrpc/agent.pb.go | 330 +++++++++++++++++++++---------- agent/agentGrpc/agent.proto | 8 + agent/agentGrpc/agent_grpc.pb.go | 38 ++++ 3 files changed, 272 insertions(+), 104 deletions(-) diff --git a/agent/agentGrpc/agent.pb.go b/agent/agentGrpc/agent.pb.go index ad34f969..0b9edaac 100644 --- a/agent/agentGrpc/agent.pb.go +++ b/agent/agentGrpc/agent.pb.go @@ -501,6 +501,91 @@ func (x *PublicShareRequest) GetAccessGrants() []string { return nil } +type ReleaseAccessRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FrontendToken string `protobuf:"bytes,1,opt,name=frontendToken,proto3" json:"frontendToken,omitempty"` +} + +func (x *ReleaseAccessRequest) Reset() { + *x = ReleaseAccessRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReleaseAccessRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReleaseAccessRequest) ProtoMessage() {} + +func (x *ReleaseAccessRequest) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 ReleaseAccessRequest.ProtoReflect.Descriptor instead. +func (*ReleaseAccessRequest) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{7} +} + +func (x *ReleaseAccessRequest) GetFrontendToken() string { + if x != nil { + return x.FrontendToken + } + return "" +} + +type ReleaseAccessReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ReleaseAccessReply) Reset() { + *x = ReleaseAccessReply{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReleaseAccessReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReleaseAccessReply) ProtoMessage() {} + +func (x *ReleaseAccessReply) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 ReleaseAccessReply.ProtoReflect.Descriptor instead. +func (*ReleaseAccessReply) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{8} +} + type ReleaseShareRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -512,7 +597,7 @@ type ReleaseShareRequest struct { func (x *ReleaseShareRequest) Reset() { *x = ReleaseShareRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -525,7 +610,7 @@ func (x *ReleaseShareRequest) String() string { func (*ReleaseShareRequest) ProtoMessage() {} func (x *ReleaseShareRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -538,7 +623,7 @@ func (x *ReleaseShareRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReleaseShareRequest.ProtoReflect.Descriptor instead. func (*ReleaseShareRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{7} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{9} } func (x *ReleaseShareRequest) GetToken() string { @@ -557,7 +642,7 @@ type ReleaseShareReply struct { func (x *ReleaseShareReply) Reset() { *x = ReleaseShareReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[8] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -570,7 +655,7 @@ func (x *ReleaseShareReply) String() string { func (*ReleaseShareReply) ProtoMessage() {} func (x *ReleaseShareReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[8] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -583,7 +668,7 @@ func (x *ReleaseShareReply) ProtoReflect() protoreflect.Message { // Deprecated: Use ReleaseShareReply.ProtoReflect.Descriptor instead. func (*ReleaseShareReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{8} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{10} } type ShareDetail struct { @@ -604,7 +689,7 @@ type ShareDetail struct { func (x *ShareDetail) Reset() { *x = ShareDetail{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[9] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -617,7 +702,7 @@ func (x *ShareDetail) String() string { func (*ShareDetail) ProtoMessage() {} func (x *ShareDetail) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[9] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -630,7 +715,7 @@ func (x *ShareDetail) ProtoReflect() protoreflect.Message { // Deprecated: Use ShareDetail.ProtoReflect.Descriptor instead. func (*ShareDetail) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{9} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{11} } func (x *ShareDetail) GetToken() string { @@ -698,7 +783,7 @@ type StatusRequest struct { func (x *StatusRequest) Reset() { *x = StatusRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[10] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -711,7 +796,7 @@ func (x *StatusRequest) String() string { func (*StatusRequest) ProtoMessage() {} func (x *StatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[10] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -724,7 +809,7 @@ func (x *StatusRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead. func (*StatusRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{10} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{12} } type StatusReply struct { @@ -739,7 +824,7 @@ type StatusReply struct { func (x *StatusReply) Reset() { *x = StatusReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -752,7 +837,7 @@ func (x *StatusReply) String() string { func (*StatusReply) ProtoMessage() {} func (x *StatusReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -765,7 +850,7 @@ func (x *StatusReply) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusReply.ProtoReflect.Descriptor instead. func (*StatusReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{11} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{13} } func (x *StatusReply) GetAccesses() []*AccessDetail { @@ -791,7 +876,7 @@ type VersionRequest struct { func (x *VersionRequest) Reset() { *x = VersionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -804,7 +889,7 @@ func (x *VersionRequest) String() string { func (*VersionRequest) ProtoMessage() {} func (x *VersionRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -817,7 +902,7 @@ func (x *VersionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionRequest.ProtoReflect.Descriptor instead. func (*VersionRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{12} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{14} } type VersionReply struct { @@ -831,7 +916,7 @@ type VersionReply struct { func (x *VersionReply) Reset() { *x = VersionReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -844,7 +929,7 @@ func (x *VersionReply) String() string { func (*VersionReply) ProtoMessage() {} func (x *VersionReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -857,7 +942,7 @@ func (x *VersionReply) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionReply.ProtoReflect.Descriptor instead. func (*VersionReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{13} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{15} } func (x *VersionReply) GetV() string { @@ -936,62 +1021,71 @@ var file_agent_agentGrpc_agent_proto_rawDesc = []byte{ 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, - 0x74, 0x73, 0x22, 0x2b, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, - 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, - 0x13, 0x0a, 0x11, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, - 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, - 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, - 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, - 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, - 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, - 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, - 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, - 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, - 0x6f, 0x73, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x0f, 0x0a, 0x0d, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5e, 0x0a, - 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x29, 0x0a, 0x08, - 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, - 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, - 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, - 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, - 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, - 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0xce, 0x02, - 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x3d, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x76, 0x61, - 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x15, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, - 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x13, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, - 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, - 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x50, - 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, - 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, - 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x52, - 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x52, 0x65, - 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, - 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2a, - 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, - 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, - 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 0x74, 0x73, 0x22, 0x3c, 0x0a, 0x14, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x66, 0x72, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x22, 0x14, 0x0a, 0x12, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x2b, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, + 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, + 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x22, 0x13, 0x0a, 0x11, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, + 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, + 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, + 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, + 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, + 0x0a, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, + 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, + 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x22, 0x5e, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x12, 0x29, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, + 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, + 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, + 0x76, 0x32, 0x8d, 0x03, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x3d, 0x0a, 0x0d, 0x50, + 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x15, 0x2e, 0x50, + 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x50, 0x72, + 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x50, 0x72, 0x69, + 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x12, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, + 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x50, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, + 0x3d, 0x0a, 0x0d, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x12, 0x15, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, + 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, + 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, + 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, + 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x06, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, + 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, + 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1006,7 +1100,7 @@ func file_agent_agentGrpc_agent_proto_rawDescGZIP() []byte { return file_agent_agentGrpc_agent_proto_rawDescData } -var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_agent_agentGrpc_agent_proto_goTypes = []any{ (*AccessDetail)(nil), // 0: AccessDetail (*PrivateAccessReply)(nil), // 1: PrivateAccessReply @@ -1015,31 +1109,35 @@ var file_agent_agentGrpc_agent_proto_goTypes = []any{ (*PrivateShareRequest)(nil), // 4: PrivateShareRequest (*PublicShareReply)(nil), // 5: PublicShareReply (*PublicShareRequest)(nil), // 6: PublicShareRequest - (*ReleaseShareRequest)(nil), // 7: ReleaseShareRequest - (*ReleaseShareReply)(nil), // 8: ReleaseShareReply - (*ShareDetail)(nil), // 9: ShareDetail - (*StatusRequest)(nil), // 10: StatusRequest - (*StatusReply)(nil), // 11: StatusReply - (*VersionRequest)(nil), // 12: VersionRequest - (*VersionReply)(nil), // 13: VersionReply + (*ReleaseAccessRequest)(nil), // 7: ReleaseAccessRequest + (*ReleaseAccessReply)(nil), // 8: ReleaseAccessReply + (*ReleaseShareRequest)(nil), // 9: ReleaseShareRequest + (*ReleaseShareReply)(nil), // 10: ReleaseShareReply + (*ShareDetail)(nil), // 11: ShareDetail + (*StatusRequest)(nil), // 12: StatusRequest + (*StatusReply)(nil), // 13: StatusReply + (*VersionRequest)(nil), // 14: VersionRequest + (*VersionReply)(nil), // 15: VersionReply } var file_agent_agentGrpc_agent_proto_depIdxs = []int32{ 0, // 0: StatusReply.accesses:type_name -> AccessDetail - 9, // 1: StatusReply.shares:type_name -> ShareDetail + 11, // 1: StatusReply.shares:type_name -> ShareDetail 2, // 2: Agent.PrivateAccess:input_type -> PrivateAccessRequest 4, // 3: Agent.PrivateShare:input_type -> PrivateShareRequest 6, // 4: Agent.PublicShare:input_type -> PublicShareRequest - 7, // 5: Agent.ReleaseShare:input_type -> ReleaseShareRequest - 10, // 6: Agent.Status:input_type -> StatusRequest - 12, // 7: Agent.Version:input_type -> VersionRequest - 1, // 8: Agent.PrivateAccess:output_type -> PrivateAccessReply - 3, // 9: Agent.PrivateShare:output_type -> PrivateShareReply - 5, // 10: Agent.PublicShare:output_type -> PublicShareReply - 8, // 11: Agent.ReleaseShare:output_type -> ReleaseShareReply - 11, // 12: Agent.Status:output_type -> StatusReply - 13, // 13: Agent.Version:output_type -> VersionReply - 8, // [8:14] is the sub-list for method output_type - 2, // [2:8] is the sub-list for method input_type + 7, // 5: Agent.ReleaseAccess:input_type -> ReleaseAccessRequest + 9, // 6: Agent.ReleaseShare:input_type -> ReleaseShareRequest + 12, // 7: Agent.Status:input_type -> StatusRequest + 14, // 8: Agent.Version:input_type -> VersionRequest + 1, // 9: Agent.PrivateAccess:output_type -> PrivateAccessReply + 3, // 10: Agent.PrivateShare:output_type -> PrivateShareReply + 5, // 11: Agent.PublicShare:output_type -> PublicShareReply + 8, // 12: Agent.ReleaseAccess:output_type -> ReleaseAccessReply + 10, // 13: Agent.ReleaseShare:output_type -> ReleaseShareReply + 13, // 14: Agent.Status:output_type -> StatusReply + 15, // 15: Agent.Version:output_type -> VersionReply + 9, // [9:16] is the sub-list for method output_type + 2, // [2:9] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name @@ -1136,7 +1234,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[7].Exporter = func(v any, i int) any { - switch v := v.(*ReleaseShareRequest); i { + switch v := v.(*ReleaseAccessRequest); i { case 0: return &v.state case 1: @@ -1148,7 +1246,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*ReleaseShareReply); i { + switch v := v.(*ReleaseAccessReply); i { case 0: return &v.state case 1: @@ -1160,7 +1258,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[9].Exporter = func(v any, i int) any { - switch v := v.(*ShareDetail); i { + switch v := v.(*ReleaseShareRequest); i { case 0: return &v.state case 1: @@ -1172,7 +1270,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[10].Exporter = func(v any, i int) any { - switch v := v.(*StatusRequest); i { + switch v := v.(*ReleaseShareReply); i { case 0: return &v.state case 1: @@ -1184,7 +1282,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[11].Exporter = func(v any, i int) any { - switch v := v.(*StatusReply); i { + switch v := v.(*ShareDetail); i { case 0: return &v.state case 1: @@ -1196,7 +1294,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[12].Exporter = func(v any, i int) any { - switch v := v.(*VersionRequest); i { + switch v := v.(*StatusRequest); i { case 0: return &v.state case 1: @@ -1208,6 +1306,30 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[13].Exporter = func(v any, i int) any { + switch v := v.(*StatusReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[14].Exporter = func(v any, i int) any { + switch v := v.(*VersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[15].Exporter = func(v any, i int) any { switch v := v.(*VersionReply); i { case 0: return &v.state @@ -1226,7 +1348,7 @@ func file_agent_agentGrpc_agent_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_agent_agentGrpc_agent_proto_rawDesc, NumEnums: 0, - NumMessages: 14, + NumMessages: 16, NumExtensions: 0, NumServices: 1, }, diff --git a/agent/agentGrpc/agent.proto b/agent/agentGrpc/agent.proto index 89505f26..d45a7138 100644 --- a/agent/agentGrpc/agent.proto +++ b/agent/agentGrpc/agent.proto @@ -6,6 +6,7 @@ service Agent { rpc PrivateAccess(PrivateAccessRequest) returns (PrivateAccessReply) {} rpc PrivateShare(PrivateShareRequest) returns (PrivateShareReply) {} rpc PublicShare(PublicShareRequest) returns (PublicShareReply) {} + rpc ReleaseAccess(ReleaseAccessRequest) returns (ReleaseAccessReply) {} rpc ReleaseShare(ReleaseShareRequest) returns (ReleaseShareReply) {} rpc Status(StatusRequest) returns (StatusReply) {} rpc Version(VersionRequest) returns (VersionReply) {} @@ -58,6 +59,13 @@ message PublicShareRequest { repeated string accessGrants = 10; } +message ReleaseAccessRequest { + string frontendToken = 1; +} + +message ReleaseAccessReply { +} + message ReleaseShareRequest { string token = 1; } diff --git a/agent/agentGrpc/agent_grpc.pb.go b/agent/agentGrpc/agent_grpc.pb.go index becacf10..47fccc10 100644 --- a/agent/agentGrpc/agent_grpc.pb.go +++ b/agent/agentGrpc/agent_grpc.pb.go @@ -22,6 +22,7 @@ const ( Agent_PrivateAccess_FullMethodName = "/Agent/PrivateAccess" Agent_PrivateShare_FullMethodName = "/Agent/PrivateShare" Agent_PublicShare_FullMethodName = "/Agent/PublicShare" + Agent_ReleaseAccess_FullMethodName = "/Agent/ReleaseAccess" Agent_ReleaseShare_FullMethodName = "/Agent/ReleaseShare" Agent_Status_FullMethodName = "/Agent/Status" Agent_Version_FullMethodName = "/Agent/Version" @@ -34,6 +35,7 @@ type AgentClient interface { PrivateAccess(ctx context.Context, in *PrivateAccessRequest, opts ...grpc.CallOption) (*PrivateAccessReply, error) PrivateShare(ctx context.Context, in *PrivateShareRequest, opts ...grpc.CallOption) (*PrivateShareReply, error) PublicShare(ctx context.Context, in *PublicShareRequest, opts ...grpc.CallOption) (*PublicShareReply, error) + ReleaseAccess(ctx context.Context, in *ReleaseAccessRequest, opts ...grpc.CallOption) (*ReleaseAccessReply, error) ReleaseShare(ctx context.Context, in *ReleaseShareRequest, opts ...grpc.CallOption) (*ReleaseShareReply, error) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionReply, error) @@ -77,6 +79,16 @@ func (c *agentClient) PublicShare(ctx context.Context, in *PublicShareRequest, o return out, nil } +func (c *agentClient) ReleaseAccess(ctx context.Context, in *ReleaseAccessRequest, opts ...grpc.CallOption) (*ReleaseAccessReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReleaseAccessReply) + err := c.cc.Invoke(ctx, Agent_ReleaseAccess_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *agentClient) ReleaseShare(ctx context.Context, in *ReleaseShareRequest, opts ...grpc.CallOption) (*ReleaseShareReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ReleaseShareReply) @@ -114,6 +126,7 @@ type AgentServer interface { PrivateAccess(context.Context, *PrivateAccessRequest) (*PrivateAccessReply, error) PrivateShare(context.Context, *PrivateShareRequest) (*PrivateShareReply, error) PublicShare(context.Context, *PublicShareRequest) (*PublicShareReply, error) + ReleaseAccess(context.Context, *ReleaseAccessRequest) (*ReleaseAccessReply, error) ReleaseShare(context.Context, *ReleaseShareRequest) (*ReleaseShareReply, error) Status(context.Context, *StatusRequest) (*StatusReply, error) Version(context.Context, *VersionRequest) (*VersionReply, error) @@ -136,6 +149,9 @@ func (UnimplementedAgentServer) PrivateShare(context.Context, *PrivateShareReque func (UnimplementedAgentServer) PublicShare(context.Context, *PublicShareRequest) (*PublicShareReply, error) { return nil, status.Errorf(codes.Unimplemented, "method PublicShare not implemented") } +func (UnimplementedAgentServer) ReleaseAccess(context.Context, *ReleaseAccessRequest) (*ReleaseAccessReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReleaseAccess not implemented") +} func (UnimplementedAgentServer) ReleaseShare(context.Context, *ReleaseShareRequest) (*ReleaseShareReply, error) { return nil, status.Errorf(codes.Unimplemented, "method ReleaseShare not implemented") } @@ -220,6 +236,24 @@ func _Agent_PublicShare_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Agent_ReleaseAccess_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReleaseAccessRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AgentServer).ReleaseAccess(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Agent_ReleaseAccess_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AgentServer).ReleaseAccess(ctx, req.(*ReleaseAccessRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Agent_ReleaseShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ReleaseShareRequest) if err := dec(in); err != nil { @@ -293,6 +327,10 @@ var Agent_ServiceDesc = grpc.ServiceDesc{ MethodName: "PublicShare", Handler: _Agent_PublicShare_Handler, }, + { + MethodName: "ReleaseAccess", + Handler: _Agent_ReleaseAccess_Handler, + }, { MethodName: "ReleaseShare", Handler: _Agent_ReleaseShare_Handler, From ccfe0df728449a8607bce9636327b1112b32ac3d Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Mon, 16 Sep 2024 22:13:12 -0400 Subject: [PATCH 44/51] 'zrok agent release access' (#463) --- agent/releaseAccess.go | 29 ++++++++++++++++++ cmd/zrok/agentReleaseAccess.go | 55 ++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 agent/releaseAccess.go create mode 100644 cmd/zrok/agentReleaseAccess.go diff --git a/agent/releaseAccess.go b/agent/releaseAccess.go new file mode 100644 index 00000000..1defd165 --- /dev/null +++ b/agent/releaseAccess.go @@ -0,0 +1,29 @@ +package agent + +import ( + "context" + "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/agent/proctree" + "github.com/pkg/errors" + "github.com/sirupsen/logrus" +) + +func (i *agentGrpcImpl) ReleaseAccess(_ context.Context, req *agentGrpc.ReleaseAccessRequest) (*agentGrpc.ReleaseAccessReply, error) { + if acc, found := i.a.accesses[req.FrontendToken]; found { + logrus.Infof("stopping access '%v'", acc.frontendToken) + + if err := proctree.StopChild(acc.process); err != nil { + logrus.Error(err) + } + + if err := proctree.WaitChild(acc.process); err != nil { + logrus.Error(err) + } + + delete(i.a.accesses, acc.frontendToken) + logrus.Infof("released access '%v'", acc.frontendToken) + } else { + return nil, errors.Errorf("agent has no access with frontend token '%v'", req.FrontendToken) + } + return nil, nil +} diff --git a/cmd/zrok/agentReleaseAccess.go b/cmd/zrok/agentReleaseAccess.go new file mode 100644 index 00000000..5e0cdaa3 --- /dev/null +++ b/cmd/zrok/agentReleaseAccess.go @@ -0,0 +1,55 @@ +package main + +import ( + "context" + "fmt" + "github.com/openziti/zrok/agent/agentClient" + "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/environment" + "github.com/openziti/zrok/tui" + "github.com/spf13/cobra" +) + +func init() { + agentReleaseCmd.AddCommand(newAgentReleaseAccessCommand().cmd) +} + +type agentReleaseAccessCommand struct { + cmd *cobra.Command +} + +func newAgentReleaseAccessCommand() *agentReleaseAccessCommand { + cmd := &cobra.Command{ + Use: "access ", + Short: "Unbind an access from the zrok Agent", + Args: cobra.ExactArgs(1), + } + command := &agentReleaseAccessCommand{cmd: cmd} + cmd.Run = command.run + return command +} + +func (cmd *agentReleaseAccessCommand) run(_ *cobra.Command, args []string) { + root, err := environment.LoadRoot() + if err != nil { + if !panicInstead { + tui.Error("unable to load environment", err) + } + panic(err) + } + + client, conn, err := agentClient.NewClient(root) + if err != nil { + tui.Error("error connecting to agent", err) + } + defer conn.Close() + + _, err = client.ReleaseAccess(context.Background(), &agentGrpc.ReleaseAccessRequest{ + FrontendToken: args[0], + }) + if err != nil { + tui.Error("error releasing access", err) + } + + fmt.Println("success.") +} From e3231070ede06ad4259adf5f07d0b12426b11d97 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Tue, 17 Sep 2024 12:24:40 -0400 Subject: [PATCH 45/51] cli bits for 'zrok agent share reserved' (#463) --- agent/agentGrpc/agent.pb.go | 329 ++++++++++++++++++++++--------- agent/agentGrpc/agent.proto | 10 + agent/agentGrpc/agent_grpc.pb.go | 38 ++++ cmd/zrok/agentShareReserved.go | 65 ++++++ 4 files changed, 348 insertions(+), 94 deletions(-) create mode 100644 cmd/zrok/agentShareReserved.go diff --git a/agent/agentGrpc/agent.pb.go b/agent/agentGrpc/agent.pb.go index 0b9edaac..10cce2af 100644 --- a/agent/agentGrpc/agent.pb.go +++ b/agent/agentGrpc/agent.pb.go @@ -671,6 +671,107 @@ func (*ReleaseShareReply) Descriptor() ([]byte, []int) { return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{10} } +type ReservedShareReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ReservedShareReply) Reset() { + *x = ReservedShareReply{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReservedShareReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReservedShareReply) ProtoMessage() {} + +func (x *ReservedShareReply) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 ReservedShareReply.ProtoReflect.Descriptor instead. +func (*ReservedShareReply) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{11} +} + +type ReservedShareRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + OverrideEndpoint string `protobuf:"bytes,2,opt,name=overrideEndpoint,proto3" json:"overrideEndpoint,omitempty"` + Insecure bool `protobuf:"varint,3,opt,name=insecure,proto3" json:"insecure,omitempty"` +} + +func (x *ReservedShareRequest) Reset() { + *x = ReservedShareRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReservedShareRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReservedShareRequest) ProtoMessage() {} + +func (x *ReservedShareRequest) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] + 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 ReservedShareRequest.ProtoReflect.Descriptor instead. +func (*ReservedShareRequest) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{12} +} + +func (x *ReservedShareRequest) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *ReservedShareRequest) GetOverrideEndpoint() string { + if x != nil { + return x.OverrideEndpoint + } + return "" +} + +func (x *ReservedShareRequest) GetInsecure() bool { + if x != nil { + return x.Insecure + } + return false +} + type ShareDetail struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -689,7 +790,7 @@ type ShareDetail struct { func (x *ShareDetail) Reset() { *x = ShareDetail{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -702,7 +803,7 @@ func (x *ShareDetail) String() string { func (*ShareDetail) ProtoMessage() {} func (x *ShareDetail) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -715,7 +816,7 @@ func (x *ShareDetail) ProtoReflect() protoreflect.Message { // Deprecated: Use ShareDetail.ProtoReflect.Descriptor instead. func (*ShareDetail) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{11} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{13} } func (x *ShareDetail) GetToken() string { @@ -783,7 +884,7 @@ type StatusRequest struct { func (x *StatusRequest) Reset() { *x = StatusRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -796,7 +897,7 @@ func (x *StatusRequest) String() string { func (*StatusRequest) ProtoMessage() {} func (x *StatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -809,7 +910,7 @@ func (x *StatusRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead. func (*StatusRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{12} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{14} } type StatusReply struct { @@ -824,7 +925,7 @@ type StatusReply struct { func (x *StatusReply) Reset() { *x = StatusReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -837,7 +938,7 @@ func (x *StatusReply) String() string { func (*StatusReply) ProtoMessage() {} func (x *StatusReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -850,7 +951,7 @@ func (x *StatusReply) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusReply.ProtoReflect.Descriptor instead. func (*StatusReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{13} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{15} } func (x *StatusReply) GetAccesses() []*AccessDetail { @@ -876,7 +977,7 @@ type VersionRequest struct { func (x *VersionRequest) Reset() { *x = VersionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[14] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -889,7 +990,7 @@ func (x *VersionRequest) String() string { func (*VersionRequest) ProtoMessage() {} func (x *VersionRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[14] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -902,7 +1003,7 @@ func (x *VersionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionRequest.ProtoReflect.Descriptor instead. func (*VersionRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{14} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{16} } type VersionReply struct { @@ -916,7 +1017,7 @@ type VersionReply struct { func (x *VersionReply) Reset() { *x = VersionReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[15] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -929,7 +1030,7 @@ func (x *VersionReply) String() string { func (*VersionReply) ProtoMessage() {} func (x *VersionReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[15] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -942,7 +1043,7 @@ func (x *VersionReply) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionReply.ProtoReflect.Descriptor instead. func (*VersionReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{15} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{17} } func (x *VersionReply) GetV() string { @@ -1030,62 +1131,74 @@ var file_agent_agentGrpc_agent_proto_rawDesc = []byte{ 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x13, 0x0a, 0x11, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, - 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, - 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, - 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, - 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, - 0x0a, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, - 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, - 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, - 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x22, 0x5e, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x12, 0x29, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, - 0x6c, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, - 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, - 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, - 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, - 0x76, 0x32, 0x8d, 0x03, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x3d, 0x0a, 0x0d, 0x50, - 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x15, 0x2e, 0x50, - 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x50, 0x72, - 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x50, 0x72, 0x69, - 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x12, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, - 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x50, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, - 0x3d, 0x0a, 0x0d, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x12, 0x15, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, - 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, - 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, - 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, - 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x06, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, - 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, - 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x14, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x74, + 0x0a, 0x14, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2a, 0x0a, 0x10, + 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, + 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, + 0x63, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, + 0x63, 0x75, 0x72, 0x65, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, + 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, + 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, + 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, + 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, + 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, + 0x6f, 0x73, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x0f, 0x0a, 0x0d, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5e, 0x0a, + 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x29, 0x0a, 0x08, + 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, + 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, + 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, + 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, + 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0xcc, 0x03, + 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x3d, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x15, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x13, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, + 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x50, + 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, + 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, + 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0d, 0x52, + 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x15, 0x2e, 0x52, + 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x52, 0x65, + 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x52, 0x65, 0x6c, + 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x15, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, + 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, + 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x0c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, + 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, + 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, + 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1100,7 +1213,7 @@ func file_agent_agentGrpc_agent_proto_rawDescGZIP() []byte { return file_agent_agentGrpc_agent_proto_rawDescData } -var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 16) +var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 18) var file_agent_agentGrpc_agent_proto_goTypes = []any{ (*AccessDetail)(nil), // 0: AccessDetail (*PrivateAccessReply)(nil), // 1: PrivateAccessReply @@ -1113,31 +1226,35 @@ var file_agent_agentGrpc_agent_proto_goTypes = []any{ (*ReleaseAccessReply)(nil), // 8: ReleaseAccessReply (*ReleaseShareRequest)(nil), // 9: ReleaseShareRequest (*ReleaseShareReply)(nil), // 10: ReleaseShareReply - (*ShareDetail)(nil), // 11: ShareDetail - (*StatusRequest)(nil), // 12: StatusRequest - (*StatusReply)(nil), // 13: StatusReply - (*VersionRequest)(nil), // 14: VersionRequest - (*VersionReply)(nil), // 15: VersionReply + (*ReservedShareReply)(nil), // 11: ReservedShareReply + (*ReservedShareRequest)(nil), // 12: ReservedShareRequest + (*ShareDetail)(nil), // 13: ShareDetail + (*StatusRequest)(nil), // 14: StatusRequest + (*StatusReply)(nil), // 15: StatusReply + (*VersionRequest)(nil), // 16: VersionRequest + (*VersionReply)(nil), // 17: VersionReply } var file_agent_agentGrpc_agent_proto_depIdxs = []int32{ 0, // 0: StatusReply.accesses:type_name -> AccessDetail - 11, // 1: StatusReply.shares:type_name -> ShareDetail + 13, // 1: StatusReply.shares:type_name -> ShareDetail 2, // 2: Agent.PrivateAccess:input_type -> PrivateAccessRequest 4, // 3: Agent.PrivateShare:input_type -> PrivateShareRequest 6, // 4: Agent.PublicShare:input_type -> PublicShareRequest 7, // 5: Agent.ReleaseAccess:input_type -> ReleaseAccessRequest 9, // 6: Agent.ReleaseShare:input_type -> ReleaseShareRequest - 12, // 7: Agent.Status:input_type -> StatusRequest - 14, // 8: Agent.Version:input_type -> VersionRequest - 1, // 9: Agent.PrivateAccess:output_type -> PrivateAccessReply - 3, // 10: Agent.PrivateShare:output_type -> PrivateShareReply - 5, // 11: Agent.PublicShare:output_type -> PublicShareReply - 8, // 12: Agent.ReleaseAccess:output_type -> ReleaseAccessReply - 10, // 13: Agent.ReleaseShare:output_type -> ReleaseShareReply - 13, // 14: Agent.Status:output_type -> StatusReply - 15, // 15: Agent.Version:output_type -> VersionReply - 9, // [9:16] is the sub-list for method output_type - 2, // [2:9] is the sub-list for method input_type + 12, // 7: Agent.ReservedShare:input_type -> ReservedShareRequest + 14, // 8: Agent.Status:input_type -> StatusRequest + 16, // 9: Agent.Version:input_type -> VersionRequest + 1, // 10: Agent.PrivateAccess:output_type -> PrivateAccessReply + 3, // 11: Agent.PrivateShare:output_type -> PrivateShareReply + 5, // 12: Agent.PublicShare:output_type -> PublicShareReply + 8, // 13: Agent.ReleaseAccess:output_type -> ReleaseAccessReply + 10, // 14: Agent.ReleaseShare:output_type -> ReleaseShareReply + 11, // 15: Agent.ReservedShare:output_type -> ReservedShareReply + 15, // 16: Agent.Status:output_type -> StatusReply + 17, // 17: Agent.Version:output_type -> VersionReply + 10, // [10:18] is the sub-list for method output_type + 2, // [2:10] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name @@ -1282,7 +1399,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[11].Exporter = func(v any, i int) any { - switch v := v.(*ShareDetail); i { + switch v := v.(*ReservedShareReply); i { case 0: return &v.state case 1: @@ -1294,7 +1411,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[12].Exporter = func(v any, i int) any { - switch v := v.(*StatusRequest); i { + switch v := v.(*ReservedShareRequest); i { case 0: return &v.state case 1: @@ -1306,7 +1423,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[13].Exporter = func(v any, i int) any { - switch v := v.(*StatusReply); i { + switch v := v.(*ShareDetail); i { case 0: return &v.state case 1: @@ -1318,7 +1435,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[14].Exporter = func(v any, i int) any { - switch v := v.(*VersionRequest); i { + switch v := v.(*StatusRequest); i { case 0: return &v.state case 1: @@ -1330,6 +1447,30 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[15].Exporter = func(v any, i int) any { + switch v := v.(*StatusReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[16].Exporter = func(v any, i int) any { + switch v := v.(*VersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[17].Exporter = func(v any, i int) any { switch v := v.(*VersionReply); i { case 0: return &v.state @@ -1348,7 +1489,7 @@ func file_agent_agentGrpc_agent_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_agent_agentGrpc_agent_proto_rawDesc, NumEnums: 0, - NumMessages: 16, + NumMessages: 18, NumExtensions: 0, NumServices: 1, }, diff --git a/agent/agentGrpc/agent.proto b/agent/agentGrpc/agent.proto index d45a7138..4be28a2c 100644 --- a/agent/agentGrpc/agent.proto +++ b/agent/agentGrpc/agent.proto @@ -8,6 +8,7 @@ service Agent { rpc PublicShare(PublicShareRequest) returns (PublicShareReply) {} rpc ReleaseAccess(ReleaseAccessRequest) returns (ReleaseAccessReply) {} rpc ReleaseShare(ReleaseShareRequest) returns (ReleaseShareReply) {} + rpc ReservedShare(ReservedShareRequest) returns (ReservedShareReply) {} rpc Status(StatusRequest) returns (StatusReply) {} rpc Version(VersionRequest) returns (VersionReply) {} } @@ -73,6 +74,15 @@ message ReleaseShareRequest { message ReleaseShareReply { } +message ReservedShareReply { +} + +message ReservedShareRequest { + string token = 1; + string overrideEndpoint = 2; + bool insecure = 3; +} + message ShareDetail { string token = 1; string shareMode = 2; diff --git a/agent/agentGrpc/agent_grpc.pb.go b/agent/agentGrpc/agent_grpc.pb.go index 47fccc10..30db791f 100644 --- a/agent/agentGrpc/agent_grpc.pb.go +++ b/agent/agentGrpc/agent_grpc.pb.go @@ -24,6 +24,7 @@ const ( Agent_PublicShare_FullMethodName = "/Agent/PublicShare" Agent_ReleaseAccess_FullMethodName = "/Agent/ReleaseAccess" Agent_ReleaseShare_FullMethodName = "/Agent/ReleaseShare" + Agent_ReservedShare_FullMethodName = "/Agent/ReservedShare" Agent_Status_FullMethodName = "/Agent/Status" Agent_Version_FullMethodName = "/Agent/Version" ) @@ -37,6 +38,7 @@ type AgentClient interface { PublicShare(ctx context.Context, in *PublicShareRequest, opts ...grpc.CallOption) (*PublicShareReply, error) ReleaseAccess(ctx context.Context, in *ReleaseAccessRequest, opts ...grpc.CallOption) (*ReleaseAccessReply, error) ReleaseShare(ctx context.Context, in *ReleaseShareRequest, opts ...grpc.CallOption) (*ReleaseShareReply, error) + ReservedShare(ctx context.Context, in *ReservedShareRequest, opts ...grpc.CallOption) (*ReservedShareReply, error) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionReply, error) } @@ -99,6 +101,16 @@ func (c *agentClient) ReleaseShare(ctx context.Context, in *ReleaseShareRequest, return out, nil } +func (c *agentClient) ReservedShare(ctx context.Context, in *ReservedShareRequest, opts ...grpc.CallOption) (*ReservedShareReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReservedShareReply) + err := c.cc.Invoke(ctx, Agent_ReservedShare_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *agentClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(StatusReply) @@ -128,6 +140,7 @@ type AgentServer interface { PublicShare(context.Context, *PublicShareRequest) (*PublicShareReply, error) ReleaseAccess(context.Context, *ReleaseAccessRequest) (*ReleaseAccessReply, error) ReleaseShare(context.Context, *ReleaseShareRequest) (*ReleaseShareReply, error) + ReservedShare(context.Context, *ReservedShareRequest) (*ReservedShareReply, error) Status(context.Context, *StatusRequest) (*StatusReply, error) Version(context.Context, *VersionRequest) (*VersionReply, error) mustEmbedUnimplementedAgentServer() @@ -155,6 +168,9 @@ func (UnimplementedAgentServer) ReleaseAccess(context.Context, *ReleaseAccessReq func (UnimplementedAgentServer) ReleaseShare(context.Context, *ReleaseShareRequest) (*ReleaseShareReply, error) { return nil, status.Errorf(codes.Unimplemented, "method ReleaseShare not implemented") } +func (UnimplementedAgentServer) ReservedShare(context.Context, *ReservedShareRequest) (*ReservedShareReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReservedShare not implemented") +} func (UnimplementedAgentServer) Status(context.Context, *StatusRequest) (*StatusReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") } @@ -272,6 +288,24 @@ func _Agent_ReleaseShare_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Agent_ReservedShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReservedShareRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AgentServer).ReservedShare(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Agent_ReservedShare_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AgentServer).ReservedShare(ctx, req.(*ReservedShareRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Agent_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(StatusRequest) if err := dec(in); err != nil { @@ -335,6 +369,10 @@ var Agent_ServiceDesc = grpc.ServiceDesc{ MethodName: "ReleaseShare", Handler: _Agent_ReleaseShare_Handler, }, + { + MethodName: "ReservedShare", + Handler: _Agent_ReservedShare_Handler, + }, { MethodName: "Status", Handler: _Agent_Status_Handler, diff --git a/cmd/zrok/agentShareReserved.go b/cmd/zrok/agentShareReserved.go new file mode 100644 index 00000000..c4276c56 --- /dev/null +++ b/cmd/zrok/agentShareReserved.go @@ -0,0 +1,65 @@ +package main + +import ( + "context" + "fmt" + "github.com/openziti/zrok/agent/agentClient" + "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/environment" + "github.com/openziti/zrok/tui" + "github.com/spf13/cobra" +) + +func init() { + agentShareCmd.AddCommand(newAgentShareReservedCommand().cmd) +} + +type agentShareReservedCommand struct { + overrideEndpoint string + insecure bool + cmd *cobra.Command +} + +func newAgentShareReservedCommand() *agentShareReservedCommand { + cmd := &cobra.Command{ + Use: "reserved ", + Short: "Share an existing reserved share in the zrok Agent", + Args: cobra.ExactArgs(1), + } + command := &agentShareReservedCommand{cmd: cmd} + cmd.Flags().StringVar(&command.overrideEndpoint, "override-endpoint", "", "Override the stored target endpoint with a replacement") + cmd.Flags().BoolVar(&command.insecure, "insecure", false, "Enable insecure TLS certificate validation") + cmd.Run = command.run + return command +} + +func (cmd *agentShareReservedCommand) run(_ *cobra.Command, args []string) { + root, err := environment.LoadRoot() + if err != nil { + if !panicInstead { + tui.Error("unable to load environment", err) + } + panic(err) + } + + if !root.IsEnabled() { + tui.Error("unable to load environment; did you 'zrok enable'?", nil) + } + + client, conn, err := agentClient.NewClient(root) + if err != nil { + tui.Error("error connecting to agent", err) + } + defer conn.Close() + + shr, err := client.ReservedShare(context.Background(), &agentGrpc.ReservedShareRequest{ + Token: args[0], + OverrideEndpoint: cmd.overrideEndpoint, + Insecure: cmd.insecure, + }) + if err != nil { + tui.Error("error sharing reserved share", err) + } + + fmt.Println(shr) +} From cd253e42ab1b089f9e80336615c91313aa23c41d Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Tue, 17 Sep 2024 12:31:52 -0400 Subject: [PATCH 46/51] '--agent' mode for 'zrok share reserved' (#463, #748) --- cmd/zrok/shareReserved.go | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/cmd/zrok/shareReserved.go b/cmd/zrok/shareReserved.go index 0d5688e4..ffa1bd16 100644 --- a/cmd/zrok/shareReserved.go +++ b/cmd/zrok/shareReserved.go @@ -1,6 +1,7 @@ package main import ( + "encoding/json" "fmt" tea "github.com/charmbracelet/bubbletea" httptransport "github.com/go-openapi/runtime/client" @@ -28,6 +29,7 @@ func init() { type shareReservedCommand struct { overrideEndpoint string headless bool + agent bool insecure bool cmd *cobra.Command } @@ -41,6 +43,8 @@ func newShareReservedCommand() *shareReservedCommand { command := &shareReservedCommand{cmd: cmd} cmd.Flags().StringVar(&command.overrideEndpoint, "override-endpoint", "", "Override the stored target endpoint with a replacement") cmd.Flags().BoolVar(&command.headless, "headless", false, "Disable TUI and run headless") + cmd.Flags().BoolVar(&command.agent, "agent", false, "Enable agent mode") + cmd.MarkFlagsMutuallyExclusive("headless", "agent") cmd.Flags().BoolVar(&command.insecure, "insecure", false, "Enable insecure TLS certificate validation") cmd.Run = command.run return command @@ -124,8 +128,24 @@ func (cmd *shareReservedCommand) run(_ *cobra.Command, args []string) { shareDescription = fmt.Sprintf("access your share with: %v", tui.Code.Render(fmt.Sprintf("zrok access private %v", shrToken))) } + if cmd.agent { + data := make(map[string]interface{}) + data["token"] = resp.Payload.Token + if resp.Payload.FrontendEndpoint != "" { + data["frontend_endpoints"] = resp.Payload.FrontendEndpoint + } + if resp.Payload.BackendProxyEndpoint != "" { + data["target"] = resp.Payload.BackendProxyEndpoint + } + jsonData, err := json.Marshal(data) + if err != nil { + panic(err) + } + fmt.Println(string(jsonData)) + } + mdl := newShareModel(shrToken, []string{shareDescription}, sdk.ShareMode(resp.Payload.ShareMode), sdk.BackendMode(resp.Payload.BackendMode)) - if !cmd.headless { + if !cmd.headless && !cmd.agent { proxy.SetCaddyLoggingWriter(mdl) } @@ -324,6 +344,23 @@ func (cmd *shareReservedCommand) run(_ *cobra.Command, args []string) { logrus.Infof("%v -> %v %v", req.RemoteAddr, req.Method, req.Path) } } + + } else if cmd.agent { + for { + select { + case req := <-requests: + data := make(map[string]interface{}) + data["remote-address"] = req.RemoteAddr + data["method"] = req.Method + data["path"] = req.Path + jsonData, err := json.Marshal(data) + if err != nil { + fmt.Println(err) + } + fmt.Println(string(jsonData)) + } + } + } else { logrus.SetOutput(mdl) prg := tea.NewProgram(mdl, tea.WithAltScreen()) From df65230cb2949c6b6805badc160b3d2c137ce78e Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Tue, 17 Sep 2024 12:54:17 -0400 Subject: [PATCH 47/51] reserved sharing infrastructure in the agent (#463) --- agent/agentGrpc/agent.pb.go | 187 +++++++++++++++++++++++------------- agent/agentGrpc/agent.proto | 5 + agent/reservedShare.go | 61 ++++++++++++ agent/share.go | 15 +++ cmd/zrok/shareReserved.go | 2 + 5 files changed, 202 insertions(+), 68 deletions(-) create mode 100644 agent/reservedShare.go diff --git a/agent/agentGrpc/agent.pb.go b/agent/agentGrpc/agent.pb.go index 10cce2af..b81c668b 100644 --- a/agent/agentGrpc/agent.pb.go +++ b/agent/agentGrpc/agent.pb.go @@ -675,6 +675,12 @@ type ReservedShareReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + BackendMode string `protobuf:"bytes,2,opt,name=backendMode,proto3" json:"backendMode,omitempty"` + ShareMode string `protobuf:"bytes,3,opt,name=shareMode,proto3" json:"shareMode,omitempty"` + FrontendEndpoints []string `protobuf:"bytes,4,rep,name=frontendEndpoints,proto3" json:"frontendEndpoints,omitempty"` + Target string `protobuf:"bytes,5,opt,name=target,proto3" json:"target,omitempty"` } func (x *ReservedShareReply) Reset() { @@ -709,6 +715,41 @@ func (*ReservedShareReply) Descriptor() ([]byte, []int) { return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{11} } +func (x *ReservedShareReply) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *ReservedShareReply) GetBackendMode() string { + if x != nil { + return x.BackendMode + } + return "" +} + +func (x *ReservedShareReply) GetShareMode() string { + if x != nil { + return x.ShareMode + } + return "" +} + +func (x *ReservedShareReply) GetFrontendEndpoints() []string { + if x != nil { + return x.FrontendEndpoints + } + return nil +} + +func (x *ReservedShareReply) GetTarget() string { + if x != nil { + return x.Target + } + return "" +} + type ReservedShareRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1131,74 +1172,84 @@ var file_agent_agentGrpc_agent_proto_rawDesc = []byte{ 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x13, 0x0a, 0x11, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, - 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x14, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x74, - 0x0a, 0x14, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2a, 0x0a, 0x10, - 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, - 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, - 0x63, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, - 0x63, 0x75, 0x72, 0x65, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, - 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, - 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, - 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, - 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, - 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, - 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, - 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, - 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, - 0x6f, 0x73, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x0f, 0x0a, 0x0d, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5e, 0x0a, - 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x29, 0x0a, 0x08, - 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, - 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, - 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, - 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, - 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, - 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0xcc, 0x03, - 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x3d, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x76, 0x61, - 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x15, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, - 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x13, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, - 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, - 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x50, - 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, - 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, - 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0d, 0x52, - 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x15, 0x2e, 0x52, - 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x52, 0x65, - 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x52, 0x65, 0x6c, - 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x15, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, - 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, - 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x0c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, - 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, - 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, - 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0xb0, 0x01, 0x0a, 0x12, 0x52, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, + 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, + 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, + 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, + 0x6e, 0x74, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x74, 0x0a, 0x14, 0x52, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2a, 0x0a, 0x10, 0x6f, 0x76, 0x65, + 0x72, 0x72, 0x69, 0x64, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x10, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x45, 0x6e, 0x64, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, + 0x65, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, + 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, + 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, + 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x66, + 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, + 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, + 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, + 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, + 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, + 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5e, 0x0a, 0x0b, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x0c, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, + 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0xcc, 0x03, 0x0a, 0x05, 0x41, + 0x67, 0x65, 0x6e, 0x74, 0x12, 0x3d, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x15, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x50, + 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, + 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, + 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x50, 0x72, 0x69, 0x76, + 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, + 0x37, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x13, + 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, + 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0d, 0x52, 0x65, 0x6c, 0x65, + 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x15, 0x2e, 0x52, 0x65, 0x6c, 0x65, + 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x13, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x65, 0x61, + 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, + 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, + 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x53, + 0x68, 0x61, 0x72, 0x65, 0x12, 0x15, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x53, + 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x52, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x22, 0x00, 0x12, 0x28, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, + 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, + 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/agent/agentGrpc/agent.proto b/agent/agentGrpc/agent.proto index 4be28a2c..cd691a11 100644 --- a/agent/agentGrpc/agent.proto +++ b/agent/agentGrpc/agent.proto @@ -75,6 +75,11 @@ message ReleaseShareReply { } message ReservedShareReply { + string token = 1; + string backendMode = 2; + string shareMode = 3; + repeated string frontendEndpoints = 4; + string target = 5; } message ReservedShareRequest { diff --git a/agent/reservedShare.go b/agent/reservedShare.go new file mode 100644 index 00000000..df13c9b1 --- /dev/null +++ b/agent/reservedShare.go @@ -0,0 +1,61 @@ +package agent + +import ( + "context" + "errors" + "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/agent/proctree" + "github.com/openziti/zrok/environment" + "os" +) + +func (i *agentGrpcImpl) ReservedShare(_ context.Context, req *agentGrpc.ReservedShareRequest) (*agentGrpc.ReservedShareReply, error) { + root, err := environment.LoadRoot() + if err != nil { + return nil, err + } + + if !root.IsEnabled() { + return nil, errors.New("unable to load environment; did you 'zrok enable'?") + } + + shrCmd := []string{os.Args[0], "share", "reserved", "--agent"} + shr := &share{ + reserved: true, + bootComplete: make(chan struct{}), + a: i.a, + } + + if req.OverrideEndpoint != "" { + shrCmd = append(shrCmd, "--override-endpoint", req.OverrideEndpoint) + } + + if req.Insecure { + shrCmd = append(shrCmd, "--insecure") + } + shr.insecure = req.Insecure + + shrCmd = append(shrCmd, req.Token) + shr.token = req.Token + + shr.process, err = proctree.StartChild(shr.tail, shrCmd...) + if err != nil { + return nil, err + } + + go shr.monitor() + <-shr.bootComplete + + if shr.bootErr == nil { + i.a.inShares <- shr + return &agentGrpc.ReservedShareReply{ + Token: shr.token, + BackendMode: string(shr.backendMode), + ShareMode: string(shr.shareMode), + FrontendEndpoints: shr.frontendEndpoints, + Target: shr.target, + }, nil + } + + return nil, shr.bootErr +} diff --git a/agent/share.go b/agent/share.go index 5debc70f..c25479c8 100644 --- a/agent/share.go +++ b/agent/share.go @@ -61,6 +61,16 @@ func (s *share) tail(data []byte) { s.token = str } } + if v, found := in["backend_mode"]; found { + if str, ok := v.(string); ok { + s.backendMode = sdk.BackendMode(str) + } + } + if v, found := in["share_mode"]; found { + if str, ok := v.(string); ok { + s.shareMode = sdk.ShareMode(str) + } + } if v, found := in["frontend_endpoints"]; found { if vArr, ok := v.([]interface{}); ok { for _, v := range vArr { @@ -70,6 +80,11 @@ func (s *share) tail(data []byte) { } } } + if v, found := in["target"]; found { + if str, ok := v.(string); ok { + s.target = str + } + } s.booted = true } else { s.bootErr = errors.New(line) diff --git a/cmd/zrok/shareReserved.go b/cmd/zrok/shareReserved.go index ffa1bd16..6d07ebcf 100644 --- a/cmd/zrok/shareReserved.go +++ b/cmd/zrok/shareReserved.go @@ -131,6 +131,8 @@ func (cmd *shareReservedCommand) run(_ *cobra.Command, args []string) { if cmd.agent { data := make(map[string]interface{}) data["token"] = resp.Payload.Token + data["backend_mode"] = resp.Payload.BackendMode + data["share_mode"] = resp.Payload.ShareMode if resp.Payload.FrontendEndpoint != "" { data["frontend_endpoints"] = resp.Payload.FrontendEndpoint } From 7244bda520e48feb41ecb19fdbc913543172d413 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Tue, 17 Sep 2024 13:12:59 -0400 Subject: [PATCH 48/51] logging tweaks in 'zrok share reserved --agent' (#463) --- cmd/zrok/shareReserved.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/zrok/shareReserved.go b/cmd/zrok/shareReserved.go index 6d07ebcf..45ff1acd 100644 --- a/cmd/zrok/shareReserved.go +++ b/cmd/zrok/shareReserved.go @@ -100,7 +100,9 @@ func (cmd *shareReservedCommand) run(_ *cobra.Command, args []string) { } if resp.Payload.BackendMode != "socks" { - logrus.Infof("sharing target: '%v'", target) + if !cmd.agent { + logrus.Infof("sharing target: '%v'", target) + } if resp.Payload.BackendProxyEndpoint != target { upReq := share.NewUpdateShareParams() @@ -114,9 +116,13 @@ func (cmd *shareReservedCommand) run(_ *cobra.Command, args []string) { } panic(err) } - logrus.Infof("updated backend target to: %v", target) + if !cmd.agent { + logrus.Infof("updated backend target to: %v", target) + } } else { - logrus.Infof("using existing backend target: %v", target) + if !cmd.agent { + logrus.Infof("using existing backend target: %v", target) + } } } From edf40ca2b5e27893044686e999cf3c28a9310009 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Tue, 17 Sep 2024 17:25:24 -0400 Subject: [PATCH 49/51] all snake case (#463) --- agent/access.go | 7 ++++++- cmd/zrok/accessPrivate.go | 4 ++-- cmd/zrok/sharePrivate.go | 2 +- cmd/zrok/sharePublic.go | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/agent/access.go b/agent/access.go index d0815a60..7a97108c 100644 --- a/agent/access.go +++ b/agent/access.go @@ -44,11 +44,16 @@ func (a *access) tail(data []byte) { if !a.booted { in := make(map[string]interface{}) if err := json.Unmarshal([]byte(line), &in); err == nil { - if v, found := in["frontend-token"]; found { + if v, found := in["frontend_token"]; found { if str, ok := v.(string); ok { a.frontendToken = str } } + if v, found := in["bind_address"]; found { + if str, ok := v.(string); ok { + a.bindAddress = str + } + } a.booted = true } else { a.bootErr = errors.New(line) diff --git a/cmd/zrok/accessPrivate.go b/cmd/zrok/accessPrivate.go index aa7918ac..0d49d7a3 100644 --- a/cmd/zrok/accessPrivate.go +++ b/cmd/zrok/accessPrivate.go @@ -89,8 +89,8 @@ func (cmd *accessPrivateCommand) run(_ *cobra.Command, args []string) { if cmd.agent { data := make(map[string]interface{}) - data["frontend-token"] = accessResp.Payload.FrontendToken - data["bind-address"] = cmd.bindAddress + data["frontend_token"] = accessResp.Payload.FrontendToken + data["bind_address"] = cmd.bindAddress jsonData, err := json.Marshal(data) if err != nil { panic(err) diff --git a/cmd/zrok/sharePrivate.go b/cmd/zrok/sharePrivate.go index 2a1135b8..7dd4421d 100644 --- a/cmd/zrok/sharePrivate.go +++ b/cmd/zrok/sharePrivate.go @@ -383,7 +383,7 @@ func (cmd *sharePrivateCommand) run(_ *cobra.Command, args []string) { select { case req := <-requests: data := make(map[string]interface{}) - data["remote-address"] = req.RemoteAddr + data["remote_address"] = req.RemoteAddr data["method"] = req.Method data["path"] = req.Path jsonData, err := json.Marshal(data) diff --git a/cmd/zrok/sharePublic.go b/cmd/zrok/sharePublic.go index e537cbe2..b4190394 100644 --- a/cmd/zrok/sharePublic.go +++ b/cmd/zrok/sharePublic.go @@ -286,7 +286,7 @@ func (cmd *sharePublicCommand) run(_ *cobra.Command, args []string) { select { case req := <-requests: data := make(map[string]interface{}) - data["remote-address"] = req.RemoteAddr + data["remote_address"] = req.RemoteAddr data["method"] = req.Method data["path"] = req.Path jsonData, err := json.Marshal(data) From 0a0d6402c1374846e30b35e899bef95d7336b541 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Wed, 18 Sep 2024 11:54:37 -0400 Subject: [PATCH 50/51] naming lint (#463) --- agent/{privateAccess.go => accessPrivate.go} | 4 +- agent/agentGrpc/agent.pb.go | 1469 +++++++++--------- agent/agentGrpc/agent.proto | 116 +- agent/agentGrpc/agent_grpc.pb.go | 252 +-- agent/releaseAccess.go | 2 +- agent/releaseShare.go | 2 +- agent/{privateShare.go => sharePrivate.go} | 4 +- agent/{publicShare.go => sharePublic.go} | 4 +- agent/{reservedShare.go => shareReserved.go} | 4 +- agent/status.go | 4 +- agent/version.go | 4 +- cmd/zrok/agentAccessPrivate.go | 2 +- cmd/zrok/agentSharePrivate.go | 2 +- cmd/zrok/agentSharePublic.go | 2 +- cmd/zrok/agentShareReserved.go | 2 +- 15 files changed, 938 insertions(+), 935 deletions(-) rename agent/{privateAccess.go => accessPrivate.go} (81%) rename agent/{privateShare.go => sharePrivate.go} (86%) rename agent/{publicShare.go => sharePublic.go} (92%) rename agent/{reservedShare.go => shareReserved.go} (87%) diff --git a/agent/privateAccess.go b/agent/accessPrivate.go similarity index 81% rename from agent/privateAccess.go rename to agent/accessPrivate.go index 76219fbe..2a749a1a 100644 --- a/agent/privateAccess.go +++ b/agent/accessPrivate.go @@ -10,7 +10,7 @@ import ( "os" ) -func (i *agentGrpcImpl) PrivateAccess(_ context.Context, req *agentGrpc.PrivateAccessRequest) (*agentGrpc.PrivateAccessReply, error) { +func (i *agentGrpcImpl) AccessPrivate(_ context.Context, req *agentGrpc.AccessPrivateRequest) (*agentGrpc.AccessPrivateResponse, error) { root, err := environment.LoadRoot() if err != nil { return nil, err @@ -41,7 +41,7 @@ func (i *agentGrpcImpl) PrivateAccess(_ context.Context, req *agentGrpc.PrivateA if acc.bootErr == nil { i.a.inAccesses <- acc - return &agentGrpc.PrivateAccessReply{FrontendToken: acc.frontendToken}, nil + return &agentGrpc.AccessPrivateResponse{FrontendToken: acc.frontendToken}, nil } return nil, acc.bootErr diff --git a/agent/agentGrpc/agent.pb.go b/agent/agentGrpc/agent.pb.go index b81c668b..268266b4 100644 --- a/agent/agentGrpc/agent.pb.go +++ b/agent/agentGrpc/agent.pb.go @@ -91,7 +91,7 @@ func (x *AccessDetail) GetResponseHeaders() []string { return nil } -type PrivateAccessReply struct { +type AccessPrivateResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -99,8 +99,8 @@ type PrivateAccessReply struct { FrontendToken string `protobuf:"bytes,1,opt,name=frontendToken,proto3" json:"frontendToken,omitempty"` } -func (x *PrivateAccessReply) Reset() { - *x = PrivateAccessReply{} +func (x *AccessPrivateResponse) Reset() { + *x = AccessPrivateResponse{} if protoimpl.UnsafeEnabled { mi := &file_agent_agentGrpc_agent_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -108,13 +108,13 @@ func (x *PrivateAccessReply) Reset() { } } -func (x *PrivateAccessReply) String() string { +func (x *AccessPrivateResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*PrivateAccessReply) ProtoMessage() {} +func (*AccessPrivateResponse) ProtoMessage() {} -func (x *PrivateAccessReply) ProtoReflect() protoreflect.Message { +func (x *AccessPrivateResponse) ProtoReflect() protoreflect.Message { mi := &file_agent_agentGrpc_agent_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -126,19 +126,19 @@ func (x *PrivateAccessReply) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use PrivateAccessReply.ProtoReflect.Descriptor instead. -func (*PrivateAccessReply) Descriptor() ([]byte, []int) { +// Deprecated: Use AccessPrivateResponse.ProtoReflect.Descriptor instead. +func (*AccessPrivateResponse) Descriptor() ([]byte, []int) { return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{1} } -func (x *PrivateAccessReply) GetFrontendToken() string { +func (x *AccessPrivateResponse) GetFrontendToken() string { if x != nil { return x.FrontendToken } return "" } -type PrivateAccessRequest struct { +type AccessPrivateRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -148,8 +148,8 @@ type PrivateAccessRequest struct { ResponseHeaders []string `protobuf:"bytes,3,rep,name=responseHeaders,proto3" json:"responseHeaders,omitempty"` } -func (x *PrivateAccessRequest) Reset() { - *x = PrivateAccessRequest{} +func (x *AccessPrivateRequest) Reset() { + *x = AccessPrivateRequest{} if protoimpl.UnsafeEnabled { mi := &file_agent_agentGrpc_agent_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -157,13 +157,13 @@ func (x *PrivateAccessRequest) Reset() { } } -func (x *PrivateAccessRequest) String() string { +func (x *AccessPrivateRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*PrivateAccessRequest) ProtoMessage() {} +func (*AccessPrivateRequest) ProtoMessage() {} -func (x *PrivateAccessRequest) ProtoReflect() protoreflect.Message { +func (x *AccessPrivateRequest) ProtoReflect() protoreflect.Message { mi := &file_agent_agentGrpc_agent_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -175,332 +175,32 @@ func (x *PrivateAccessRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use PrivateAccessRequest.ProtoReflect.Descriptor instead. -func (*PrivateAccessRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use AccessPrivateRequest.ProtoReflect.Descriptor instead. +func (*AccessPrivateRequest) Descriptor() ([]byte, []int) { return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{2} } -func (x *PrivateAccessRequest) GetToken() string { +func (x *AccessPrivateRequest) GetToken() string { if x != nil { return x.Token } return "" } -func (x *PrivateAccessRequest) GetBindAddress() string { +func (x *AccessPrivateRequest) GetBindAddress() string { if x != nil { return x.BindAddress } return "" } -func (x *PrivateAccessRequest) GetResponseHeaders() []string { +func (x *AccessPrivateRequest) GetResponseHeaders() []string { if x != nil { return x.ResponseHeaders } return nil } -type PrivateShareReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` -} - -func (x *PrivateShareReply) Reset() { - *x = PrivateShareReply{} - if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PrivateShareReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PrivateShareReply) ProtoMessage() {} - -func (x *PrivateShareReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_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 PrivateShareReply.ProtoReflect.Descriptor instead. -func (*PrivateShareReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{3} -} - -func (x *PrivateShareReply) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -type PrivateShareRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` - BackendMode string `protobuf:"bytes,2,opt,name=backendMode,proto3" json:"backendMode,omitempty"` - Insecure bool `protobuf:"varint,3,opt,name=insecure,proto3" json:"insecure,omitempty"` - Closed bool `protobuf:"varint,4,opt,name=closed,proto3" json:"closed,omitempty"` - AccessGrants []string `protobuf:"bytes,5,rep,name=accessGrants,proto3" json:"accessGrants,omitempty"` -} - -func (x *PrivateShareRequest) Reset() { - *x = PrivateShareRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PrivateShareRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PrivateShareRequest) ProtoMessage() {} - -func (x *PrivateShareRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_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 PrivateShareRequest.ProtoReflect.Descriptor instead. -func (*PrivateShareRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{4} -} - -func (x *PrivateShareRequest) GetTarget() string { - if x != nil { - return x.Target - } - return "" -} - -func (x *PrivateShareRequest) GetBackendMode() string { - if x != nil { - return x.BackendMode - } - return "" -} - -func (x *PrivateShareRequest) GetInsecure() bool { - if x != nil { - return x.Insecure - } - return false -} - -func (x *PrivateShareRequest) GetClosed() bool { - if x != nil { - return x.Closed - } - return false -} - -func (x *PrivateShareRequest) GetAccessGrants() []string { - if x != nil { - return x.AccessGrants - } - return nil -} - -type PublicShareReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` - FrontendEndpoints []string `protobuf:"bytes,2,rep,name=frontendEndpoints,proto3" json:"frontendEndpoints,omitempty"` -} - -func (x *PublicShareReply) Reset() { - *x = PublicShareReply{} - if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PublicShareReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PublicShareReply) ProtoMessage() {} - -func (x *PublicShareReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_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 PublicShareReply.ProtoReflect.Descriptor instead. -func (*PublicShareReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{5} -} - -func (x *PublicShareReply) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -func (x *PublicShareReply) GetFrontendEndpoints() []string { - if x != nil { - return x.FrontendEndpoints - } - return nil -} - -type PublicShareRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` - BasicAuth []string `protobuf:"bytes,2,rep,name=basicAuth,proto3" json:"basicAuth,omitempty"` - FrontendSelection []string `protobuf:"bytes,3,rep,name=frontendSelection,proto3" json:"frontendSelection,omitempty"` - BackendMode string `protobuf:"bytes,4,opt,name=backendMode,proto3" json:"backendMode,omitempty"` - Insecure bool `protobuf:"varint,5,opt,name=insecure,proto3" json:"insecure,omitempty"` - OauthProvider string `protobuf:"bytes,6,opt,name=oauthProvider,proto3" json:"oauthProvider,omitempty"` - OauthEmailAddressPatterns []string `protobuf:"bytes,7,rep,name=oauthEmailAddressPatterns,proto3" json:"oauthEmailAddressPatterns,omitempty"` - OauthCheckInterval string `protobuf:"bytes,8,opt,name=oauthCheckInterval,proto3" json:"oauthCheckInterval,omitempty"` - Closed bool `protobuf:"varint,9,opt,name=closed,proto3" json:"closed,omitempty"` - AccessGrants []string `protobuf:"bytes,10,rep,name=accessGrants,proto3" json:"accessGrants,omitempty"` -} - -func (x *PublicShareRequest) Reset() { - *x = PublicShareRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PublicShareRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PublicShareRequest) ProtoMessage() {} - -func (x *PublicShareRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_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 PublicShareRequest.ProtoReflect.Descriptor instead. -func (*PublicShareRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{6} -} - -func (x *PublicShareRequest) GetTarget() string { - if x != nil { - return x.Target - } - return "" -} - -func (x *PublicShareRequest) GetBasicAuth() []string { - if x != nil { - return x.BasicAuth - } - return nil -} - -func (x *PublicShareRequest) GetFrontendSelection() []string { - if x != nil { - return x.FrontendSelection - } - return nil -} - -func (x *PublicShareRequest) GetBackendMode() string { - if x != nil { - return x.BackendMode - } - return "" -} - -func (x *PublicShareRequest) GetInsecure() bool { - if x != nil { - return x.Insecure - } - return false -} - -func (x *PublicShareRequest) GetOauthProvider() string { - if x != nil { - return x.OauthProvider - } - return "" -} - -func (x *PublicShareRequest) GetOauthEmailAddressPatterns() []string { - if x != nil { - return x.OauthEmailAddressPatterns - } - return nil -} - -func (x *PublicShareRequest) GetOauthCheckInterval() string { - if x != nil { - return x.OauthCheckInterval - } - return "" -} - -func (x *PublicShareRequest) GetClosed() bool { - if x != nil { - return x.Closed - } - return false -} - -func (x *PublicShareRequest) GetAccessGrants() []string { - if x != nil { - return x.AccessGrants - } - return nil -} - type ReleaseAccessRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -512,7 +212,7 @@ type ReleaseAccessRequest struct { func (x *ReleaseAccessRequest) Reset() { *x = ReleaseAccessRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -525,7 +225,7 @@ func (x *ReleaseAccessRequest) String() string { func (*ReleaseAccessRequest) ProtoMessage() {} func (x *ReleaseAccessRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -538,7 +238,7 @@ func (x *ReleaseAccessRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReleaseAccessRequest.ProtoReflect.Descriptor instead. func (*ReleaseAccessRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{7} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{3} } func (x *ReleaseAccessRequest) GetFrontendToken() string { @@ -548,29 +248,29 @@ func (x *ReleaseAccessRequest) GetFrontendToken() string { return "" } -type ReleaseAccessReply struct { +type ReleaseAccessResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *ReleaseAccessReply) Reset() { - *x = ReleaseAccessReply{} +func (x *ReleaseAccessResponse) Reset() { + *x = ReleaseAccessResponse{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[8] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *ReleaseAccessReply) String() string { +func (x *ReleaseAccessResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ReleaseAccessReply) ProtoMessage() {} +func (*ReleaseAccessResponse) ProtoMessage() {} -func (x *ReleaseAccessReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[8] +func (x *ReleaseAccessResponse) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -581,9 +281,9 @@ func (x *ReleaseAccessReply) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ReleaseAccessReply.ProtoReflect.Descriptor instead. -func (*ReleaseAccessReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{8} +// Deprecated: Use ReleaseAccessResponse.ProtoReflect.Descriptor instead. +func (*ReleaseAccessResponse) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{4} } type ReleaseShareRequest struct { @@ -597,7 +297,7 @@ type ReleaseShareRequest struct { func (x *ReleaseShareRequest) Reset() { *x = ReleaseShareRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[9] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -610,7 +310,7 @@ func (x *ReleaseShareRequest) String() string { func (*ReleaseShareRequest) ProtoMessage() {} func (x *ReleaseShareRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[9] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -623,7 +323,7 @@ func (x *ReleaseShareRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReleaseShareRequest.ProtoReflect.Descriptor instead. func (*ReleaseShareRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{9} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{5} } func (x *ReleaseShareRequest) GetToken() string { @@ -633,29 +333,29 @@ func (x *ReleaseShareRequest) GetToken() string { return "" } -type ReleaseShareReply struct { +type ReleaseShareResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *ReleaseShareReply) Reset() { - *x = ReleaseShareReply{} +func (x *ReleaseShareResponse) Reset() { + *x = ReleaseShareResponse{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[10] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *ReleaseShareReply) String() string { +func (x *ReleaseShareResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ReleaseShareReply) ProtoMessage() {} +func (*ReleaseShareResponse) ProtoMessage() {} -func (x *ReleaseShareReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[10] +func (x *ReleaseShareResponse) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -666,151 +366,9 @@ func (x *ReleaseShareReply) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ReleaseShareReply.ProtoReflect.Descriptor instead. -func (*ReleaseShareReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{10} -} - -type ReservedShareReply struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` - BackendMode string `protobuf:"bytes,2,opt,name=backendMode,proto3" json:"backendMode,omitempty"` - ShareMode string `protobuf:"bytes,3,opt,name=shareMode,proto3" json:"shareMode,omitempty"` - FrontendEndpoints []string `protobuf:"bytes,4,rep,name=frontendEndpoints,proto3" json:"frontendEndpoints,omitempty"` - Target string `protobuf:"bytes,5,opt,name=target,proto3" json:"target,omitempty"` -} - -func (x *ReservedShareReply) Reset() { - *x = ReservedShareReply{} - if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReservedShareReply) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReservedShareReply) ProtoMessage() {} - -func (x *ReservedShareReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_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 ReservedShareReply.ProtoReflect.Descriptor instead. -func (*ReservedShareReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{11} -} - -func (x *ReservedShareReply) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -func (x *ReservedShareReply) GetBackendMode() string { - if x != nil { - return x.BackendMode - } - return "" -} - -func (x *ReservedShareReply) GetShareMode() string { - if x != nil { - return x.ShareMode - } - return "" -} - -func (x *ReservedShareReply) GetFrontendEndpoints() []string { - if x != nil { - return x.FrontendEndpoints - } - return nil -} - -func (x *ReservedShareReply) GetTarget() string { - if x != nil { - return x.Target - } - return "" -} - -type ReservedShareRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` - OverrideEndpoint string `protobuf:"bytes,2,opt,name=overrideEndpoint,proto3" json:"overrideEndpoint,omitempty"` - Insecure bool `protobuf:"varint,3,opt,name=insecure,proto3" json:"insecure,omitempty"` -} - -func (x *ReservedShareRequest) Reset() { - *x = ReservedShareRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ReservedShareRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReservedShareRequest) ProtoMessage() {} - -func (x *ReservedShareRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] - 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 ReservedShareRequest.ProtoReflect.Descriptor instead. -func (*ReservedShareRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{12} -} - -func (x *ReservedShareRequest) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -func (x *ReservedShareRequest) GetOverrideEndpoint() string { - if x != nil { - return x.OverrideEndpoint - } - return "" -} - -func (x *ReservedShareRequest) GetInsecure() bool { - if x != nil { - return x.Insecure - } - return false +// Deprecated: Use ReleaseShareResponse.ProtoReflect.Descriptor instead. +func (*ReleaseShareResponse) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{6} } type ShareDetail struct { @@ -831,7 +389,7 @@ type ShareDetail struct { func (x *ShareDetail) Reset() { *x = ShareDetail{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -844,7 +402,7 @@ func (x *ShareDetail) String() string { func (*ShareDetail) ProtoMessage() {} func (x *ShareDetail) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -857,7 +415,7 @@ func (x *ShareDetail) ProtoReflect() protoreflect.Message { // Deprecated: Use ShareDetail.ProtoReflect.Descriptor instead. func (*ShareDetail) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{13} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{7} } func (x *ShareDetail) GetToken() string { @@ -916,6 +474,448 @@ func (x *ShareDetail) GetStatus() string { return "" } +type SharePrivateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` + BackendMode string `protobuf:"bytes,2,opt,name=backendMode,proto3" json:"backendMode,omitempty"` + Insecure bool `protobuf:"varint,3,opt,name=insecure,proto3" json:"insecure,omitempty"` + Closed bool `protobuf:"varint,4,opt,name=closed,proto3" json:"closed,omitempty"` + AccessGrants []string `protobuf:"bytes,5,rep,name=accessGrants,proto3" json:"accessGrants,omitempty"` +} + +func (x *SharePrivateRequest) Reset() { + *x = SharePrivateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SharePrivateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SharePrivateRequest) ProtoMessage() {} + +func (x *SharePrivateRequest) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 SharePrivateRequest.ProtoReflect.Descriptor instead. +func (*SharePrivateRequest) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{8} +} + +func (x *SharePrivateRequest) GetTarget() string { + if x != nil { + return x.Target + } + return "" +} + +func (x *SharePrivateRequest) GetBackendMode() string { + if x != nil { + return x.BackendMode + } + return "" +} + +func (x *SharePrivateRequest) GetInsecure() bool { + if x != nil { + return x.Insecure + } + return false +} + +func (x *SharePrivateRequest) GetClosed() bool { + if x != nil { + return x.Closed + } + return false +} + +func (x *SharePrivateRequest) GetAccessGrants() []string { + if x != nil { + return x.AccessGrants + } + return nil +} + +type SharePrivateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` +} + +func (x *SharePrivateResponse) Reset() { + *x = SharePrivateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SharePrivateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SharePrivateResponse) ProtoMessage() {} + +func (x *SharePrivateResponse) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 SharePrivateResponse.ProtoReflect.Descriptor instead. +func (*SharePrivateResponse) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{9} +} + +func (x *SharePrivateResponse) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +type SharePublicRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` + BasicAuth []string `protobuf:"bytes,2,rep,name=basicAuth,proto3" json:"basicAuth,omitempty"` + FrontendSelection []string `protobuf:"bytes,3,rep,name=frontendSelection,proto3" json:"frontendSelection,omitempty"` + BackendMode string `protobuf:"bytes,4,opt,name=backendMode,proto3" json:"backendMode,omitempty"` + Insecure bool `protobuf:"varint,5,opt,name=insecure,proto3" json:"insecure,omitempty"` + OauthProvider string `protobuf:"bytes,6,opt,name=oauthProvider,proto3" json:"oauthProvider,omitempty"` + OauthEmailAddressPatterns []string `protobuf:"bytes,7,rep,name=oauthEmailAddressPatterns,proto3" json:"oauthEmailAddressPatterns,omitempty"` + OauthCheckInterval string `protobuf:"bytes,8,opt,name=oauthCheckInterval,proto3" json:"oauthCheckInterval,omitempty"` + Closed bool `protobuf:"varint,9,opt,name=closed,proto3" json:"closed,omitempty"` + AccessGrants []string `protobuf:"bytes,10,rep,name=accessGrants,proto3" json:"accessGrants,omitempty"` +} + +func (x *SharePublicRequest) Reset() { + *x = SharePublicRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SharePublicRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SharePublicRequest) ProtoMessage() {} + +func (x *SharePublicRequest) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 SharePublicRequest.ProtoReflect.Descriptor instead. +func (*SharePublicRequest) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{10} +} + +func (x *SharePublicRequest) GetTarget() string { + if x != nil { + return x.Target + } + return "" +} + +func (x *SharePublicRequest) GetBasicAuth() []string { + if x != nil { + return x.BasicAuth + } + return nil +} + +func (x *SharePublicRequest) GetFrontendSelection() []string { + if x != nil { + return x.FrontendSelection + } + return nil +} + +func (x *SharePublicRequest) GetBackendMode() string { + if x != nil { + return x.BackendMode + } + return "" +} + +func (x *SharePublicRequest) GetInsecure() bool { + if x != nil { + return x.Insecure + } + return false +} + +func (x *SharePublicRequest) GetOauthProvider() string { + if x != nil { + return x.OauthProvider + } + return "" +} + +func (x *SharePublicRequest) GetOauthEmailAddressPatterns() []string { + if x != nil { + return x.OauthEmailAddressPatterns + } + return nil +} + +func (x *SharePublicRequest) GetOauthCheckInterval() string { + if x != nil { + return x.OauthCheckInterval + } + return "" +} + +func (x *SharePublicRequest) GetClosed() bool { + if x != nil { + return x.Closed + } + return false +} + +func (x *SharePublicRequest) GetAccessGrants() []string { + if x != nil { + return x.AccessGrants + } + return nil +} + +type SharePublicResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + FrontendEndpoints []string `protobuf:"bytes,2,rep,name=frontendEndpoints,proto3" json:"frontendEndpoints,omitempty"` +} + +func (x *SharePublicResponse) Reset() { + *x = SharePublicResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SharePublicResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SharePublicResponse) ProtoMessage() {} + +func (x *SharePublicResponse) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_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 SharePublicResponse.ProtoReflect.Descriptor instead. +func (*SharePublicResponse) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{11} +} + +func (x *SharePublicResponse) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *SharePublicResponse) GetFrontendEndpoints() []string { + if x != nil { + return x.FrontendEndpoints + } + return nil +} + +type ShareReservedRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + OverrideEndpoint string `protobuf:"bytes,2,opt,name=overrideEndpoint,proto3" json:"overrideEndpoint,omitempty"` + Insecure bool `protobuf:"varint,3,opt,name=insecure,proto3" json:"insecure,omitempty"` +} + +func (x *ShareReservedRequest) Reset() { + *x = ShareReservedRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ShareReservedRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShareReservedRequest) ProtoMessage() {} + +func (x *ShareReservedRequest) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] + 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 ShareReservedRequest.ProtoReflect.Descriptor instead. +func (*ShareReservedRequest) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{12} +} + +func (x *ShareReservedRequest) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *ShareReservedRequest) GetOverrideEndpoint() string { + if x != nil { + return x.OverrideEndpoint + } + return "" +} + +func (x *ShareReservedRequest) GetInsecure() bool { + if x != nil { + return x.Insecure + } + return false +} + +type ShareReservedResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + BackendMode string `protobuf:"bytes,2,opt,name=backendMode,proto3" json:"backendMode,omitempty"` + ShareMode string `protobuf:"bytes,3,opt,name=shareMode,proto3" json:"shareMode,omitempty"` + FrontendEndpoints []string `protobuf:"bytes,4,rep,name=frontendEndpoints,proto3" json:"frontendEndpoints,omitempty"` + Target string `protobuf:"bytes,5,opt,name=target,proto3" json:"target,omitempty"` +} + +func (x *ShareReservedResponse) Reset() { + *x = ShareReservedResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ShareReservedResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShareReservedResponse) ProtoMessage() {} + +func (x *ShareReservedResponse) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] + 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 ShareReservedResponse.ProtoReflect.Descriptor instead. +func (*ShareReservedResponse) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{13} +} + +func (x *ShareReservedResponse) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *ShareReservedResponse) GetBackendMode() string { + if x != nil { + return x.BackendMode + } + return "" +} + +func (x *ShareReservedResponse) GetShareMode() string { + if x != nil { + return x.ShareMode + } + return "" +} + +func (x *ShareReservedResponse) GetFrontendEndpoints() []string { + if x != nil { + return x.FrontendEndpoints + } + return nil +} + +func (x *ShareReservedResponse) GetTarget() string { + if x != nil { + return x.Target + } + return "" +} + type StatusRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -954,7 +954,7 @@ func (*StatusRequest) Descriptor() ([]byte, []int) { return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{14} } -type StatusReply struct { +type StatusResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -963,8 +963,8 @@ type StatusReply struct { Shares []*ShareDetail `protobuf:"bytes,2,rep,name=shares,proto3" json:"shares,omitempty"` } -func (x *StatusReply) Reset() { - *x = StatusReply{} +func (x *StatusResponse) Reset() { + *x = StatusResponse{} if protoimpl.UnsafeEnabled { mi := &file_agent_agentGrpc_agent_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -972,13 +972,13 @@ func (x *StatusReply) Reset() { } } -func (x *StatusReply) String() string { +func (x *StatusResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*StatusReply) ProtoMessage() {} +func (*StatusResponse) ProtoMessage() {} -func (x *StatusReply) ProtoReflect() protoreflect.Message { +func (x *StatusResponse) ProtoReflect() protoreflect.Message { mi := &file_agent_agentGrpc_agent_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -990,19 +990,19 @@ func (x *StatusReply) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use StatusReply.ProtoReflect.Descriptor instead. -func (*StatusReply) Descriptor() ([]byte, []int) { +// Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead. +func (*StatusResponse) Descriptor() ([]byte, []int) { return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{15} } -func (x *StatusReply) GetAccesses() []*AccessDetail { +func (x *StatusResponse) GetAccesses() []*AccessDetail { if x != nil { return x.Accesses } return nil } -func (x *StatusReply) GetShares() []*ShareDetail { +func (x *StatusResponse) GetShares() []*ShareDetail { if x != nil { return x.Shares } @@ -1047,7 +1047,7 @@ func (*VersionRequest) Descriptor() ([]byte, []int) { return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{16} } -type VersionReply struct { +type VersionResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -1055,8 +1055,8 @@ type VersionReply struct { V string `protobuf:"bytes,1,opt,name=v,proto3" json:"v,omitempty"` } -func (x *VersionReply) Reset() { - *x = VersionReply{} +func (x *VersionResponse) Reset() { + *x = VersionResponse{} if protoimpl.UnsafeEnabled { mi := &file_agent_agentGrpc_agent_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1064,13 +1064,13 @@ func (x *VersionReply) Reset() { } } -func (x *VersionReply) String() string { +func (x *VersionResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*VersionReply) ProtoMessage() {} +func (*VersionResponse) ProtoMessage() {} -func (x *VersionReply) ProtoReflect() protoreflect.Message { +func (x *VersionResponse) ProtoReflect() protoreflect.Message { mi := &file_agent_agentGrpc_agent_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1082,12 +1082,12 @@ func (x *VersionReply) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use VersionReply.ProtoReflect.Descriptor instead. -func (*VersionReply) Descriptor() ([]byte, []int) { +// Deprecated: Use VersionResponse.ProtoReflect.Descriptor instead. +func (*VersionResponse) Descriptor() ([]byte, []int) { return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{17} } -func (x *VersionReply) GetV() string { +func (x *VersionResponse) GetV() string { if x != nil { return x.V } @@ -1108,72 +1108,97 @@ var file_agent_agentGrpc_agent_proto_rawDesc = []byte{ 0x0b, 0x62, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, 0x3a, 0x0a, 0x12, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, - 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x24, 0x0a, 0x0d, - 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0d, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, - 0x65, 0x6e, 0x22, 0x78, 0x0a, 0x14, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, 0x29, 0x0a, 0x11, - 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0xa7, 0x01, 0x0a, 0x13, 0x50, 0x72, 0x69, 0x76, - 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, - 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, - 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, - 0x65, 0x63, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, - 0x65, 0x63, 0x75, 0x72, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x22, 0x0a, - 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, - 0x73, 0x22, 0x56, 0x0a, 0x10, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2c, 0x0a, 0x11, 0x66, - 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, - 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x22, 0x86, 0x03, 0x0a, 0x12, 0x50, 0x75, - 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x69, - 0x63, 0x41, 0x75, 0x74, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x62, 0x61, 0x73, - 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, 0x2c, 0x0a, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, - 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, - 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, - 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, - 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, - 0x72, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, - 0x64, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6f, 0x61, 0x75, 0x74, 0x68, - 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x19, 0x6f, 0x61, 0x75, 0x74, - 0x68, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x19, 0x6f, 0x61, 0x75, - 0x74, 0x68, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x12, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x08, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x12, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, - 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, - 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x22, - 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x0a, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, - 0x74, 0x73, 0x22, 0x3c, 0x0a, 0x14, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x66, 0x72, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0d, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x22, 0x14, 0x0a, 0x12, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x2b, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, 0x3d, 0x0a, 0x15, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x24, 0x0a, 0x0d, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x78, 0x0a, 0x14, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, + 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, + 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x69, 0x6e, 0x64, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x22, + 0x3c, 0x0a, 0x14, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x66, 0x72, 0x6f, 0x6e, 0x74, + 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, + 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x17, 0x0a, + 0x15, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x0a, 0x13, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x22, 0x13, 0x0a, 0x11, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, - 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0xb0, 0x01, 0x0a, 0x12, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, + 0x6b, 0x65, 0x6e, 0x22, 0x16, 0x0a, 0x14, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, + 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x85, 0x02, 0x0a, 0x0b, + 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, + 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, + 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, + 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, + 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, + 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x22, 0xa7, 0x01, 0x0a, 0x13, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x72, 0x69, + 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, + 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, + 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, 0x22, 0x2c, 0x0a, + 0x14, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x86, 0x03, 0x0a, 0x12, + 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x61, + 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x62, + 0x61, 0x73, 0x69, 0x63, 0x41, 0x75, 0x74, 0x68, 0x12, 0x2c, 0x0a, 0x11, 0x66, 0x72, 0x6f, 0x6e, + 0x74, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x6c, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, + 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, + 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, + 0x63, 0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, + 0x63, 0x75, 0x72, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x50, 0x72, 0x6f, + 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6f, 0x61, 0x75, + 0x74, 0x68, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x3c, 0x0a, 0x19, 0x6f, 0x61, + 0x75, 0x74, 0x68, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x19, 0x6f, + 0x61, 0x75, 0x74, 0x68, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x73, 0x12, 0x2e, 0x0a, 0x12, 0x6f, 0x61, 0x75, 0x74, + 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, + 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, + 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x73, + 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x47, 0x72, + 0x61, 0x6e, 0x74, 0x73, 0x22, 0x59, 0x0a, 0x13, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x75, 0x62, + 0x6c, 0x69, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x12, 0x2c, 0x0a, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x66, 0x72, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x22, + 0x74, 0x0a, 0x14, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2a, 0x0a, + 0x10, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, + 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, + 0x65, 0x63, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, + 0x65, 0x63, 0x75, 0x72, 0x65, 0x22, 0xb3, 0x01, 0x0a, 0x15, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, @@ -1183,70 +1208,48 @@ var file_agent_agentGrpc_agent_proto_rawDesc = []byte{ 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x74, 0x0a, 0x14, 0x52, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2a, 0x0a, 0x10, 0x6f, 0x76, 0x65, - 0x72, 0x72, 0x69, 0x64, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x10, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x45, 0x6e, 0x64, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, - 0x65, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, - 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, - 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x68, 0x61, 0x72, - 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, - 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, - 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, - 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x66, - 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, - 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, - 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, - 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, - 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, - 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5e, 0x0a, 0x0b, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x29, 0x0a, 0x08, 0x61, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, - 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x0c, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, - 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0xcc, 0x03, 0x0a, 0x05, 0x41, - 0x67, 0x65, 0x6e, 0x74, 0x12, 0x3d, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x15, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x50, - 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, - 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, - 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x50, 0x72, 0x69, 0x76, - 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, - 0x37, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x13, - 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, - 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0d, 0x52, 0x65, 0x6c, 0x65, - 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x15, 0x2e, 0x52, 0x65, 0x6c, 0x65, - 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x13, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x65, 0x61, - 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, - 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, - 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x53, - 0x68, 0x61, 0x72, 0x65, 0x12, 0x15, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x53, - 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x52, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x22, 0x00, 0x12, 0x28, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x0f, 0x0a, 0x0d, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x61, 0x0a, 0x0e, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, + 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0d, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, + 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, + 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, + 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, + 0x10, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x22, 0x1f, 0x0a, 0x0f, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x01, 0x76, 0x32, 0xe4, 0x03, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x0d, + 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x15, 0x2e, + 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x72, 0x69, + 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, + 0x0a, 0x0d, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, + 0x15, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, + 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x3d, 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, + 0x12, 0x14, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, + 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x40, 0x0a, 0x0d, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, + 0x12, 0x15, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x3d, 0x0a, 0x0c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, + 0x65, 0x12, 0x14, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, + 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x3a, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, + 0x13, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x75, 0x62, 0x6c, + 0x69, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x06, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2e, 0x0a, 0x07, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, @@ -1266,44 +1269,44 @@ func file_agent_agentGrpc_agent_proto_rawDescGZIP() []byte { var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 18) var file_agent_agentGrpc_agent_proto_goTypes = []any{ - (*AccessDetail)(nil), // 0: AccessDetail - (*PrivateAccessReply)(nil), // 1: PrivateAccessReply - (*PrivateAccessRequest)(nil), // 2: PrivateAccessRequest - (*PrivateShareReply)(nil), // 3: PrivateShareReply - (*PrivateShareRequest)(nil), // 4: PrivateShareRequest - (*PublicShareReply)(nil), // 5: PublicShareReply - (*PublicShareRequest)(nil), // 6: PublicShareRequest - (*ReleaseAccessRequest)(nil), // 7: ReleaseAccessRequest - (*ReleaseAccessReply)(nil), // 8: ReleaseAccessReply - (*ReleaseShareRequest)(nil), // 9: ReleaseShareRequest - (*ReleaseShareReply)(nil), // 10: ReleaseShareReply - (*ReservedShareReply)(nil), // 11: ReservedShareReply - (*ReservedShareRequest)(nil), // 12: ReservedShareRequest - (*ShareDetail)(nil), // 13: ShareDetail - (*StatusRequest)(nil), // 14: StatusRequest - (*StatusReply)(nil), // 15: StatusReply - (*VersionRequest)(nil), // 16: VersionRequest - (*VersionReply)(nil), // 17: VersionReply + (*AccessDetail)(nil), // 0: AccessDetail + (*AccessPrivateResponse)(nil), // 1: AccessPrivateResponse + (*AccessPrivateRequest)(nil), // 2: AccessPrivateRequest + (*ReleaseAccessRequest)(nil), // 3: ReleaseAccessRequest + (*ReleaseAccessResponse)(nil), // 4: ReleaseAccessResponse + (*ReleaseShareRequest)(nil), // 5: ReleaseShareRequest + (*ReleaseShareResponse)(nil), // 6: ReleaseShareResponse + (*ShareDetail)(nil), // 7: ShareDetail + (*SharePrivateRequest)(nil), // 8: SharePrivateRequest + (*SharePrivateResponse)(nil), // 9: SharePrivateResponse + (*SharePublicRequest)(nil), // 10: SharePublicRequest + (*SharePublicResponse)(nil), // 11: SharePublicResponse + (*ShareReservedRequest)(nil), // 12: ShareReservedRequest + (*ShareReservedResponse)(nil), // 13: ShareReservedResponse + (*StatusRequest)(nil), // 14: StatusRequest + (*StatusResponse)(nil), // 15: StatusResponse + (*VersionRequest)(nil), // 16: VersionRequest + (*VersionResponse)(nil), // 17: VersionResponse } var file_agent_agentGrpc_agent_proto_depIdxs = []int32{ - 0, // 0: StatusReply.accesses:type_name -> AccessDetail - 13, // 1: StatusReply.shares:type_name -> ShareDetail - 2, // 2: Agent.PrivateAccess:input_type -> PrivateAccessRequest - 4, // 3: Agent.PrivateShare:input_type -> PrivateShareRequest - 6, // 4: Agent.PublicShare:input_type -> PublicShareRequest - 7, // 5: Agent.ReleaseAccess:input_type -> ReleaseAccessRequest - 9, // 6: Agent.ReleaseShare:input_type -> ReleaseShareRequest - 12, // 7: Agent.ReservedShare:input_type -> ReservedShareRequest + 0, // 0: StatusResponse.accesses:type_name -> AccessDetail + 7, // 1: StatusResponse.shares:type_name -> ShareDetail + 2, // 2: Agent.AccessPrivate:input_type -> AccessPrivateRequest + 3, // 3: Agent.ReleaseAccess:input_type -> ReleaseAccessRequest + 5, // 4: Agent.ReleaseShare:input_type -> ReleaseShareRequest + 12, // 5: Agent.ShareReserved:input_type -> ShareReservedRequest + 8, // 6: Agent.SharePrivate:input_type -> SharePrivateRequest + 10, // 7: Agent.SharePublic:input_type -> SharePublicRequest 14, // 8: Agent.Status:input_type -> StatusRequest 16, // 9: Agent.Version:input_type -> VersionRequest - 1, // 10: Agent.PrivateAccess:output_type -> PrivateAccessReply - 3, // 11: Agent.PrivateShare:output_type -> PrivateShareReply - 5, // 12: Agent.PublicShare:output_type -> PublicShareReply - 8, // 13: Agent.ReleaseAccess:output_type -> ReleaseAccessReply - 10, // 14: Agent.ReleaseShare:output_type -> ReleaseShareReply - 11, // 15: Agent.ReservedShare:output_type -> ReservedShareReply - 15, // 16: Agent.Status:output_type -> StatusReply - 17, // 17: Agent.Version:output_type -> VersionReply + 1, // 10: Agent.AccessPrivate:output_type -> AccessPrivateResponse + 4, // 11: Agent.ReleaseAccess:output_type -> ReleaseAccessResponse + 6, // 12: Agent.ReleaseShare:output_type -> ReleaseShareResponse + 13, // 13: Agent.ShareReserved:output_type -> ShareReservedResponse + 9, // 14: Agent.SharePrivate:output_type -> SharePrivateResponse + 11, // 15: Agent.SharePublic:output_type -> SharePublicResponse + 15, // 16: Agent.Status:output_type -> StatusResponse + 17, // 17: Agent.Version:output_type -> VersionResponse 10, // [10:18] is the sub-list for method output_type 2, // [2:10] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name @@ -1330,7 +1333,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*PrivateAccessReply); i { + switch v := v.(*AccessPrivateResponse); i { case 0: return &v.state case 1: @@ -1342,7 +1345,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*PrivateAccessRequest); i { + switch v := v.(*AccessPrivateRequest); i { case 0: return &v.state case 1: @@ -1354,54 +1357,6 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*PrivateShareReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_agent_agentGrpc_agent_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*PrivateShareRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_agent_agentGrpc_agent_proto_msgTypes[5].Exporter = func(v any, i int) any { - switch v := v.(*PublicShareReply); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_agent_agentGrpc_agent_proto_msgTypes[6].Exporter = func(v any, i int) any { - switch v := v.(*PublicShareRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_agent_agentGrpc_agent_proto_msgTypes[7].Exporter = func(v any, i int) any { switch v := v.(*ReleaseAccessRequest); i { case 0: return &v.state @@ -1413,8 +1368,8 @@ func file_agent_agentGrpc_agent_proto_init() { return nil } } - file_agent_agentGrpc_agent_proto_msgTypes[8].Exporter = func(v any, i int) any { - switch v := v.(*ReleaseAccessReply); i { + file_agent_agentGrpc_agent_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*ReleaseAccessResponse); i { case 0: return &v.state case 1: @@ -1425,7 +1380,7 @@ func file_agent_agentGrpc_agent_proto_init() { return nil } } - file_agent_agentGrpc_agent_proto_msgTypes[9].Exporter = func(v any, i int) any { + file_agent_agentGrpc_agent_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*ReleaseShareRequest); i { case 0: return &v.state @@ -1437,8 +1392,56 @@ func file_agent_agentGrpc_agent_proto_init() { return nil } } + file_agent_agentGrpc_agent_proto_msgTypes[6].Exporter = func(v any, i int) any { + switch v := v.(*ReleaseShareResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[7].Exporter = func(v any, i int) any { + switch v := v.(*ShareDetail); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[8].Exporter = func(v any, i int) any { + switch v := v.(*SharePrivateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[9].Exporter = func(v any, i int) any { + switch v := v.(*SharePrivateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } file_agent_agentGrpc_agent_proto_msgTypes[10].Exporter = func(v any, i int) any { - switch v := v.(*ReleaseShareReply); i { + switch v := v.(*SharePublicRequest); i { case 0: return &v.state case 1: @@ -1450,7 +1453,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[11].Exporter = func(v any, i int) any { - switch v := v.(*ReservedShareReply); i { + switch v := v.(*SharePublicResponse); i { case 0: return &v.state case 1: @@ -1462,7 +1465,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[12].Exporter = func(v any, i int) any { - switch v := v.(*ReservedShareRequest); i { + switch v := v.(*ShareReservedRequest); i { case 0: return &v.state case 1: @@ -1474,7 +1477,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[13].Exporter = func(v any, i int) any { - switch v := v.(*ShareDetail); i { + switch v := v.(*ShareReservedResponse); i { case 0: return &v.state case 1: @@ -1498,7 +1501,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[15].Exporter = func(v any, i int) any { - switch v := v.(*StatusReply); i { + switch v := v.(*StatusResponse); i { case 0: return &v.state case 1: @@ -1522,7 +1525,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[17].Exporter = func(v any, i int) any { - switch v := v.(*VersionReply); i { + switch v := v.(*VersionResponse); i { case 0: return &v.state case 1: diff --git a/agent/agentGrpc/agent.proto b/agent/agentGrpc/agent.proto index cd691a11..cdc92f74 100644 --- a/agent/agentGrpc/agent.proto +++ b/agent/agentGrpc/agent.proto @@ -3,14 +3,14 @@ syntax = "proto3"; option go_package = "github.com/openziti/zrok/agent/agentGrpc"; service Agent { - rpc PrivateAccess(PrivateAccessRequest) returns (PrivateAccessReply) {} - rpc PrivateShare(PrivateShareRequest) returns (PrivateShareReply) {} - rpc PublicShare(PublicShareRequest) returns (PublicShareReply) {} - rpc ReleaseAccess(ReleaseAccessRequest) returns (ReleaseAccessReply) {} - rpc ReleaseShare(ReleaseShareRequest) returns (ReleaseShareReply) {} - rpc ReservedShare(ReservedShareRequest) returns (ReservedShareReply) {} - rpc Status(StatusRequest) returns (StatusReply) {} - rpc Version(VersionRequest) returns (VersionReply) {} + rpc AccessPrivate(AccessPrivateRequest) returns (AccessPrivateResponse) {} + rpc ReleaseAccess(ReleaseAccessRequest) returns (ReleaseAccessResponse) {} + rpc ReleaseShare(ReleaseShareRequest) returns (ReleaseShareResponse) {} + rpc ShareReserved(ShareReservedRequest) returns (ShareReservedResponse) {} + rpc SharePrivate(SharePrivateRequest) returns (SharePrivateResponse) {} + rpc SharePublic(SharePublicRequest) returns (SharePublicResponse) {} + rpc Status(StatusRequest) returns (StatusResponse) {} + rpc Version(VersionRequest) returns (VersionResponse) {} } message AccessDetail { @@ -20,72 +20,28 @@ message AccessDetail { repeated string responseHeaders = 4; } -message PrivateAccessReply{ +message AccessPrivateResponse{ string frontendToken = 1; } -message PrivateAccessRequest{ +message AccessPrivateRequest{ string token = 1; string bindAddress = 2; repeated string responseHeaders = 3; } -message PrivateShareReply { - string token = 1; -} - -message PrivateShareRequest { - string target = 1; - string backendMode = 2; - bool insecure = 3; - bool closed = 4; - repeated string accessGrants = 5; -} - -message PublicShareReply { - string token = 1; - repeated string frontendEndpoints = 2; -} - -message PublicShareRequest { - string target = 1; - repeated string basicAuth = 2; - repeated string frontendSelection = 3; - string backendMode = 4; - bool insecure = 5; - string oauthProvider = 6; - repeated string oauthEmailAddressPatterns = 7; - string oauthCheckInterval = 8; - bool closed = 9; - repeated string accessGrants = 10; -} - message ReleaseAccessRequest { string frontendToken = 1; } -message ReleaseAccessReply { +message ReleaseAccessResponse { } message ReleaseShareRequest { string token = 1; } -message ReleaseShareReply { -} - -message ReservedShareReply { - string token = 1; - string backendMode = 2; - string shareMode = 3; - repeated string frontendEndpoints = 4; - string target = 5; -} - -message ReservedShareRequest { - string token = 1; - string overrideEndpoint = 2; - bool insecure = 3; +message ReleaseShareResponse { } message ShareDetail { @@ -99,10 +55,54 @@ message ShareDetail { string status = 8; } +message SharePrivateRequest { + string target = 1; + string backendMode = 2; + bool insecure = 3; + bool closed = 4; + repeated string accessGrants = 5; +} + +message SharePrivateResponse { + string token = 1; +} + +message SharePublicRequest { + string target = 1; + repeated string basicAuth = 2; + repeated string frontendSelection = 3; + string backendMode = 4; + bool insecure = 5; + string oauthProvider = 6; + repeated string oauthEmailAddressPatterns = 7; + string oauthCheckInterval = 8; + bool closed = 9; + repeated string accessGrants = 10; +} + +message SharePublicResponse { + string token = 1; + repeated string frontendEndpoints = 2; +} + +message ShareReservedRequest { + string token = 1; + string overrideEndpoint = 2; + bool insecure = 3; +} + +message ShareReservedResponse { + string token = 1; + string backendMode = 2; + string shareMode = 3; + repeated string frontendEndpoints = 4; + string target = 5; +} + message StatusRequest { } -message StatusReply { +message StatusResponse { repeated AccessDetail accesses = 1; repeated ShareDetail shares = 2; } @@ -110,6 +110,6 @@ message StatusReply { message VersionRequest { } -message VersionReply { +message VersionResponse { string v = 1; } diff --git a/agent/agentGrpc/agent_grpc.pb.go b/agent/agentGrpc/agent_grpc.pb.go index 30db791f..cdae8495 100644 --- a/agent/agentGrpc/agent_grpc.pb.go +++ b/agent/agentGrpc/agent_grpc.pb.go @@ -19,12 +19,12 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - Agent_PrivateAccess_FullMethodName = "/Agent/PrivateAccess" - Agent_PrivateShare_FullMethodName = "/Agent/PrivateShare" - Agent_PublicShare_FullMethodName = "/Agent/PublicShare" + Agent_AccessPrivate_FullMethodName = "/Agent/AccessPrivate" Agent_ReleaseAccess_FullMethodName = "/Agent/ReleaseAccess" Agent_ReleaseShare_FullMethodName = "/Agent/ReleaseShare" - Agent_ReservedShare_FullMethodName = "/Agent/ReservedShare" + Agent_ShareReserved_FullMethodName = "/Agent/ShareReserved" + Agent_SharePrivate_FullMethodName = "/Agent/SharePrivate" + Agent_SharePublic_FullMethodName = "/Agent/SharePublic" Agent_Status_FullMethodName = "/Agent/Status" Agent_Version_FullMethodName = "/Agent/Version" ) @@ -33,14 +33,14 @@ const ( // // 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. type AgentClient interface { - PrivateAccess(ctx context.Context, in *PrivateAccessRequest, opts ...grpc.CallOption) (*PrivateAccessReply, error) - PrivateShare(ctx context.Context, in *PrivateShareRequest, opts ...grpc.CallOption) (*PrivateShareReply, error) - PublicShare(ctx context.Context, in *PublicShareRequest, opts ...grpc.CallOption) (*PublicShareReply, error) - ReleaseAccess(ctx context.Context, in *ReleaseAccessRequest, opts ...grpc.CallOption) (*ReleaseAccessReply, error) - ReleaseShare(ctx context.Context, in *ReleaseShareRequest, opts ...grpc.CallOption) (*ReleaseShareReply, error) - ReservedShare(ctx context.Context, in *ReservedShareRequest, opts ...grpc.CallOption) (*ReservedShareReply, error) - Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) - Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionReply, error) + AccessPrivate(ctx context.Context, in *AccessPrivateRequest, opts ...grpc.CallOption) (*AccessPrivateResponse, error) + ReleaseAccess(ctx context.Context, in *ReleaseAccessRequest, opts ...grpc.CallOption) (*ReleaseAccessResponse, error) + ReleaseShare(ctx context.Context, in *ReleaseShareRequest, opts ...grpc.CallOption) (*ReleaseShareResponse, error) + ShareReserved(ctx context.Context, in *ShareReservedRequest, opts ...grpc.CallOption) (*ShareReservedResponse, error) + SharePrivate(ctx context.Context, in *SharePrivateRequest, opts ...grpc.CallOption) (*SharePrivateResponse, error) + SharePublic(ctx context.Context, in *SharePublicRequest, opts ...grpc.CallOption) (*SharePublicResponse, error) + Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) + Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionResponse, error) } type agentClient struct { @@ -51,39 +51,19 @@ func NewAgentClient(cc grpc.ClientConnInterface) AgentClient { return &agentClient{cc} } -func (c *agentClient) PrivateAccess(ctx context.Context, in *PrivateAccessRequest, opts ...grpc.CallOption) (*PrivateAccessReply, error) { +func (c *agentClient) AccessPrivate(ctx context.Context, in *AccessPrivateRequest, opts ...grpc.CallOption) (*AccessPrivateResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(PrivateAccessReply) - err := c.cc.Invoke(ctx, Agent_PrivateAccess_FullMethodName, in, out, cOpts...) + out := new(AccessPrivateResponse) + err := c.cc.Invoke(ctx, Agent_AccessPrivate_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *agentClient) PrivateShare(ctx context.Context, in *PrivateShareRequest, opts ...grpc.CallOption) (*PrivateShareReply, error) { +func (c *agentClient) ReleaseAccess(ctx context.Context, in *ReleaseAccessRequest, opts ...grpc.CallOption) (*ReleaseAccessResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(PrivateShareReply) - err := c.cc.Invoke(ctx, Agent_PrivateShare_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *agentClient) PublicShare(ctx context.Context, in *PublicShareRequest, opts ...grpc.CallOption) (*PublicShareReply, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(PublicShareReply) - err := c.cc.Invoke(ctx, Agent_PublicShare_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *agentClient) ReleaseAccess(ctx context.Context, in *ReleaseAccessRequest, opts ...grpc.CallOption) (*ReleaseAccessReply, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ReleaseAccessReply) + out := new(ReleaseAccessResponse) err := c.cc.Invoke(ctx, Agent_ReleaseAccess_FullMethodName, in, out, cOpts...) if err != nil { return nil, err @@ -91,9 +71,9 @@ func (c *agentClient) ReleaseAccess(ctx context.Context, in *ReleaseAccessReques return out, nil } -func (c *agentClient) ReleaseShare(ctx context.Context, in *ReleaseShareRequest, opts ...grpc.CallOption) (*ReleaseShareReply, error) { +func (c *agentClient) ReleaseShare(ctx context.Context, in *ReleaseShareRequest, opts ...grpc.CallOption) (*ReleaseShareResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ReleaseShareReply) + out := new(ReleaseShareResponse) err := c.cc.Invoke(ctx, Agent_ReleaseShare_FullMethodName, in, out, cOpts...) if err != nil { return nil, err @@ -101,19 +81,39 @@ func (c *agentClient) ReleaseShare(ctx context.Context, in *ReleaseShareRequest, return out, nil } -func (c *agentClient) ReservedShare(ctx context.Context, in *ReservedShareRequest, opts ...grpc.CallOption) (*ReservedShareReply, error) { +func (c *agentClient) ShareReserved(ctx context.Context, in *ShareReservedRequest, opts ...grpc.CallOption) (*ShareReservedResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ReservedShareReply) - err := c.cc.Invoke(ctx, Agent_ReservedShare_FullMethodName, in, out, cOpts...) + out := new(ShareReservedResponse) + err := c.cc.Invoke(ctx, Agent_ShareReserved_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *agentClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) { +func (c *agentClient) SharePrivate(ctx context.Context, in *SharePrivateRequest, opts ...grpc.CallOption) (*SharePrivateResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(StatusReply) + out := new(SharePrivateResponse) + err := c.cc.Invoke(ctx, Agent_SharePrivate_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *agentClient) SharePublic(ctx context.Context, in *SharePublicRequest, opts ...grpc.CallOption) (*SharePublicResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SharePublicResponse) + err := c.cc.Invoke(ctx, Agent_SharePublic_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *agentClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(StatusResponse) err := c.cc.Invoke(ctx, Agent_Status_FullMethodName, in, out, cOpts...) if err != nil { return nil, err @@ -121,9 +121,9 @@ func (c *agentClient) Status(ctx context.Context, in *StatusRequest, opts ...grp return out, nil } -func (c *agentClient) Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionReply, error) { +func (c *agentClient) Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(VersionReply) + out := new(VersionResponse) err := c.cc.Invoke(ctx, Agent_Version_FullMethodName, in, out, cOpts...) if err != nil { return nil, err @@ -135,14 +135,14 @@ func (c *agentClient) Version(ctx context.Context, in *VersionRequest, opts ...g // All implementations must embed UnimplementedAgentServer // for forward compatibility. type AgentServer interface { - PrivateAccess(context.Context, *PrivateAccessRequest) (*PrivateAccessReply, error) - PrivateShare(context.Context, *PrivateShareRequest) (*PrivateShareReply, error) - PublicShare(context.Context, *PublicShareRequest) (*PublicShareReply, error) - ReleaseAccess(context.Context, *ReleaseAccessRequest) (*ReleaseAccessReply, error) - ReleaseShare(context.Context, *ReleaseShareRequest) (*ReleaseShareReply, error) - ReservedShare(context.Context, *ReservedShareRequest) (*ReservedShareReply, error) - Status(context.Context, *StatusRequest) (*StatusReply, error) - Version(context.Context, *VersionRequest) (*VersionReply, error) + AccessPrivate(context.Context, *AccessPrivateRequest) (*AccessPrivateResponse, error) + ReleaseAccess(context.Context, *ReleaseAccessRequest) (*ReleaseAccessResponse, error) + ReleaseShare(context.Context, *ReleaseShareRequest) (*ReleaseShareResponse, error) + ShareReserved(context.Context, *ShareReservedRequest) (*ShareReservedResponse, error) + SharePrivate(context.Context, *SharePrivateRequest) (*SharePrivateResponse, error) + SharePublic(context.Context, *SharePublicRequest) (*SharePublicResponse, error) + Status(context.Context, *StatusRequest) (*StatusResponse, error) + Version(context.Context, *VersionRequest) (*VersionResponse, error) mustEmbedUnimplementedAgentServer() } @@ -153,28 +153,28 @@ type AgentServer interface { // pointer dereference when methods are called. type UnimplementedAgentServer struct{} -func (UnimplementedAgentServer) PrivateAccess(context.Context, *PrivateAccessRequest) (*PrivateAccessReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method PrivateAccess not implemented") +func (UnimplementedAgentServer) AccessPrivate(context.Context, *AccessPrivateRequest) (*AccessPrivateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AccessPrivate not implemented") } -func (UnimplementedAgentServer) PrivateShare(context.Context, *PrivateShareRequest) (*PrivateShareReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method PrivateShare not implemented") -} -func (UnimplementedAgentServer) PublicShare(context.Context, *PublicShareRequest) (*PublicShareReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method PublicShare not implemented") -} -func (UnimplementedAgentServer) ReleaseAccess(context.Context, *ReleaseAccessRequest) (*ReleaseAccessReply, error) { +func (UnimplementedAgentServer) ReleaseAccess(context.Context, *ReleaseAccessRequest) (*ReleaseAccessResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ReleaseAccess not implemented") } -func (UnimplementedAgentServer) ReleaseShare(context.Context, *ReleaseShareRequest) (*ReleaseShareReply, error) { +func (UnimplementedAgentServer) ReleaseShare(context.Context, *ReleaseShareRequest) (*ReleaseShareResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ReleaseShare not implemented") } -func (UnimplementedAgentServer) ReservedShare(context.Context, *ReservedShareRequest) (*ReservedShareReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReservedShare not implemented") +func (UnimplementedAgentServer) ShareReserved(context.Context, *ShareReservedRequest) (*ShareReservedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ShareReserved not implemented") } -func (UnimplementedAgentServer) Status(context.Context, *StatusRequest) (*StatusReply, error) { +func (UnimplementedAgentServer) SharePrivate(context.Context, *SharePrivateRequest) (*SharePrivateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SharePrivate not implemented") +} +func (UnimplementedAgentServer) SharePublic(context.Context, *SharePublicRequest) (*SharePublicResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SharePublic not implemented") +} +func (UnimplementedAgentServer) Status(context.Context, *StatusRequest) (*StatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") } -func (UnimplementedAgentServer) Version(context.Context, *VersionRequest) (*VersionReply, error) { +func (UnimplementedAgentServer) Version(context.Context, *VersionRequest) (*VersionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Version not implemented") } func (UnimplementedAgentServer) mustEmbedUnimplementedAgentServer() {} @@ -198,56 +198,20 @@ func RegisterAgentServer(s grpc.ServiceRegistrar, srv AgentServer) { s.RegisterService(&Agent_ServiceDesc, srv) } -func _Agent_PrivateAccess_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PrivateAccessRequest) +func _Agent_AccessPrivate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AccessPrivateRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(AgentServer).PrivateAccess(ctx, in) + return srv.(AgentServer).AccessPrivate(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Agent_PrivateAccess_FullMethodName, + FullMethod: Agent_AccessPrivate_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AgentServer).PrivateAccess(ctx, req.(*PrivateAccessRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Agent_PrivateShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PrivateShareRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AgentServer).PrivateShare(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Agent_PrivateShare_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AgentServer).PrivateShare(ctx, req.(*PrivateShareRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Agent_PublicShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PublicShareRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AgentServer).PublicShare(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Agent_PublicShare_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AgentServer).PublicShare(ctx, req.(*PublicShareRequest)) + return srv.(AgentServer).AccessPrivate(ctx, req.(*AccessPrivateRequest)) } return interceptor(ctx, in, info, handler) } @@ -288,20 +252,56 @@ func _Agent_ReleaseShare_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } -func _Agent_ReservedShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReservedShareRequest) +func _Agent_ShareReserved_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ShareReservedRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(AgentServer).ReservedShare(ctx, in) + return srv.(AgentServer).ShareReserved(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Agent_ReservedShare_FullMethodName, + FullMethod: Agent_ShareReserved_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AgentServer).ReservedShare(ctx, req.(*ReservedShareRequest)) + return srv.(AgentServer).ShareReserved(ctx, req.(*ShareReservedRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Agent_SharePrivate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SharePrivateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AgentServer).SharePrivate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Agent_SharePrivate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AgentServer).SharePrivate(ctx, req.(*SharePrivateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Agent_SharePublic_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SharePublicRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AgentServer).SharePublic(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Agent_SharePublic_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AgentServer).SharePublic(ctx, req.(*SharePublicRequest)) } return interceptor(ctx, in, info, handler) } @@ -350,16 +350,8 @@ var Agent_ServiceDesc = grpc.ServiceDesc{ HandlerType: (*AgentServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "PrivateAccess", - Handler: _Agent_PrivateAccess_Handler, - }, - { - MethodName: "PrivateShare", - Handler: _Agent_PrivateShare_Handler, - }, - { - MethodName: "PublicShare", - Handler: _Agent_PublicShare_Handler, + MethodName: "AccessPrivate", + Handler: _Agent_AccessPrivate_Handler, }, { MethodName: "ReleaseAccess", @@ -370,8 +362,16 @@ var Agent_ServiceDesc = grpc.ServiceDesc{ Handler: _Agent_ReleaseShare_Handler, }, { - MethodName: "ReservedShare", - Handler: _Agent_ReservedShare_Handler, + MethodName: "ShareReserved", + Handler: _Agent_ShareReserved_Handler, + }, + { + MethodName: "SharePrivate", + Handler: _Agent_SharePrivate_Handler, + }, + { + MethodName: "SharePublic", + Handler: _Agent_SharePublic_Handler, }, { MethodName: "Status", diff --git a/agent/releaseAccess.go b/agent/releaseAccess.go index 1defd165..5318b282 100644 --- a/agent/releaseAccess.go +++ b/agent/releaseAccess.go @@ -8,7 +8,7 @@ import ( "github.com/sirupsen/logrus" ) -func (i *agentGrpcImpl) ReleaseAccess(_ context.Context, req *agentGrpc.ReleaseAccessRequest) (*agentGrpc.ReleaseAccessReply, error) { +func (i *agentGrpcImpl) ReleaseAccess(_ context.Context, req *agentGrpc.ReleaseAccessRequest) (*agentGrpc.ReleaseAccessResponse, error) { if acc, found := i.a.accesses[req.FrontendToken]; found { logrus.Infof("stopping access '%v'", acc.frontendToken) diff --git a/agent/releaseShare.go b/agent/releaseShare.go index 7dcd1d49..5db67811 100755 --- a/agent/releaseShare.go +++ b/agent/releaseShare.go @@ -8,7 +8,7 @@ import ( "github.com/sirupsen/logrus" ) -func (i *agentGrpcImpl) ReleaseShare(_ context.Context, req *agentGrpc.ReleaseShareRequest) (*agentGrpc.ReleaseShareReply, error) { +func (i *agentGrpcImpl) ReleaseShare(_ context.Context, req *agentGrpc.ReleaseShareRequest) (*agentGrpc.ReleaseShareResponse, error) { if shr, found := i.a.shares[req.Token]; found { logrus.Infof("stopping share '%v'", shr.token) diff --git a/agent/privateShare.go b/agent/sharePrivate.go similarity index 86% rename from agent/privateShare.go rename to agent/sharePrivate.go index b04a5351..5cca4d1c 100644 --- a/agent/privateShare.go +++ b/agent/sharePrivate.go @@ -11,7 +11,7 @@ import ( "os" ) -func (i *agentGrpcImpl) PrivateShare(_ context.Context, req *agentGrpc.PrivateShareRequest) (*agentGrpc.PrivateShareReply, error) { +func (i *agentGrpcImpl) SharePrivate(_ context.Context, req *agentGrpc.SharePrivateRequest) (*agentGrpc.SharePrivateResponse, error) { root, err := environment.LoadRoot() if err != nil { return nil, err @@ -59,7 +59,7 @@ func (i *agentGrpcImpl) PrivateShare(_ context.Context, req *agentGrpc.PrivateSh if shr.bootErr == nil { i.a.inShares <- shr - return &agentGrpc.PrivateShareReply{Token: shr.token}, nil + return &agentGrpc.SharePrivateResponse{Token: shr.token}, nil } return nil, shr.bootErr diff --git a/agent/publicShare.go b/agent/sharePublic.go similarity index 92% rename from agent/publicShare.go rename to agent/sharePublic.go index f72325dc..6e48c114 100644 --- a/agent/publicShare.go +++ b/agent/sharePublic.go @@ -11,7 +11,7 @@ import ( "os" ) -func (i *agentGrpcImpl) PublicShare(_ context.Context, req *agentGrpc.PublicShareRequest) (*agentGrpc.PublicShareReply, error) { +func (i *agentGrpcImpl) SharePublic(_ context.Context, req *agentGrpc.SharePublicRequest) (*agentGrpc.SharePublicResponse, error) { root, err := environment.LoadRoot() if err != nil { return nil, err @@ -83,7 +83,7 @@ func (i *agentGrpcImpl) PublicShare(_ context.Context, req *agentGrpc.PublicShar if shr.bootErr == nil { i.a.inShares <- shr - return &agentGrpc.PublicShareReply{ + return &agentGrpc.SharePublicResponse{ Token: shr.token, FrontendEndpoints: shr.frontendEndpoints, }, nil diff --git a/agent/reservedShare.go b/agent/shareReserved.go similarity index 87% rename from agent/reservedShare.go rename to agent/shareReserved.go index df13c9b1..def2d04d 100644 --- a/agent/reservedShare.go +++ b/agent/shareReserved.go @@ -9,7 +9,7 @@ import ( "os" ) -func (i *agentGrpcImpl) ReservedShare(_ context.Context, req *agentGrpc.ReservedShareRequest) (*agentGrpc.ReservedShareReply, error) { +func (i *agentGrpcImpl) ShareReserved(_ context.Context, req *agentGrpc.ShareReservedRequest) (*agentGrpc.ShareReservedResponse, error) { root, err := environment.LoadRoot() if err != nil { return nil, err @@ -48,7 +48,7 @@ func (i *agentGrpcImpl) ReservedShare(_ context.Context, req *agentGrpc.Reserved if shr.bootErr == nil { i.a.inShares <- shr - return &agentGrpc.ReservedShareReply{ + return &agentGrpc.ShareReservedResponse{ Token: shr.token, BackendMode: string(shr.backendMode), ShareMode: string(shr.shareMode), diff --git a/agent/status.go b/agent/status.go index 9ce0d55a..f738a361 100644 --- a/agent/status.go +++ b/agent/status.go @@ -5,7 +5,7 @@ import ( "github.com/openziti/zrok/agent/agentGrpc" ) -func (i *agentGrpcImpl) Status(_ context.Context, _ *agentGrpc.StatusRequest) (*agentGrpc.StatusReply, error) { +func (i *agentGrpcImpl) Status(_ context.Context, _ *agentGrpc.StatusRequest) (*agentGrpc.StatusResponse, error) { var accesses []*agentGrpc.AccessDetail for feToken, acc := range i.a.accesses { accesses = append(accesses, &agentGrpc.AccessDetail{ @@ -29,5 +29,5 @@ func (i *agentGrpcImpl) Status(_ context.Context, _ *agentGrpc.StatusRequest) (* }) } - return &agentGrpc.StatusReply{Accesses: accesses, Shares: shares}, nil + return &agentGrpc.StatusResponse{Accesses: accesses, Shares: shares}, nil } diff --git a/agent/version.go b/agent/version.go index 02788c24..cdb45974 100644 --- a/agent/version.go +++ b/agent/version.go @@ -7,8 +7,8 @@ import ( "github.com/sirupsen/logrus" ) -func (i *agentGrpcImpl) Version(_ context.Context, _ *agentGrpc.VersionRequest) (*agentGrpc.VersionReply, error) { +func (i *agentGrpcImpl) Version(_ context.Context, _ *agentGrpc.VersionRequest) (*agentGrpc.VersionResponse, error) { v := build.String() logrus.Infof("responding to version inquiry with '%v'", v) - return &agentGrpc.VersionReply{V: v}, nil + return &agentGrpc.VersionResponse{V: v}, nil } diff --git a/cmd/zrok/agentAccessPrivate.go b/cmd/zrok/agentAccessPrivate.go index d3517ccc..72b575a9 100644 --- a/cmd/zrok/agentAccessPrivate.go +++ b/cmd/zrok/agentAccessPrivate.go @@ -52,7 +52,7 @@ func (cmd *agentAccessPrivateCommand) run(_ *cobra.Command, args []string) { } defer conn.Close() - acc, err := client.PrivateAccess(context.Background(), &agentGrpc.PrivateAccessRequest{ + acc, err := client.AccessPrivate(context.Background(), &agentGrpc.AccessPrivateRequest{ Token: args[0], BindAddress: cmd.bindAddress, ResponseHeaders: cmd.responseHeaders, diff --git a/cmd/zrok/agentSharePrivate.go b/cmd/zrok/agentSharePrivate.go index eae79dea..a85263f5 100644 --- a/cmd/zrok/agentSharePrivate.go +++ b/cmd/zrok/agentSharePrivate.go @@ -147,7 +147,7 @@ func (cmd *agentSharePrivateCommand) run(_ *cobra.Command, args []string) { } defer conn.Close() - shr, err := client.PrivateShare(context.Background(), &agentGrpc.PrivateShareRequest{ + shr, err := client.SharePrivate(context.Background(), &agentGrpc.SharePrivateRequest{ Target: target, BackendMode: cmd.backendMode, Insecure: cmd.insecure, diff --git a/cmd/zrok/agentSharePublic.go b/cmd/zrok/agentSharePublic.go index 2d91774c..9f69da1c 100644 --- a/cmd/zrok/agentSharePublic.go +++ b/cmd/zrok/agentSharePublic.go @@ -124,7 +124,7 @@ func (cmd *agentSharePublicCommand) run(_ *cobra.Command, args []string) { } defer conn.Close() - shr, err := client.PublicShare(context.Background(), &agentGrpc.PublicShareRequest{ + shr, err := client.SharePublic(context.Background(), &agentGrpc.SharePublicRequest{ Target: target, BasicAuth: cmd.basicAuth, FrontendSelection: cmd.frontendSelection, diff --git a/cmd/zrok/agentShareReserved.go b/cmd/zrok/agentShareReserved.go index c4276c56..afcecd12 100644 --- a/cmd/zrok/agentShareReserved.go +++ b/cmd/zrok/agentShareReserved.go @@ -52,7 +52,7 @@ func (cmd *agentShareReservedCommand) run(_ *cobra.Command, args []string) { } defer conn.Close() - shr, err := client.ReservedShare(context.Background(), &agentGrpc.ReservedShareRequest{ + shr, err := client.ShareReserved(context.Background(), &agentGrpc.ShareReservedRequest{ Token: args[0], OverrideEndpoint: cmd.overrideEndpoint, Insecure: cmd.insecure, From d6a07b1d613791085e9a95e927b0c072d52422b7 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Wed, 18 Sep 2024 12:10:57 -0400 Subject: [PATCH 51/51] changelog (#463) --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bdce62f..b8ac1fa2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ MAJOR RELEASE: zrok reaches version 1.0.0! +FEATURE: New "zrok Agent", a background manager process for your zrok environments, which allows you to easily manage and work with multiple `zrok share` and `zrok access` processes (https://github.com/openziti/zrok/issues/463) + ## v0.4.41 FIX: Fixed crash when invoking `zrok share reserved` with no arguments (https://github.com/openziti/zrok/issues/740)