diff --git a/pkg/dnsconfigs/route_ranges.go b/pkg/dnsconfigs/route_ranges.go new file mode 100644 index 0000000..b182dac --- /dev/null +++ b/pkg/dnsconfigs/route_ranges.go @@ -0,0 +1,15 @@ +// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved. + +package dnsconfigs + +type RouteRangeType = string + +const ( + RouteRangeTypeIP RouteRangeType = "ipRange" +) + +// RouteRangeIPRange IP范围配置 +type RouteRangeIPRange struct { + IPFrom string `json:"ipFrom"` + IPTo string `json:"ipTo"` +} diff --git a/pkg/rpc/pb/model_ns_route.pb.go b/pkg/rpc/pb/model_ns_route.pb.go index e354aff..6340310 100644 --- a/pkg/rpc/pb/model_ns_route.pb.go +++ b/pkg/rpc/pb/model_ns_route.pb.go @@ -31,9 +31,12 @@ type NSRoute struct { 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"` + 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"` + RangesJSON []byte `protobuf:"bytes,4,opt,name=rangesJSON,proto3" json:"rangesJSON,omitempty"` + NsCluster *NSCluster `protobuf:"bytes,30,opt,name=nsCluster,proto3" json:"nsCluster,omitempty"` + NsDomain *NSDomain `protobuf:"bytes,31,opt,name=nsDomain,proto3" json:"nsDomain,omitempty"` } func (x *NSRoute) Reset() { @@ -89,17 +92,49 @@ func (x *NSRoute) GetName() string { return "" } +func (x *NSRoute) GetRangesJSON() []byte { + if x != nil { + return x.RangesJSON + } + return nil +} + +func (x *NSRoute) GetNsCluster() *NSCluster { + if x != nil { + return x.NsCluster + } + return nil +} + +func (x *NSRoute) GetNsDomain() *NSDomain { + if x != nil { + return x.NsDomain + } + return nil +} + var File_models_model_ns_route_proto protoreflect.FileDescriptor var file_models_model_ns_route_proto_rawDesc = []byte{ 0x0a, 0x1b, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x73, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, - 0x62, 0x22, 0x41, 0x0a, 0x07, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x62, 0x1a, 0x1d, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, + 0x6e, 0x73, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x1c, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, + 0x73, 0x5f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb8, + 0x01, 0x0a, 0x07, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 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, 0x1e, 0x0a, 0x0a, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x4a, 0x53, + 0x4f, 0x4e, 0x12, 0x2b, 0x0a, 0x09, 0x6e, 0x73, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, + 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x53, 0x43, 0x6c, 0x75, + 0x73, 0x74, 0x65, 0x72, 0x52, 0x09, 0x6e, 0x73, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, + 0x28, 0x0a, 0x08, 0x6e, 0x73, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x1f, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x53, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x52, + 0x08, 0x6e, 0x73, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -116,14 +151,18 @@ func file_models_model_ns_route_proto_rawDescGZIP() []byte { var file_models_model_ns_route_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_models_model_ns_route_proto_goTypes = []interface{}{ - (*NSRoute)(nil), // 0: pb.NSRoute + (*NSRoute)(nil), // 0: pb.NSRoute + (*NSCluster)(nil), // 1: pb.NSCluster + (*NSDomain)(nil), // 2: pb.NSDomain } var file_models_model_ns_route_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 + 1, // 0: pb.NSRoute.nsCluster:type_name -> pb.NSCluster + 2, // 1: pb.NSRoute.nsDomain:type_name -> pb.NSDomain + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] 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_models_model_ns_route_proto_init() } @@ -131,6 +170,8 @@ func file_models_model_ns_route_proto_init() { if File_models_model_ns_route_proto != nil { return } + file_models_model_ns_cluster_proto_init() + file_models_model_ns_domain_proto_init() if !protoimpl.UnsafeEnabled { file_models_model_ns_route_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NSRoute); i { diff --git a/pkg/rpc/pb/service_ns_route.pb.go b/pkg/rpc/pb/service_ns_route.pb.go new file mode 100644 index 0000000..e07b114 --- /dev/null +++ b/pkg/rpc/pb/service_ns_route.pb.go @@ -0,0 +1,1069 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: service_ns_route.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 CreateNSRouteRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsClusterId int64 `protobuf:"varint,1,opt,name=nsClusterId,proto3" json:"nsClusterId,omitempty"` + NsDomainId int64 `protobuf:"varint,2,opt,name=nsDomainId,proto3" json:"nsDomainId,omitempty"` + UserId int64 `protobuf:"varint,3,opt,name=userId,proto3" json:"userId,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + RangesJSON []byte `protobuf:"bytes,5,opt,name=rangesJSON,proto3" json:"rangesJSON,omitempty"` +} + +func (x *CreateNSRouteRequest) Reset() { + *x = CreateNSRouteRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_route_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateNSRouteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateNSRouteRequest) ProtoMessage() {} + +func (x *CreateNSRouteRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_route_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 CreateNSRouteRequest.ProtoReflect.Descriptor instead. +func (*CreateNSRouteRequest) Descriptor() ([]byte, []int) { + return file_service_ns_route_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateNSRouteRequest) GetNsClusterId() int64 { + if x != nil { + return x.NsClusterId + } + return 0 +} + +func (x *CreateNSRouteRequest) GetNsDomainId() int64 { + if x != nil { + return x.NsDomainId + } + return 0 +} + +func (x *CreateNSRouteRequest) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *CreateNSRouteRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateNSRouteRequest) GetRangesJSON() []byte { + if x != nil { + return x.RangesJSON + } + return nil +} + +type CreateNSRouteResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsRouteId int64 `protobuf:"varint,1,opt,name=nsRouteId,proto3" json:"nsRouteId,omitempty"` +} + +func (x *CreateNSRouteResponse) Reset() { + *x = CreateNSRouteResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_route_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateNSRouteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateNSRouteResponse) ProtoMessage() {} + +func (x *CreateNSRouteResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_route_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 CreateNSRouteResponse.ProtoReflect.Descriptor instead. +func (*CreateNSRouteResponse) Descriptor() ([]byte, []int) { + return file_service_ns_route_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateNSRouteResponse) GetNsRouteId() int64 { + if x != nil { + return x.NsRouteId + } + return 0 +} + +// 修改线路 +type UpdateNSRouteRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsRouteId int64 `protobuf:"varint,1,opt,name=nsRouteId,proto3" json:"nsRouteId,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + RangesJSON []byte `protobuf:"bytes,3,opt,name=rangesJSON,proto3" json:"rangesJSON,omitempty"` +} + +func (x *UpdateNSRouteRequest) Reset() { + *x = UpdateNSRouteRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_route_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateNSRouteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateNSRouteRequest) ProtoMessage() {} + +func (x *UpdateNSRouteRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_route_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 UpdateNSRouteRequest.ProtoReflect.Descriptor instead. +func (*UpdateNSRouteRequest) Descriptor() ([]byte, []int) { + return file_service_ns_route_proto_rawDescGZIP(), []int{2} +} + +func (x *UpdateNSRouteRequest) GetNsRouteId() int64 { + if x != nil { + return x.NsRouteId + } + return 0 +} + +func (x *UpdateNSRouteRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdateNSRouteRequest) GetRangesJSON() []byte { + if x != nil { + return x.RangesJSON + } + return nil +} + +// 删除线路 +type DeleteNSRouteRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsRouteId int64 `protobuf:"varint,1,opt,name=nsRouteId,proto3" json:"nsRouteId,omitempty"` +} + +func (x *DeleteNSRouteRequest) Reset() { + *x = DeleteNSRouteRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_route_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteNSRouteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteNSRouteRequest) ProtoMessage() {} + +func (x *DeleteNSRouteRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_route_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 DeleteNSRouteRequest.ProtoReflect.Descriptor instead. +func (*DeleteNSRouteRequest) Descriptor() ([]byte, []int) { + return file_service_ns_route_proto_rawDescGZIP(), []int{3} +} + +func (x *DeleteNSRouteRequest) GetNsRouteId() int64 { + if x != nil { + return x.NsRouteId + } + return 0 +} + +// 获取单个路线信息 +type FindEnabledNSRouteRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsRouteId int64 `protobuf:"varint,1,opt,name=nsRouteId,proto3" json:"nsRouteId,omitempty"` +} + +func (x *FindEnabledNSRouteRequest) Reset() { + *x = FindEnabledNSRouteRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_route_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindEnabledNSRouteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindEnabledNSRouteRequest) ProtoMessage() {} + +func (x *FindEnabledNSRouteRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_route_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 FindEnabledNSRouteRequest.ProtoReflect.Descriptor instead. +func (*FindEnabledNSRouteRequest) Descriptor() ([]byte, []int) { + return file_service_ns_route_proto_rawDescGZIP(), []int{4} +} + +func (x *FindEnabledNSRouteRequest) GetNsRouteId() int64 { + if x != nil { + return x.NsRouteId + } + return 0 +} + +type FindEnabledNSRouteResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsRoute *NSRoute `protobuf:"bytes,1,opt,name=nsRoute,proto3" json:"nsRoute,omitempty"` +} + +func (x *FindEnabledNSRouteResponse) Reset() { + *x = FindEnabledNSRouteResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_route_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindEnabledNSRouteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindEnabledNSRouteResponse) ProtoMessage() {} + +func (x *FindEnabledNSRouteResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_route_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 FindEnabledNSRouteResponse.ProtoReflect.Descriptor instead. +func (*FindEnabledNSRouteResponse) Descriptor() ([]byte, []int) { + return file_service_ns_route_proto_rawDescGZIP(), []int{5} +} + +func (x *FindEnabledNSRouteResponse) GetNsRoute() *NSRoute { + if x != nil { + return x.NsRoute + } + return nil +} + +// 读取所有线路 +type FindAllEnabledNSRoutesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsClusterId int64 `protobuf:"varint,1,opt,name=nsClusterId,proto3" json:"nsClusterId,omitempty"` + NsDomainId int64 `protobuf:"varint,2,opt,name=nsDomainId,proto3" json:"nsDomainId,omitempty"` + UserId int64 `protobuf:"varint,3,opt,name=userId,proto3" json:"userId,omitempty"` +} + +func (x *FindAllEnabledNSRoutesRequest) Reset() { + *x = FindAllEnabledNSRoutesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_route_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindAllEnabledNSRoutesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindAllEnabledNSRoutesRequest) ProtoMessage() {} + +func (x *FindAllEnabledNSRoutesRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_route_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 FindAllEnabledNSRoutesRequest.ProtoReflect.Descriptor instead. +func (*FindAllEnabledNSRoutesRequest) Descriptor() ([]byte, []int) { + return file_service_ns_route_proto_rawDescGZIP(), []int{6} +} + +func (x *FindAllEnabledNSRoutesRequest) GetNsClusterId() int64 { + if x != nil { + return x.NsClusterId + } + return 0 +} + +func (x *FindAllEnabledNSRoutesRequest) GetNsDomainId() int64 { + if x != nil { + return x.NsDomainId + } + return 0 +} + +func (x *FindAllEnabledNSRoutesRequest) GetUserId() int64 { + if x != nil { + return x.UserId + } + return 0 +} + +type FindAllEnabledNSRoutesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsRoutes []*NSRoute `protobuf:"bytes,1,rep,name=nsRoutes,proto3" json:"nsRoutes,omitempty"` +} + +func (x *FindAllEnabledNSRoutesResponse) Reset() { + *x = FindAllEnabledNSRoutesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_route_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindAllEnabledNSRoutesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindAllEnabledNSRoutesResponse) ProtoMessage() {} + +func (x *FindAllEnabledNSRoutesResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_route_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 FindAllEnabledNSRoutesResponse.ProtoReflect.Descriptor instead. +func (*FindAllEnabledNSRoutesResponse) Descriptor() ([]byte, []int) { + return file_service_ns_route_proto_rawDescGZIP(), []int{7} +} + +func (x *FindAllEnabledNSRoutesResponse) GetNsRoutes() []*NSRoute { + if x != nil { + return x.NsRoutes + } + return nil +} + +// 设置线路排序 +type UpdateNSRouteOrdersRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NsRouteIds []int64 `protobuf:"varint,1,rep,packed,name=nsRouteIds,proto3" json:"nsRouteIds,omitempty"` +} + +func (x *UpdateNSRouteOrdersRequest) Reset() { + *x = UpdateNSRouteOrdersRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ns_route_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateNSRouteOrdersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateNSRouteOrdersRequest) ProtoMessage() {} + +func (x *UpdateNSRouteOrdersRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_ns_route_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 UpdateNSRouteOrdersRequest.ProtoReflect.Descriptor instead. +func (*UpdateNSRouteOrdersRequest) Descriptor() ([]byte, []int) { + return file_service_ns_route_proto_rawDescGZIP(), []int{8} +} + +func (x *UpdateNSRouteOrdersRequest) GetNsRouteIds() []int64 { + if x != nil { + return x.NsRouteIds + } + return nil +} + +var File_service_ns_route_proto protoreflect.FileDescriptor + +var file_service_ns_route_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x73, 0x5f, 0x72, 0x6f, 0x75, + 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x1b, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x73, 0x5f, 0x72, 0x6f, + 0x75, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, 0x22, 0xa4, 0x01, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, + 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, + 0x0b, 0x6e, 0x73, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0b, 0x6e, 0x73, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, + 0x1e, 0x0a, 0x0a, 0x6e, 0x73, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6e, 0x73, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, + 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72, + 0x61, 0x6e, 0x67, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x0a, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x35, 0x0a, 0x15, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x49, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, + 0x49, 0x64, 0x22, 0x68, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x53, 0x52, 0x6f, + 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x73, + 0x52, 0x6f, 0x75, 0x74, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6e, + 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, + 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x0a, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x34, 0x0a, 0x14, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x49, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, + 0x49, 0x64, 0x22, 0x39, 0x0a, 0x19, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1c, 0x0a, 0x09, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x09, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x49, 0x64, 0x22, 0x43, 0x0a, + 0x1a, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, 0x52, 0x6f, + 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x07, 0x6e, + 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, + 0x62, 0x2e, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x07, 0x6e, 0x73, 0x52, 0x6f, 0x75, + 0x74, 0x65, 0x22, 0x79, 0x0a, 0x1d, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x73, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6e, 0x73, 0x43, 0x6c, 0x75, 0x73, + 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x73, 0x44, 0x6f, 0x6d, 0x61, 0x69, + 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6e, 0x73, 0x44, 0x6f, 0x6d, + 0x61, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x49, 0x0a, + 0x1e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, + 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x27, 0x0a, 0x08, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x08, + 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x22, 0x3c, 0x0a, 0x1a, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x6e, 0x73, 0x52, 0x6f, 0x75, 0x74, + 0x65, 0x49, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x52, 0x0a, 0x6e, 0x73, 0x52, 0x6f, + 0x75, 0x74, 0x65, 0x49, 0x64, 0x73, 0x32, 0xc9, 0x03, 0x0a, 0x0e, 0x4e, 0x53, 0x52, 0x6f, 0x75, + 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x63, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x18, 0x2e, 0x70, 0x62, 0x2e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x39, 0x0a, 0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, + 0x12, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x53, 0x52, 0x6f, + 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, + 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x39, 0x0a, 0x0d, 0x64, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x18, 0x2e, 0x70, 0x62, + 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x53, 0x0a, 0x12, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x1d, 0x2e, 0x70, 0x62, + 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, 0x52, 0x6f, + 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, + 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, 0x52, 0x6f, 0x75, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x16, 0x66, 0x69, + 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, 0x52, 0x6f, + 0x75, 0x74, 0x65, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, + 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, + 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x53, 0x52, 0x6f, 0x75, + 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x13, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x53, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, + 0x72, 0x73, 0x12, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x53, + 0x52, 0x6f, 0x75, 0x74, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_service_ns_route_proto_rawDescOnce sync.Once + file_service_ns_route_proto_rawDescData = file_service_ns_route_proto_rawDesc +) + +func file_service_ns_route_proto_rawDescGZIP() []byte { + file_service_ns_route_proto_rawDescOnce.Do(func() { + file_service_ns_route_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_ns_route_proto_rawDescData) + }) + return file_service_ns_route_proto_rawDescData +} + +var file_service_ns_route_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_service_ns_route_proto_goTypes = []interface{}{ + (*CreateNSRouteRequest)(nil), // 0: pb.CreateNSRouteRequest + (*CreateNSRouteResponse)(nil), // 1: pb.CreateNSRouteResponse + (*UpdateNSRouteRequest)(nil), // 2: pb.UpdateNSRouteRequest + (*DeleteNSRouteRequest)(nil), // 3: pb.DeleteNSRouteRequest + (*FindEnabledNSRouteRequest)(nil), // 4: pb.FindEnabledNSRouteRequest + (*FindEnabledNSRouteResponse)(nil), // 5: pb.FindEnabledNSRouteResponse + (*FindAllEnabledNSRoutesRequest)(nil), // 6: pb.FindAllEnabledNSRoutesRequest + (*FindAllEnabledNSRoutesResponse)(nil), // 7: pb.FindAllEnabledNSRoutesResponse + (*UpdateNSRouteOrdersRequest)(nil), // 8: pb.UpdateNSRouteOrdersRequest + (*NSRoute)(nil), // 9: pb.NSRoute + (*RPCSuccess)(nil), // 10: pb.RPCSuccess +} +var file_service_ns_route_proto_depIdxs = []int32{ + 9, // 0: pb.FindEnabledNSRouteResponse.nsRoute:type_name -> pb.NSRoute + 9, // 1: pb.FindAllEnabledNSRoutesResponse.nsRoutes:type_name -> pb.NSRoute + 0, // 2: pb.NSRouteService.createNSRoute:input_type -> pb.CreateNSRouteRequest + 2, // 3: pb.NSRouteService.updateNSRoute:input_type -> pb.UpdateNSRouteRequest + 3, // 4: pb.NSRouteService.deleteNSRoute:input_type -> pb.DeleteNSRouteRequest + 4, // 5: pb.NSRouteService.findEnabledNSRoute:input_type -> pb.FindEnabledNSRouteRequest + 6, // 6: pb.NSRouteService.findAllEnabledNSRoutes:input_type -> pb.FindAllEnabledNSRoutesRequest + 8, // 7: pb.NSRouteService.updateNSRouteOrders:input_type -> pb.UpdateNSRouteOrdersRequest + 1, // 8: pb.NSRouteService.createNSRoute:output_type -> pb.CreateNSRouteResponse + 10, // 9: pb.NSRouteService.updateNSRoute:output_type -> pb.RPCSuccess + 10, // 10: pb.NSRouteService.deleteNSRoute:output_type -> pb.RPCSuccess + 5, // 11: pb.NSRouteService.findEnabledNSRoute:output_type -> pb.FindEnabledNSRouteResponse + 7, // 12: pb.NSRouteService.findAllEnabledNSRoutes:output_type -> pb.FindAllEnabledNSRoutesResponse + 10, // 13: pb.NSRouteService.updateNSRouteOrders:output_type -> pb.RPCSuccess + 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_route_proto_init() } +func file_service_ns_route_proto_init() { + if File_service_ns_route_proto != nil { + return + } + file_models_model_ns_route_proto_init() + file_models_rpc_messages_proto_init() + if !protoimpl.UnsafeEnabled { + file_service_ns_route_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateNSRouteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ns_route_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateNSRouteResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ns_route_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateNSRouteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ns_route_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteNSRouteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ns_route_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindEnabledNSRouteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ns_route_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindEnabledNSRouteResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ns_route_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindAllEnabledNSRoutesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ns_route_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindAllEnabledNSRoutesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ns_route_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateNSRouteOrdersRequest); 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_route_proto_rawDesc, + NumEnums: 0, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_ns_route_proto_goTypes, + DependencyIndexes: file_service_ns_route_proto_depIdxs, + MessageInfos: file_service_ns_route_proto_msgTypes, + }.Build() + File_service_ns_route_proto = out.File + file_service_ns_route_proto_rawDesc = nil + file_service_ns_route_proto_goTypes = nil + file_service_ns_route_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 + +// NSRouteServiceClient is the client API for NSRouteService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type NSRouteServiceClient interface { + // 创建线路 + CreateNSRoute(ctx context.Context, in *CreateNSRouteRequest, opts ...grpc.CallOption) (*CreateNSRouteResponse, error) + // 修改线路 + UpdateNSRoute(ctx context.Context, in *UpdateNSRouteRequest, opts ...grpc.CallOption) (*RPCSuccess, error) + // 删除线路 + DeleteNSRoute(ctx context.Context, in *DeleteNSRouteRequest, opts ...grpc.CallOption) (*RPCSuccess, error) + // 获取单个路线信息 + FindEnabledNSRoute(ctx context.Context, in *FindEnabledNSRouteRequest, opts ...grpc.CallOption) (*FindEnabledNSRouteResponse, error) + // 读取所有线路 + FindAllEnabledNSRoutes(ctx context.Context, in *FindAllEnabledNSRoutesRequest, opts ...grpc.CallOption) (*FindAllEnabledNSRoutesResponse, error) + // 设置线路排序 + UpdateNSRouteOrders(ctx context.Context, in *UpdateNSRouteOrdersRequest, opts ...grpc.CallOption) (*RPCSuccess, error) +} + +type nSRouteServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewNSRouteServiceClient(cc grpc.ClientConnInterface) NSRouteServiceClient { + return &nSRouteServiceClient{cc} +} + +func (c *nSRouteServiceClient) CreateNSRoute(ctx context.Context, in *CreateNSRouteRequest, opts ...grpc.CallOption) (*CreateNSRouteResponse, error) { + out := new(CreateNSRouteResponse) + err := c.cc.Invoke(ctx, "/pb.NSRouteService/createNSRoute", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nSRouteServiceClient) UpdateNSRoute(ctx context.Context, in *UpdateNSRouteRequest, opts ...grpc.CallOption) (*RPCSuccess, error) { + out := new(RPCSuccess) + err := c.cc.Invoke(ctx, "/pb.NSRouteService/updateNSRoute", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nSRouteServiceClient) DeleteNSRoute(ctx context.Context, in *DeleteNSRouteRequest, opts ...grpc.CallOption) (*RPCSuccess, error) { + out := new(RPCSuccess) + err := c.cc.Invoke(ctx, "/pb.NSRouteService/deleteNSRoute", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nSRouteServiceClient) FindEnabledNSRoute(ctx context.Context, in *FindEnabledNSRouteRequest, opts ...grpc.CallOption) (*FindEnabledNSRouteResponse, error) { + out := new(FindEnabledNSRouteResponse) + err := c.cc.Invoke(ctx, "/pb.NSRouteService/findEnabledNSRoute", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nSRouteServiceClient) FindAllEnabledNSRoutes(ctx context.Context, in *FindAllEnabledNSRoutesRequest, opts ...grpc.CallOption) (*FindAllEnabledNSRoutesResponse, error) { + out := new(FindAllEnabledNSRoutesResponse) + err := c.cc.Invoke(ctx, "/pb.NSRouteService/findAllEnabledNSRoutes", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *nSRouteServiceClient) UpdateNSRouteOrders(ctx context.Context, in *UpdateNSRouteOrdersRequest, opts ...grpc.CallOption) (*RPCSuccess, error) { + out := new(RPCSuccess) + err := c.cc.Invoke(ctx, "/pb.NSRouteService/updateNSRouteOrders", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// NSRouteServiceServer is the server API for NSRouteService service. +type NSRouteServiceServer interface { + // 创建线路 + CreateNSRoute(context.Context, *CreateNSRouteRequest) (*CreateNSRouteResponse, error) + // 修改线路 + UpdateNSRoute(context.Context, *UpdateNSRouteRequest) (*RPCSuccess, error) + // 删除线路 + DeleteNSRoute(context.Context, *DeleteNSRouteRequest) (*RPCSuccess, error) + // 获取单个路线信息 + FindEnabledNSRoute(context.Context, *FindEnabledNSRouteRequest) (*FindEnabledNSRouteResponse, error) + // 读取所有线路 + FindAllEnabledNSRoutes(context.Context, *FindAllEnabledNSRoutesRequest) (*FindAllEnabledNSRoutesResponse, error) + // 设置线路排序 + UpdateNSRouteOrders(context.Context, *UpdateNSRouteOrdersRequest) (*RPCSuccess, error) +} + +// UnimplementedNSRouteServiceServer can be embedded to have forward compatible implementations. +type UnimplementedNSRouteServiceServer struct { +} + +func (*UnimplementedNSRouteServiceServer) CreateNSRoute(context.Context, *CreateNSRouteRequest) (*CreateNSRouteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateNSRoute not implemented") +} +func (*UnimplementedNSRouteServiceServer) UpdateNSRoute(context.Context, *UpdateNSRouteRequest) (*RPCSuccess, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateNSRoute not implemented") +} +func (*UnimplementedNSRouteServiceServer) DeleteNSRoute(context.Context, *DeleteNSRouteRequest) (*RPCSuccess, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteNSRoute not implemented") +} +func (*UnimplementedNSRouteServiceServer) FindEnabledNSRoute(context.Context, *FindEnabledNSRouteRequest) (*FindEnabledNSRouteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindEnabledNSRoute not implemented") +} +func (*UnimplementedNSRouteServiceServer) FindAllEnabledNSRoutes(context.Context, *FindAllEnabledNSRoutesRequest) (*FindAllEnabledNSRoutesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindAllEnabledNSRoutes not implemented") +} +func (*UnimplementedNSRouteServiceServer) UpdateNSRouteOrders(context.Context, *UpdateNSRouteOrdersRequest) (*RPCSuccess, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateNSRouteOrders not implemented") +} + +func RegisterNSRouteServiceServer(s *grpc.Server, srv NSRouteServiceServer) { + s.RegisterService(&_NSRouteService_serviceDesc, srv) +} + +func _NSRouteService_CreateNSRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateNSRouteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NSRouteServiceServer).CreateNSRoute(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NSRouteService/CreateNSRoute", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NSRouteServiceServer).CreateNSRoute(ctx, req.(*CreateNSRouteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NSRouteService_UpdateNSRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateNSRouteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NSRouteServiceServer).UpdateNSRoute(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NSRouteService/UpdateNSRoute", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NSRouteServiceServer).UpdateNSRoute(ctx, req.(*UpdateNSRouteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NSRouteService_DeleteNSRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteNSRouteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NSRouteServiceServer).DeleteNSRoute(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NSRouteService/DeleteNSRoute", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NSRouteServiceServer).DeleteNSRoute(ctx, req.(*DeleteNSRouteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NSRouteService_FindEnabledNSRoute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindEnabledNSRouteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NSRouteServiceServer).FindEnabledNSRoute(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NSRouteService/FindEnabledNSRoute", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NSRouteServiceServer).FindEnabledNSRoute(ctx, req.(*FindEnabledNSRouteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NSRouteService_FindAllEnabledNSRoutes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindAllEnabledNSRoutesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NSRouteServiceServer).FindAllEnabledNSRoutes(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NSRouteService/FindAllEnabledNSRoutes", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NSRouteServiceServer).FindAllEnabledNSRoutes(ctx, req.(*FindAllEnabledNSRoutesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _NSRouteService_UpdateNSRouteOrders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateNSRouteOrdersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(NSRouteServiceServer).UpdateNSRouteOrders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.NSRouteService/UpdateNSRouteOrders", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(NSRouteServiceServer).UpdateNSRouteOrders(ctx, req.(*UpdateNSRouteOrdersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _NSRouteService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pb.NSRouteService", + HandlerType: (*NSRouteServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "createNSRoute", + Handler: _NSRouteService_CreateNSRoute_Handler, + }, + { + MethodName: "updateNSRoute", + Handler: _NSRouteService_UpdateNSRoute_Handler, + }, + { + MethodName: "deleteNSRoute", + Handler: _NSRouteService_DeleteNSRoute_Handler, + }, + { + MethodName: "findEnabledNSRoute", + Handler: _NSRouteService_FindEnabledNSRoute_Handler, + }, + { + MethodName: "findAllEnabledNSRoutes", + Handler: _NSRouteService_FindAllEnabledNSRoutes_Handler, + }, + { + MethodName: "updateNSRouteOrders", + Handler: _NSRouteService_UpdateNSRouteOrders_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service_ns_route.proto", +} diff --git a/pkg/rpc/protos/models/model_ns_route.proto b/pkg/rpc/protos/models/model_ns_route.proto index 0557fb7..6ec402b 100644 --- a/pkg/rpc/protos/models/model_ns_route.proto +++ b/pkg/rpc/protos/models/model_ns_route.proto @@ -3,9 +3,16 @@ option go_package = "./pb"; package pb; +import "models/model_ns_cluster.proto"; +import "models/model_ns_domain.proto"; + // 线路 message NSRoute { int64 id = 1; bool isOn = 2; string name = 3; + bytes rangesJSON = 4; + + NSCluster nsCluster = 30; + NSDomain nsDomain = 31; } \ No newline at end of file diff --git a/pkg/rpc/protos/service_ns_route.proto b/pkg/rpc/protos/service_ns_route.proto new file mode 100644 index 0000000..b322350 --- /dev/null +++ b/pkg/rpc/protos/service_ns_route.proto @@ -0,0 +1,78 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +import "models/model_ns_route.proto"; +import "models/rpc_messages.proto"; + +// 线路相关服务 +service NSRouteService { + // 创建线路 + rpc createNSRoute (CreateNSRouteRequest) returns (CreateNSRouteResponse); + + // 修改线路 + rpc updateNSRoute (UpdateNSRouteRequest) returns (RPCSuccess); + + // 删除线路 + rpc deleteNSRoute (DeleteNSRouteRequest) returns (RPCSuccess); + + // 获取单个路线信息 + rpc findEnabledNSRoute (FindEnabledNSRouteRequest) returns (FindEnabledNSRouteResponse); + + // 读取所有线路 + rpc findAllEnabledNSRoutes (FindAllEnabledNSRoutesRequest) returns (FindAllEnabledNSRoutesResponse); + + // 设置线路排序 + rpc updateNSRouteOrders (UpdateNSRouteOrdersRequest) returns (RPCSuccess); +} + +// 创建线路 +message CreateNSRouteRequest { + int64 nsClusterId = 1; + int64 nsDomainId = 2; + int64 userId = 3; + string name = 4; + bytes rangesJSON = 5; +} + +message CreateNSRouteResponse { + int64 nsRouteId = 1; +} + +// 修改线路 +message UpdateNSRouteRequest { + int64 nsRouteId = 1; + string name = 2; + bytes rangesJSON = 3; +} + +// 删除线路 +message DeleteNSRouteRequest { + int64 nsRouteId = 1; +} + +// 获取单个路线信息 +message FindEnabledNSRouteRequest { + int64 nsRouteId = 1; +} + +message FindEnabledNSRouteResponse { + NSRoute nsRoute = 1; +} + +// 读取所有线路 +message FindAllEnabledNSRoutesRequest { + int64 nsClusterId = 1; + int64 nsDomainId = 2; + int64 userId = 3; +} + +message FindAllEnabledNSRoutesResponse { + repeated NSRoute nsRoutes = 1; +} + +// 设置线路排序 +message UpdateNSRouteOrdersRequest { + repeated int64 nsRouteIds = 1; +} \ No newline at end of file