diff --git a/pkg/dnsconfigs/ns_key_algorithms.go b/pkg/dnsconfigs/ns_key_algorithms.go new file mode 100644 index 0000000..3f37f6f --- /dev/null +++ b/pkg/dnsconfigs/ns_key_algorithms.go @@ -0,0 +1,69 @@ +// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved. + +package dnsconfigs + +type KeyAlgorithmType = string + +const ( + KeyAlgorithmTypeHmacSHA1 KeyAlgorithmType = "hmac-sha1." + KeyAlgorithmTypeHmacSHA224 KeyAlgorithmType = "hmac-sha224." + KeyAlgorithmTypeHmacSHA256 KeyAlgorithmType = "hmac-sha256." + KeyAlgorithmTypeHmacSHA384 KeyAlgorithmType = "hmac-sha384." + KeyAlgorithmTypeHmacSHA512 KeyAlgorithmType = "hmac-sha512." +) + +type KeyAlgorithmDefinition struct { + Name string `json:"name"` + Code string `json:"code"` +} + +func FindAllKeyAlgorithmTypes() []*KeyAlgorithmDefinition { + return []*KeyAlgorithmDefinition{ + { + Name: "HmacSHA1", + Code: KeyAlgorithmTypeHmacSHA1, + }, + { + Name: "HmacSHA224", + Code: KeyAlgorithmTypeHmacSHA224, + }, + { + Name: "HmacSHA256", + Code: KeyAlgorithmTypeHmacSHA256, + }, + { + Name: "HmacSHA384", + Code: KeyAlgorithmTypeHmacSHA384, + }, + { + Name: "HmacSHA512", + Code: KeyAlgorithmTypeHmacSHA512, + }, + } +} + +func FindKeyAlgorithmTypeName(algoType KeyAlgorithmType) string { + for _, def := range FindAllKeyAlgorithmTypes() { + if def.Code == algoType { + return def.Name + } + } + return "" +} + +type NSKeySecretType = string + +const ( + NSKeySecretTypeClear NSKeySecretType = "clear" + NSKeySecretTypeBase64 NSKeySecretType = "base64" +) + +func FindKeySecretTypeName(secretType NSKeySecretType) string { + switch secretType { + case NSKeySecretTypeClear: + return "明文" + case NSKeySecretTypeBase64: + return "BASE64" + } + return "" +} diff --git a/pkg/dnsconfigs/ns_node_config.go b/pkg/dnsconfigs/ns_node_config.go index 5c27df2..d518175 100644 --- a/pkg/dnsconfigs/ns_node_config.go +++ b/pkg/dnsconfigs/ns_node_config.go @@ -5,9 +5,10 @@ package dnsconfigs import "fmt" type NSNodeConfig struct { - Id int64 `json:"id"` - ClusterId int64 `json:"clusterId"` - AccessLogRef *AccessLogRef `json:"accessLogRef"` + Id int64 `yaml:"id" json:"id"` + NodeId string `yaml:"nodeId" json:"nodeId"` + ClusterId int64 `yaml:"clusterId" json:"clusterId"` + AccessLogRef *AccessLogRef `yaml:"accessLogRef" json:"accessLogRef"` paddedId string } diff --git a/pkg/rpc/pb/model_ns_key.pb.go b/pkg/rpc/pb/model_ns_key.pb.go new file mode 100644 index 0000000..68e321b --- /dev/null +++ b/pkg/rpc/pb/model_ns_key.pb.go @@ -0,0 +1,194 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: models/model_ns_key.proto + +package pb + +import ( + proto "github.com/golang/protobuf/proto" + 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) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// NS密钥 +type NSKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + IsOn bool `protobuf:"varint,2,opt,name=isOn,proto3" json:"isOn,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Algo string `protobuf:"bytes,4,opt,name=algo,proto3" json:"algo,omitempty"` + Secret string `protobuf:"bytes,5,opt,name=secret,proto3" json:"secret,omitempty"` + SecretType string `protobuf:"bytes,6,opt,name=secretType,proto3" json:"secretType,omitempty"` +} + +func (x *NSKey) Reset() { + *x = NSKey{} + if protoimpl.UnsafeEnabled { + mi := &file_models_model_ns_key_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NSKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NSKey) ProtoMessage() {} + +func (x *NSKey) ProtoReflect() protoreflect.Message { + mi := &file_models_model_ns_key_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 NSKey.ProtoReflect.Descriptor instead. +func (*NSKey) Descriptor() ([]byte, []int) { + return file_models_model_ns_key_proto_rawDescGZIP(), []int{0} +} + +func (x *NSKey) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *NSKey) GetIsOn() bool { + if x != nil { + return x.IsOn + } + return false +} + +func (x *NSKey) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *NSKey) GetAlgo() string { + if x != nil { + return x.Algo + } + return "" +} + +func (x *NSKey) GetSecret() string { + if x != nil { + return x.Secret + } + return "" +} + +func (x *NSKey) GetSecretType() string { + if x != nil { + return x.SecretType + } + return "" +} + +var File_models_model_ns_key_proto protoreflect.FileDescriptor + +var file_models_model_ns_key_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, + 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, + 0x8b, 0x01, 0x0a, 0x05, 0x4e, 0x53, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x6c, 0x67, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x61, 0x6c, 0x67, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x1e, 0x0a, + 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x42, 0x06, 0x5a, + 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_models_model_ns_key_proto_rawDescOnce sync.Once + file_models_model_ns_key_proto_rawDescData = file_models_model_ns_key_proto_rawDesc +) + +func file_models_model_ns_key_proto_rawDescGZIP() []byte { + file_models_model_ns_key_proto_rawDescOnce.Do(func() { + file_models_model_ns_key_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_model_ns_key_proto_rawDescData) + }) + return file_models_model_ns_key_proto_rawDescData +} + +var file_models_model_ns_key_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_models_model_ns_key_proto_goTypes = []interface{}{ + (*NSKey)(nil), // 0: pb.NSKey +} +var file_models_model_ns_key_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] 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_models_model_ns_key_proto_init() } +func file_models_model_ns_key_proto_init() { + if File_models_model_ns_key_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_models_model_ns_key_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NSKey); 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_models_model_ns_key_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_models_model_ns_key_proto_goTypes, + DependencyIndexes: file_models_model_ns_key_proto_depIdxs, + MessageInfos: file_models_model_ns_key_proto_msgTypes, + }.Build() + File_models_model_ns_key_proto = out.File + file_models_model_ns_key_proto_rawDesc = nil + file_models_model_ns_key_proto_goTypes = nil + file_models_model_ns_key_proto_depIdxs = nil +} diff --git a/pkg/rpc/pb/service_ns_key.pb.go b/pkg/rpc/pb/service_ns_key.pb.go new file mode 100644 index 0000000..44ad4f2 --- /dev/null +++ b/pkg/rpc/pb/service_ns_key.pb.go @@ -0,0 +1,1120 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: service_ns_key.proto + +package pb + +import ( + context "context" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// 创建密钥 +type CreateNSKeyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsDomainId int64 `protobuf:"varint,1,opt,name=nsDomainId,proto3" json:"nsDomainId,omitempty"` + NsZoneId int64 `protobuf:"varint,2,opt,name=nsZoneId,proto3" json:"nsZoneId,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Algo string `protobuf:"bytes,4,opt,name=algo,proto3" json:"algo,omitempty"` + Secret string `protobuf:"bytes,5,opt,name=secret,proto3" json:"secret,omitempty"` + SecretType string `protobuf:"bytes,6,opt,name=secretType,proto3" json:"secretType,omitempty"` +} + +func (x *CreateNSKeyRequest) Reset() { + *x = CreateNSKeyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_key_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateNSKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateNSKeyRequest) ProtoMessage() {} + +func (x *CreateNSKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_key_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 CreateNSKeyRequest.ProtoReflect.Descriptor instead. +func (*CreateNSKeyRequest) Descriptor() ([]byte, []int) { + return file_service_ns_key_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateNSKeyRequest) GetNsDomainId() int64 { + if x != nil { + return x.NsDomainId + } + return 0 +} + +func (x *CreateNSKeyRequest) GetNsZoneId() int64 { + if x != nil { + return x.NsZoneId + } + return 0 +} + +func (x *CreateNSKeyRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateNSKeyRequest) GetAlgo() string { + if x != nil { + return x.Algo + } + return "" +} + +func (x *CreateNSKeyRequest) GetSecret() string { + if x != nil { + return x.Secret + } + return "" +} + +func (x *CreateNSKeyRequest) GetSecretType() string { + if x != nil { + return x.SecretType + } + return "" +} + +type CreateNSKeyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsKeyId int64 `protobuf:"varint,1,opt,name=nsKeyId,proto3" json:"nsKeyId,omitempty"` +} + +func (x *CreateNSKeyResponse) Reset() { + *x = CreateNSKeyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_key_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateNSKeyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateNSKeyResponse) ProtoMessage() {} + +func (x *CreateNSKeyResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_key_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 CreateNSKeyResponse.ProtoReflect.Descriptor instead. +func (*CreateNSKeyResponse) Descriptor() ([]byte, []int) { + return file_service_ns_key_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateNSKeyResponse) GetNsKeyId() int64 { + if x != nil { + return x.NsKeyId + } + return 0 +} + +// 修改密钥 +type UpdateNSKeyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsKeyId int64 `protobuf:"varint,1,opt,name=nsKeyId,proto3" json:"nsKeyId,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Algo string `protobuf:"bytes,3,opt,name=algo,proto3" json:"algo,omitempty"` + Secret string `protobuf:"bytes,4,opt,name=secret,proto3" json:"secret,omitempty"` + SecretType string `protobuf:"bytes,5,opt,name=secretType,proto3" json:"secretType,omitempty"` + IsOn bool `protobuf:"varint,6,opt,name=isOn,proto3" json:"isOn,omitempty"` +} + +func (x *UpdateNSKeyRequest) Reset() { + *x = UpdateNSKeyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_key_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateNSKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateNSKeyRequest) ProtoMessage() {} + +func (x *UpdateNSKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_key_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 UpdateNSKeyRequest.ProtoReflect.Descriptor instead. +func (*UpdateNSKeyRequest) Descriptor() ([]byte, []int) { + return file_service_ns_key_proto_rawDescGZIP(), []int{2} +} + +func (x *UpdateNSKeyRequest) GetNsKeyId() int64 { + if x != nil { + return x.NsKeyId + } + return 0 +} + +func (x *UpdateNSKeyRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdateNSKeyRequest) GetAlgo() string { + if x != nil { + return x.Algo + } + return "" +} + +func (x *UpdateNSKeyRequest) GetSecret() string { + if x != nil { + return x.Secret + } + return "" +} + +func (x *UpdateNSKeyRequest) GetSecretType() string { + if x != nil { + return x.SecretType + } + return "" +} + +func (x *UpdateNSKeyRequest) GetIsOn() bool { + if x != nil { + return x.IsOn + } + return false +} + +// 删除密钥 +type DeleteNSKeyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsKeyId int64 `protobuf:"varint,1,opt,name=nsKeyId,proto3" json:"nsKeyId,omitempty"` +} + +func (x *DeleteNSKeyRequest) Reset() { + *x = DeleteNSKeyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_key_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteNSKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteNSKeyRequest) ProtoMessage() {} + +func (x *DeleteNSKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_key_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 DeleteNSKeyRequest.ProtoReflect.Descriptor instead. +func (*DeleteNSKeyRequest) Descriptor() ([]byte, []int) { + return file_service_ns_key_proto_rawDescGZIP(), []int{3} +} + +func (x *DeleteNSKeyRequest) GetNsKeyId() int64 { + if x != nil { + return x.NsKeyId + } + return 0 +} + +// 查找单个密钥 +type FindEnabledNSKeyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsKeyId int64 `protobuf:"varint,1,opt,name=nsKeyId,proto3" json:"nsKeyId,omitempty"` +} + +func (x *FindEnabledNSKeyRequest) Reset() { + *x = FindEnabledNSKeyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_key_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindEnabledNSKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindEnabledNSKeyRequest) ProtoMessage() {} + +func (x *FindEnabledNSKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_key_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 FindEnabledNSKeyRequest.ProtoReflect.Descriptor instead. +func (*FindEnabledNSKeyRequest) Descriptor() ([]byte, []int) { + return file_service_ns_key_proto_rawDescGZIP(), []int{4} +} + +func (x *FindEnabledNSKeyRequest) GetNsKeyId() int64 { + if x != nil { + return x.NsKeyId + } + return 0 +} + +type FindEnabledNSKeyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsKey *NSKey `protobuf:"bytes,1,opt,name=nsKey,proto3" json:"nsKey,omitempty"` +} + +func (x *FindEnabledNSKeyResponse) Reset() { + *x = FindEnabledNSKeyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_key_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindEnabledNSKeyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindEnabledNSKeyResponse) ProtoMessage() {} + +func (x *FindEnabledNSKeyResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_key_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 FindEnabledNSKeyResponse.ProtoReflect.Descriptor instead. +func (*FindEnabledNSKeyResponse) Descriptor() ([]byte, []int) { + return file_service_ns_key_proto_rawDescGZIP(), []int{5} +} + +func (x *FindEnabledNSKeyResponse) GetNsKey() *NSKey { + if x != nil { + return x.NsKey + } + return nil +} + +// 计算密钥数量 +type CountAllEnabledNSKeysRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsDomainId int64 `protobuf:"varint,1,opt,name=nsDomainId,proto3" json:"nsDomainId,omitempty"` + NsZoneId int64 `protobuf:"varint,2,opt,name=nsZoneId,proto3" json:"nsZoneId,omitempty"` +} + +func (x *CountAllEnabledNSKeysRequest) Reset() { + *x = CountAllEnabledNSKeysRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_key_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CountAllEnabledNSKeysRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountAllEnabledNSKeysRequest) ProtoMessage() {} + +func (x *CountAllEnabledNSKeysRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_key_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 CountAllEnabledNSKeysRequest.ProtoReflect.Descriptor instead. +func (*CountAllEnabledNSKeysRequest) Descriptor() ([]byte, []int) { + return file_service_ns_key_proto_rawDescGZIP(), []int{6} +} + +func (x *CountAllEnabledNSKeysRequest) GetNsDomainId() int64 { + if x != nil { + return x.NsDomainId + } + return 0 +} + +func (x *CountAllEnabledNSKeysRequest) GetNsZoneId() int64 { + if x != nil { + return x.NsZoneId + } + return 0 +} + +// 列出单页密钥 +type ListEnabledNSKeysRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsDomainId int64 `protobuf:"varint,1,opt,name=nsDomainId,proto3" json:"nsDomainId,omitempty"` + NsZoneId int64 `protobuf:"varint,2,opt,name=nsZoneId,proto3" json:"nsZoneId,omitempty"` + Offset int64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"` + Size int64 `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"` +} + +func (x *ListEnabledNSKeysRequest) Reset() { + *x = ListEnabledNSKeysRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_key_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListEnabledNSKeysRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListEnabledNSKeysRequest) ProtoMessage() {} + +func (x *ListEnabledNSKeysRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_key_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 ListEnabledNSKeysRequest.ProtoReflect.Descriptor instead. +func (*ListEnabledNSKeysRequest) Descriptor() ([]byte, []int) { + return file_service_ns_key_proto_rawDescGZIP(), []int{7} +} + +func (x *ListEnabledNSKeysRequest) GetNsDomainId() int64 { + if x != nil { + return x.NsDomainId + } + return 0 +} + +func (x *ListEnabledNSKeysRequest) GetNsZoneId() int64 { + if x != nil { + return x.NsZoneId + } + return 0 +} + +func (x *ListEnabledNSKeysRequest) GetOffset() int64 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *ListEnabledNSKeysRequest) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +type ListEnabledNSKeysResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsKeys []*NSKey `protobuf:"bytes,1,rep,name=nsKeys,proto3" json:"nsKeys,omitempty"` +} + +func (x *ListEnabledNSKeysResponse) Reset() { + *x = ListEnabledNSKeysResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_key_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListEnabledNSKeysResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListEnabledNSKeysResponse) ProtoMessage() {} + +func (x *ListEnabledNSKeysResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_key_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 ListEnabledNSKeysResponse.ProtoReflect.Descriptor instead. +func (*ListEnabledNSKeysResponse) Descriptor() ([]byte, []int) { + return file_service_ns_key_proto_rawDescGZIP(), []int{8} +} + +func (x *ListEnabledNSKeysResponse) GetNsKeys() []*NSKey { + if x != nil { + return x.NsKeys + } + return nil +} + +var File_service_ns_key_proto protoreflect.FileDescriptor + +var file_service_ns_key_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x73, 0x5f, 0x6b, 0x65, 0x79, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x19, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0xb0, 0x01, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x53, 0x4b, 0x65, 0x79, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x73, 0x44, 0x6f, 0x6d, + 0x61, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6e, 0x73, 0x44, + 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x73, 0x5a, 0x6f, 0x6e, + 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6e, 0x73, 0x5a, 0x6f, 0x6e, + 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x6c, 0x67, 0x6f, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x6c, 0x67, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x73, + 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x63, + 0x72, 0x65, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x54, + 0x79, 0x70, 0x65, 0x22, 0x2f, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x53, 0x4b, + 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x73, + 0x4b, 0x65, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6e, 0x73, 0x4b, + 0x65, 0x79, 0x49, 0x64, 0x22, 0xa2, 0x01, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, + 0x53, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6e, + 0x73, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6e, 0x73, + 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x6c, 0x67, + 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x6c, 0x67, 0x6f, 0x12, 0x16, 0x0a, + 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, + 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x54, + 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, + 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x22, 0x2e, 0x0a, 0x12, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x4e, 0x53, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x18, 0x0a, 0x07, 0x6e, 0x73, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x07, 0x6e, 0x73, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x22, 0x33, 0x0a, 0x17, 0x46, 0x69, 0x6e, + 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x73, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6e, 0x73, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x22, 0x3b, + 0x0a, 0x18, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, 0x4b, + 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x05, 0x6e, 0x73, + 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x4e, + 0x53, 0x4b, 0x65, 0x79, 0x52, 0x05, 0x6e, 0x73, 0x4b, 0x65, 0x79, 0x22, 0x5a, 0x0a, 0x1c, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, + 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, + 0x73, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x0a, 0x6e, 0x73, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6e, + 0x73, 0x5a, 0x6f, 0x6e, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6e, + 0x73, 0x5a, 0x6f, 0x6e, 0x65, 0x49, 0x64, 0x22, 0x82, 0x01, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, + 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x73, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6e, 0x73, 0x44, 0x6f, 0x6d, 0x61, + 0x69, 0x6e, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x73, 0x5a, 0x6f, 0x6e, 0x65, 0x49, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6e, 0x73, 0x5a, 0x6f, 0x6e, 0x65, 0x49, 0x64, + 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x3e, 0x0a, 0x19, + 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, 0x4b, 0x65, 0x79, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x06, 0x6e, 0x73, 0x4b, + 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x70, 0x62, 0x2e, 0x4e, + 0x53, 0x4b, 0x65, 0x79, 0x52, 0x06, 0x6e, 0x73, 0x4b, 0x65, 0x79, 0x73, 0x32, 0xae, 0x03, 0x0a, + 0x0c, 0x4e, 0x53, 0x4b, 0x65, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e, 0x0a, + 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x53, 0x4b, 0x65, 0x79, 0x12, 0x16, 0x2e, 0x70, + 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x53, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x4e, 0x53, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, + 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x53, 0x4b, 0x65, 0x79, 0x12, 0x16, 0x2e, 0x70, + 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x53, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, + 0x63, 0x65, 0x73, 0x73, 0x12, 0x35, 0x0a, 0x0b, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x53, + 0x4b, 0x65, 0x79, 0x12, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, + 0x53, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, + 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x4d, 0x0a, 0x10, 0x66, + 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, 0x4b, 0x65, 0x79, 0x12, + 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, + 0x4e, 0x53, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, + 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, 0x4b, + 0x65, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x15, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, 0x4b, + 0x65, 0x79, 0x73, 0x12, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, + 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x11, 0x6c, + 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, 0x4b, 0x65, 0x79, 0x73, + 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x4e, 0x53, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, + 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, + 0x53, 0x4b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06, 0x5a, + 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_service_ns_key_proto_rawDescOnce sync.Once + file_service_ns_key_proto_rawDescData = file_service_ns_key_proto_rawDesc +) + +func file_service_ns_key_proto_rawDescGZIP() []byte { + file_service_ns_key_proto_rawDescOnce.Do(func() { + file_service_ns_key_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_ns_key_proto_rawDescData) + }) + return file_service_ns_key_proto_rawDescData +} + +var file_service_ns_key_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_service_ns_key_proto_goTypes = []interface{}{ + (*CreateNSKeyRequest)(nil), // 0: pb.CreateNSKeyRequest + (*CreateNSKeyResponse)(nil), // 1: pb.CreateNSKeyResponse + (*UpdateNSKeyRequest)(nil), // 2: pb.UpdateNSKeyRequest + (*DeleteNSKeyRequest)(nil), // 3: pb.DeleteNSKeyRequest + (*FindEnabledNSKeyRequest)(nil), // 4: pb.FindEnabledNSKeyRequest + (*FindEnabledNSKeyResponse)(nil), // 5: pb.FindEnabledNSKeyResponse + (*CountAllEnabledNSKeysRequest)(nil), // 6: pb.CountAllEnabledNSKeysRequest + (*ListEnabledNSKeysRequest)(nil), // 7: pb.ListEnabledNSKeysRequest + (*ListEnabledNSKeysResponse)(nil), // 8: pb.ListEnabledNSKeysResponse + (*NSKey)(nil), // 9: pb.NSKey + (*RPCSuccess)(nil), // 10: pb.RPCSuccess + (*RPCCountResponse)(nil), // 11: pb.RPCCountResponse +} +var file_service_ns_key_proto_depIdxs = []int32{ + 9, // 0: pb.FindEnabledNSKeyResponse.nsKey:type_name -> pb.NSKey + 9, // 1: pb.ListEnabledNSKeysResponse.nsKeys:type_name -> pb.NSKey + 0, // 2: pb.NSKeyService.createNSKey:input_type -> pb.CreateNSKeyRequest + 2, // 3: pb.NSKeyService.updateNSKey:input_type -> pb.UpdateNSKeyRequest + 3, // 4: pb.NSKeyService.deleteNSKey:input_type -> pb.DeleteNSKeyRequest + 4, // 5: pb.NSKeyService.findEnabledNSKey:input_type -> pb.FindEnabledNSKeyRequest + 6, // 6: pb.NSKeyService.countAllEnabledNSKeys:input_type -> pb.CountAllEnabledNSKeysRequest + 7, // 7: pb.NSKeyService.listEnabledNSKeys:input_type -> pb.ListEnabledNSKeysRequest + 1, // 8: pb.NSKeyService.createNSKey:output_type -> pb.CreateNSKeyResponse + 10, // 9: pb.NSKeyService.updateNSKey:output_type -> pb.RPCSuccess + 10, // 10: pb.NSKeyService.deleteNSKey:output_type -> pb.RPCSuccess + 5, // 11: pb.NSKeyService.findEnabledNSKey:output_type -> pb.FindEnabledNSKeyResponse + 11, // 12: pb.NSKeyService.countAllEnabledNSKeys:output_type -> pb.RPCCountResponse + 8, // 13: pb.NSKeyService.listEnabledNSKeys:output_type -> pb.ListEnabledNSKeysResponse + 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 +} + +func init() { file_service_ns_key_proto_init() } +func file_service_ns_key_proto_init() { + if File_service_ns_key_proto != nil { + return + } + file_models_rpc_messages_proto_init() + file_models_model_ns_key_proto_init() + if !protoimpl.UnsafeEnabled { + file_service_ns_key_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateNSKeyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ns_key_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateNSKeyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ns_key_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateNSKeyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ns_key_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteNSKeyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ns_key_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindEnabledNSKeyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ns_key_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindEnabledNSKeyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ns_key_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CountAllEnabledNSKeysRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ns_key_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListEnabledNSKeysRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ns_key_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListEnabledNSKeysResponse); 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_service_ns_key_proto_rawDesc, + NumEnums: 0, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_ns_key_proto_goTypes, + DependencyIndexes: file_service_ns_key_proto_depIdxs, + MessageInfos: file_service_ns_key_proto_msgTypes, + }.Build() + File_service_ns_key_proto = out.File + file_service_ns_key_proto_rawDesc = nil + file_service_ns_key_proto_goTypes = nil + file_service_ns_key_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// NSKeyServiceClient is the client API for NSKeyService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type NSKeyServiceClient interface { + // 创建密钥 + CreateNSKey(ctx context.Context, in *CreateNSKeyRequest, opts ...grpc.CallOption) (*CreateNSKeyResponse, error) + // 修改密钥 + UpdateNSKey(ctx context.Context, in *UpdateNSKeyRequest, opts ...grpc.CallOption) (*RPCSuccess, error) + // 删除密钥 + DeleteNSKey(ctx context.Context, in *DeleteNSKeyRequest, opts ...grpc.CallOption) (*RPCSuccess, error) + // 查找单个密钥 + FindEnabledNSKey(ctx context.Context, in *FindEnabledNSKeyRequest, opts ...grpc.CallOption) (*FindEnabledNSKeyResponse, error) + // 计算密钥数量 + CountAllEnabledNSKeys(ctx context.Context, in *CountAllEnabledNSKeysRequest, opts ...grpc.CallOption) (*RPCCountResponse, error) + // 列出单页密钥 + ListEnabledNSKeys(ctx context.Context, in *ListEnabledNSKeysRequest, opts ...grpc.CallOption) (*ListEnabledNSKeysResponse, error) +} + +type nSKeyServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewNSKeyServiceClient(cc grpc.ClientConnInterface) NSKeyServiceClient { + return &nSKeyServiceClient{cc} +} + +func (c *nSKeyServiceClient) CreateNSKey(ctx context.Context, in *CreateNSKeyRequest, opts ...grpc.CallOption) (*CreateNSKeyResponse, error) { + out := new(CreateNSKeyResponse) + err := c.cc.Invoke(ctx, "/pb.NSKeyService/createNSKey", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nSKeyServiceClient) UpdateNSKey(ctx context.Context, in *UpdateNSKeyRequest, opts ...grpc.CallOption) (*RPCSuccess, error) { + out := new(RPCSuccess) + err := c.cc.Invoke(ctx, "/pb.NSKeyService/updateNSKey", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nSKeyServiceClient) DeleteNSKey(ctx context.Context, in *DeleteNSKeyRequest, opts ...grpc.CallOption) (*RPCSuccess, error) { + out := new(RPCSuccess) + err := c.cc.Invoke(ctx, "/pb.NSKeyService/deleteNSKey", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nSKeyServiceClient) FindEnabledNSKey(ctx context.Context, in *FindEnabledNSKeyRequest, opts ...grpc.CallOption) (*FindEnabledNSKeyResponse, error) { + out := new(FindEnabledNSKeyResponse) + err := c.cc.Invoke(ctx, "/pb.NSKeyService/findEnabledNSKey", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nSKeyServiceClient) CountAllEnabledNSKeys(ctx context.Context, in *CountAllEnabledNSKeysRequest, opts ...grpc.CallOption) (*RPCCountResponse, error) { + out := new(RPCCountResponse) + err := c.cc.Invoke(ctx, "/pb.NSKeyService/countAllEnabledNSKeys", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nSKeyServiceClient) ListEnabledNSKeys(ctx context.Context, in *ListEnabledNSKeysRequest, opts ...grpc.CallOption) (*ListEnabledNSKeysResponse, error) { + out := new(ListEnabledNSKeysResponse) + err := c.cc.Invoke(ctx, "/pb.NSKeyService/listEnabledNSKeys", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NSKeyServiceServer is the server API for NSKeyService service. +type NSKeyServiceServer interface { + // 创建密钥 + CreateNSKey(context.Context, *CreateNSKeyRequest) (*CreateNSKeyResponse, error) + // 修改密钥 + UpdateNSKey(context.Context, *UpdateNSKeyRequest) (*RPCSuccess, error) + // 删除密钥 + DeleteNSKey(context.Context, *DeleteNSKeyRequest) (*RPCSuccess, error) + // 查找单个密钥 + FindEnabledNSKey(context.Context, *FindEnabledNSKeyRequest) (*FindEnabledNSKeyResponse, error) + // 计算密钥数量 + CountAllEnabledNSKeys(context.Context, *CountAllEnabledNSKeysRequest) (*RPCCountResponse, error) + // 列出单页密钥 + ListEnabledNSKeys(context.Context, *ListEnabledNSKeysRequest) (*ListEnabledNSKeysResponse, error) +} + +// UnimplementedNSKeyServiceServer can be embedded to have forward compatible implementations. +type UnimplementedNSKeyServiceServer struct { +} + +func (*UnimplementedNSKeyServiceServer) CreateNSKey(context.Context, *CreateNSKeyRequest) (*CreateNSKeyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateNSKey not implemented") +} +func (*UnimplementedNSKeyServiceServer) UpdateNSKey(context.Context, *UpdateNSKeyRequest) (*RPCSuccess, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateNSKey not implemented") +} +func (*UnimplementedNSKeyServiceServer) DeleteNSKey(context.Context, *DeleteNSKeyRequest) (*RPCSuccess, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteNSKey not implemented") +} +func (*UnimplementedNSKeyServiceServer) FindEnabledNSKey(context.Context, *FindEnabledNSKeyRequest) (*FindEnabledNSKeyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindEnabledNSKey not implemented") +} +func (*UnimplementedNSKeyServiceServer) CountAllEnabledNSKeys(context.Context, *CountAllEnabledNSKeysRequest) (*RPCCountResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CountAllEnabledNSKeys not implemented") +} +func (*UnimplementedNSKeyServiceServer) ListEnabledNSKeys(context.Context, *ListEnabledNSKeysRequest) (*ListEnabledNSKeysResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListEnabledNSKeys not implemented") +} + +func RegisterNSKeyServiceServer(s *grpc.Server, srv NSKeyServiceServer) { + s.RegisterService(&_NSKeyService_serviceDesc, srv) +} + +func _NSKeyService_CreateNSKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateNSKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NSKeyServiceServer).CreateNSKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NSKeyService/CreateNSKey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NSKeyServiceServer).CreateNSKey(ctx, req.(*CreateNSKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NSKeyService_UpdateNSKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateNSKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NSKeyServiceServer).UpdateNSKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NSKeyService/UpdateNSKey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NSKeyServiceServer).UpdateNSKey(ctx, req.(*UpdateNSKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NSKeyService_DeleteNSKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteNSKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NSKeyServiceServer).DeleteNSKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NSKeyService/DeleteNSKey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NSKeyServiceServer).DeleteNSKey(ctx, req.(*DeleteNSKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NSKeyService_FindEnabledNSKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindEnabledNSKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NSKeyServiceServer).FindEnabledNSKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NSKeyService/FindEnabledNSKey", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NSKeyServiceServer).FindEnabledNSKey(ctx, req.(*FindEnabledNSKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NSKeyService_CountAllEnabledNSKeys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CountAllEnabledNSKeysRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NSKeyServiceServer).CountAllEnabledNSKeys(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NSKeyService/CountAllEnabledNSKeys", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NSKeyServiceServer).CountAllEnabledNSKeys(ctx, req.(*CountAllEnabledNSKeysRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NSKeyService_ListEnabledNSKeys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListEnabledNSKeysRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NSKeyServiceServer).ListEnabledNSKeys(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NSKeyService/ListEnabledNSKeys", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NSKeyServiceServer).ListEnabledNSKeys(ctx, req.(*ListEnabledNSKeysRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _NSKeyService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pb.NSKeyService", + HandlerType: (*NSKeyServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "createNSKey", + Handler: _NSKeyService_CreateNSKey_Handler, + }, + { + MethodName: "updateNSKey", + Handler: _NSKeyService_UpdateNSKey_Handler, + }, + { + MethodName: "deleteNSKey", + Handler: _NSKeyService_DeleteNSKey_Handler, + }, + { + MethodName: "findEnabledNSKey", + Handler: _NSKeyService_FindEnabledNSKey_Handler, + }, + { + MethodName: "countAllEnabledNSKeys", + Handler: _NSKeyService_CountAllEnabledNSKeys_Handler, + }, + { + MethodName: "listEnabledNSKeys", + Handler: _NSKeyService_ListEnabledNSKeys_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service_ns_key.proto", +} diff --git a/pkg/rpc/protos/models/model_ns_key.proto b/pkg/rpc/protos/models/model_ns_key.proto new file mode 100644 index 0000000..a892183 --- /dev/null +++ b/pkg/rpc/protos/models/model_ns_key.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +// NS密钥 +message NSKey { + int64 id =1; + bool isOn = 2; + string name = 3; + string algo = 4; + string secret = 5; + string secretType = 6; +} \ No newline at end of file diff --git a/pkg/rpc/protos/service_ns_key.proto b/pkg/rpc/protos/service_ns_key.proto new file mode 100644 index 0000000..75fe87c --- /dev/null +++ b/pkg/rpc/protos/service_ns_key.proto @@ -0,0 +1,84 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +import "models/rpc_messages.proto"; +import "models/model_ns_key.proto"; + +// NS密钥相关服务 +service NSKeyService { + // 创建密钥 + rpc createNSKey (CreateNSKeyRequest) returns (CreateNSKeyResponse); + + // 修改密钥 + rpc updateNSKey (UpdateNSKeyRequest) returns (RPCSuccess); + + // 删除密钥 + rpc deleteNSKey (DeleteNSKeyRequest) returns (RPCSuccess); + + // 查找单个密钥 + rpc findEnabledNSKey (FindEnabledNSKeyRequest) returns (FindEnabledNSKeyResponse); + + // 计算密钥数量 + rpc countAllEnabledNSKeys (CountAllEnabledNSKeysRequest) returns (RPCCountResponse); + + // 列出单页密钥 + rpc listEnabledNSKeys (ListEnabledNSKeysRequest) returns (ListEnabledNSKeysResponse); +} + +// 创建密钥 +message CreateNSKeyRequest { + int64 nsDomainId = 1; + int64 nsZoneId = 2; + string name = 3; + string algo = 4; + string secret = 5; + string secretType = 6; +} + +message CreateNSKeyResponse { + int64 nsKeyId = 1; +} + +// 修改密钥 +message UpdateNSKeyRequest { + int64 nsKeyId = 1; + string name = 2; + string algo = 3; + string secret = 4; + string secretType = 5; + bool isOn = 6; +} + +// 删除密钥 +message DeleteNSKeyRequest { + int64 nsKeyId = 1; +} + +// 查找单个密钥 +message FindEnabledNSKeyRequest { + int64 nsKeyId = 1; +} + +message FindEnabledNSKeyResponse { + NSKey nsKey = 1; +} + +// 计算密钥数量 +message CountAllEnabledNSKeysRequest { + int64 nsDomainId = 1; + int64 nsZoneId = 2; +} + +// 列出单页密钥 +message ListEnabledNSKeysRequest { + int64 nsDomainId = 1; + int64 nsZoneId = 2; + int64 offset = 3; + int64 size = 4; +} + +message ListEnabledNSKeysResponse { + repeated NSKey nsKeys = 1; +} \ No newline at end of file