diff --git a/pkg/rpc/pb/model_http_firewall_policy.pb.go b/pkg/rpc/pb/model_http_firewall_policy.pb.go new file mode 100644 index 0000000..32eec9c --- /dev/null +++ b/pkg/rpc/pb/model_http_firewall_policy.pb.go @@ -0,0 +1,166 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: model_http_firewall_policy.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 + +type HTTPFirewallPolicy struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + IsOn bool `protobuf:"varint,3,opt,name=isOn,proto3" json:"isOn,omitempty"` +} + +func (x *HTTPFirewallPolicy) Reset() { + *x = HTTPFirewallPolicy{} + if protoimpl.UnsafeEnabled { + mi := &file_model_http_firewall_policy_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HTTPFirewallPolicy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HTTPFirewallPolicy) ProtoMessage() {} + +func (x *HTTPFirewallPolicy) ProtoReflect() protoreflect.Message { + mi := &file_model_http_firewall_policy_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 HTTPFirewallPolicy.ProtoReflect.Descriptor instead. +func (*HTTPFirewallPolicy) Descriptor() ([]byte, []int) { + return file_model_http_firewall_policy_proto_rawDescGZIP(), []int{0} +} + +func (x *HTTPFirewallPolicy) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *HTTPFirewallPolicy) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *HTTPFirewallPolicy) GetIsOn() bool { + if x != nil { + return x.IsOn + } + return false +} + +var File_model_http_firewall_policy_proto protoreflect.FileDescriptor + +var file_model_http_firewall_policy_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x66, 0x69, 0x72, + 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x4c, 0x0a, 0x12, 0x48, 0x54, 0x54, 0x50, 0x46, 0x69, + 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 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, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, + 0x69, 0x73, 0x4f, 0x6e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_model_http_firewall_policy_proto_rawDescOnce sync.Once + file_model_http_firewall_policy_proto_rawDescData = file_model_http_firewall_policy_proto_rawDesc +) + +func file_model_http_firewall_policy_proto_rawDescGZIP() []byte { + file_model_http_firewall_policy_proto_rawDescOnce.Do(func() { + file_model_http_firewall_policy_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_http_firewall_policy_proto_rawDescData) + }) + return file_model_http_firewall_policy_proto_rawDescData +} + +var file_model_http_firewall_policy_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_model_http_firewall_policy_proto_goTypes = []interface{}{ + (*HTTPFirewallPolicy)(nil), // 0: pb.HTTPFirewallPolicy +} +var file_model_http_firewall_policy_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_model_http_firewall_policy_proto_init() } +func file_model_http_firewall_policy_proto_init() { + if File_model_http_firewall_policy_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_model_http_firewall_policy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HTTPFirewallPolicy); 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_model_http_firewall_policy_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_model_http_firewall_policy_proto_goTypes, + DependencyIndexes: file_model_http_firewall_policy_proto_depIdxs, + MessageInfos: file_model_http_firewall_policy_proto_msgTypes, + }.Build() + File_model_http_firewall_policy_proto = out.File + file_model_http_firewall_policy_proto_rawDesc = nil + file_model_http_firewall_policy_proto_goTypes = nil + file_model_http_firewall_policy_proto_depIdxs = nil +} diff --git a/pkg/rpc/pb/service_http_firewall_policy.pb.go b/pkg/rpc/pb/service_http_firewall_policy.pb.go new file mode 100644 index 0000000..8f34d5e --- /dev/null +++ b/pkg/rpc/pb/service_http_firewall_policy.pb.go @@ -0,0 +1,310 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: service_http_firewall_policy.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 FindAllEnabledHTTPFirewallPoliciesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *FindAllEnabledHTTPFirewallPoliciesRequest) Reset() { + *x = FindAllEnabledHTTPFirewallPoliciesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_http_firewall_policy_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindAllEnabledHTTPFirewallPoliciesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindAllEnabledHTTPFirewallPoliciesRequest) ProtoMessage() {} + +func (x *FindAllEnabledHTTPFirewallPoliciesRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_http_firewall_policy_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 FindAllEnabledHTTPFirewallPoliciesRequest.ProtoReflect.Descriptor instead. +func (*FindAllEnabledHTTPFirewallPoliciesRequest) Descriptor() ([]byte, []int) { + return file_service_http_firewall_policy_proto_rawDescGZIP(), []int{0} +} + +type FindAllEnabledHTTPFirewallPoliciesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FirewallPolicies []*HTTPFirewallPolicy `protobuf:"bytes,1,rep,name=firewallPolicies,proto3" json:"firewallPolicies,omitempty"` +} + +func (x *FindAllEnabledHTTPFirewallPoliciesResponse) Reset() { + *x = FindAllEnabledHTTPFirewallPoliciesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_http_firewall_policy_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindAllEnabledHTTPFirewallPoliciesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindAllEnabledHTTPFirewallPoliciesResponse) ProtoMessage() {} + +func (x *FindAllEnabledHTTPFirewallPoliciesResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_http_firewall_policy_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 FindAllEnabledHTTPFirewallPoliciesResponse.ProtoReflect.Descriptor instead. +func (*FindAllEnabledHTTPFirewallPoliciesResponse) Descriptor() ([]byte, []int) { + return file_service_http_firewall_policy_proto_rawDescGZIP(), []int{1} +} + +func (x *FindAllEnabledHTTPFirewallPoliciesResponse) GetFirewallPolicies() []*HTTPFirewallPolicy { + if x != nil { + return x.FirewallPolicies + } + return nil +} + +var File_service_http_firewall_policy_proto protoreflect.FileDescriptor + +var file_service_http_firewall_policy_proto_rawDesc = []byte{ + 0x0a, 0x22, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x66, + 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, + 0x68, 0x74, 0x74, 0x70, 0x5f, 0x66, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x5f, 0x70, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2b, 0x0a, 0x29, 0x46, 0x69, + 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, + 0x46, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x70, 0x0a, 0x2a, 0x46, 0x69, 0x6e, 0x64, 0x41, + 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x46, 0x69, 0x72, + 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x10, 0x66, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, + 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x46, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, + 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x10, 0x66, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, + 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x32, 0xa1, 0x01, 0x0a, 0x19, 0x48, 0x54, + 0x54, 0x50, 0x46, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x83, 0x01, 0x0a, 0x22, 0x66, 0x69, 0x6e, 0x64, + 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x46, 0x69, + 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x2d, + 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x46, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x50, 0x6f, + 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, + 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x48, 0x54, 0x54, 0x50, 0x46, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x50, 0x6f, 0x6c, + 0x69, 0x63, 0x69, 0x65, 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_http_firewall_policy_proto_rawDescOnce sync.Once + file_service_http_firewall_policy_proto_rawDescData = file_service_http_firewall_policy_proto_rawDesc +) + +func file_service_http_firewall_policy_proto_rawDescGZIP() []byte { + file_service_http_firewall_policy_proto_rawDescOnce.Do(func() { + file_service_http_firewall_policy_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_http_firewall_policy_proto_rawDescData) + }) + return file_service_http_firewall_policy_proto_rawDescData +} + +var file_service_http_firewall_policy_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_service_http_firewall_policy_proto_goTypes = []interface{}{ + (*FindAllEnabledHTTPFirewallPoliciesRequest)(nil), // 0: pb.FindAllEnabledHTTPFirewallPoliciesRequest + (*FindAllEnabledHTTPFirewallPoliciesResponse)(nil), // 1: pb.FindAllEnabledHTTPFirewallPoliciesResponse + (*HTTPFirewallPolicy)(nil), // 2: pb.HTTPFirewallPolicy +} +var file_service_http_firewall_policy_proto_depIdxs = []int32{ + 2, // 0: pb.FindAllEnabledHTTPFirewallPoliciesResponse.firewallPolicies:type_name -> pb.HTTPFirewallPolicy + 0, // 1: pb.HTTPFirewallPolicyService.findAllEnabledHTTPFirewallPolicies:input_type -> pb.FindAllEnabledHTTPFirewallPoliciesRequest + 1, // 2: pb.HTTPFirewallPolicyService.findAllEnabledHTTPFirewallPolicies:output_type -> pb.FindAllEnabledHTTPFirewallPoliciesResponse + 2, // [2:3] is the sub-list for method output_type + 1, // [1:2] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_service_http_firewall_policy_proto_init() } +func file_service_http_firewall_policy_proto_init() { + if File_service_http_firewall_policy_proto != nil { + return + } + file_model_http_firewall_policy_proto_init() + if !protoimpl.UnsafeEnabled { + file_service_http_firewall_policy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindAllEnabledHTTPFirewallPoliciesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_http_firewall_policy_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindAllEnabledHTTPFirewallPoliciesResponse); 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_http_firewall_policy_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_http_firewall_policy_proto_goTypes, + DependencyIndexes: file_service_http_firewall_policy_proto_depIdxs, + MessageInfos: file_service_http_firewall_policy_proto_msgTypes, + }.Build() + File_service_http_firewall_policy_proto = out.File + file_service_http_firewall_policy_proto_rawDesc = nil + file_service_http_firewall_policy_proto_goTypes = nil + file_service_http_firewall_policy_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 + +// HTTPFirewallPolicyServiceClient is the client API for HTTPFirewallPolicyService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type HTTPFirewallPolicyServiceClient interface { + // 获取所有可用策略 + FindAllEnabledHTTPFirewallPolicies(ctx context.Context, in *FindAllEnabledHTTPFirewallPoliciesRequest, opts ...grpc.CallOption) (*FindAllEnabledHTTPFirewallPoliciesResponse, error) +} + +type hTTPFirewallPolicyServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewHTTPFirewallPolicyServiceClient(cc grpc.ClientConnInterface) HTTPFirewallPolicyServiceClient { + return &hTTPFirewallPolicyServiceClient{cc} +} + +func (c *hTTPFirewallPolicyServiceClient) FindAllEnabledHTTPFirewallPolicies(ctx context.Context, in *FindAllEnabledHTTPFirewallPoliciesRequest, opts ...grpc.CallOption) (*FindAllEnabledHTTPFirewallPoliciesResponse, error) { + out := new(FindAllEnabledHTTPFirewallPoliciesResponse) + err := c.cc.Invoke(ctx, "/pb.HTTPFirewallPolicyService/findAllEnabledHTTPFirewallPolicies", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// HTTPFirewallPolicyServiceServer is the server API for HTTPFirewallPolicyService service. +type HTTPFirewallPolicyServiceServer interface { + // 获取所有可用策略 + FindAllEnabledHTTPFirewallPolicies(context.Context, *FindAllEnabledHTTPFirewallPoliciesRequest) (*FindAllEnabledHTTPFirewallPoliciesResponse, error) +} + +// UnimplementedHTTPFirewallPolicyServiceServer can be embedded to have forward compatible implementations. +type UnimplementedHTTPFirewallPolicyServiceServer struct { +} + +func (*UnimplementedHTTPFirewallPolicyServiceServer) FindAllEnabledHTTPFirewallPolicies(context.Context, *FindAllEnabledHTTPFirewallPoliciesRequest) (*FindAllEnabledHTTPFirewallPoliciesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindAllEnabledHTTPFirewallPolicies not implemented") +} + +func RegisterHTTPFirewallPolicyServiceServer(s *grpc.Server, srv HTTPFirewallPolicyServiceServer) { + s.RegisterService(&_HTTPFirewallPolicyService_serviceDesc, srv) +} + +func _HTTPFirewallPolicyService_FindAllEnabledHTTPFirewallPolicies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindAllEnabledHTTPFirewallPoliciesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HTTPFirewallPolicyServiceServer).FindAllEnabledHTTPFirewallPolicies(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.HTTPFirewallPolicyService/FindAllEnabledHTTPFirewallPolicies", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HTTPFirewallPolicyServiceServer).FindAllEnabledHTTPFirewallPolicies(ctx, req.(*FindAllEnabledHTTPFirewallPoliciesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _HTTPFirewallPolicyService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pb.HTTPFirewallPolicyService", + HandlerType: (*HTTPFirewallPolicyServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "findAllEnabledHTTPFirewallPolicies", + Handler: _HTTPFirewallPolicyService_FindAllEnabledHTTPFirewallPolicies_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service_http_firewall_policy.proto", +} diff --git a/pkg/rpc/pb/service_http_web.pb.go b/pkg/rpc/pb/service_http_web.pb.go index bcd32d0..c9be3e8 100644 --- a/pkg/rpc/pb/service_http_web.pb.go +++ b/pkg/rpc/pb/service_http_web.pb.go @@ -779,6 +779,62 @@ func (x *UpdateHTTPCacheRequest) GetCacheJSON() []byte { return nil } +// 更改防火墙设置 +type UpdateHTTPFirewallRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WebId int64 `protobuf:"varint,1,opt,name=webId,proto3" json:"webId,omitempty"` + FirewallJSON []byte `protobuf:"bytes,2,opt,name=firewallJSON,proto3" json:"firewallJSON,omitempty"` +} + +func (x *UpdateHTTPFirewallRequest) Reset() { + *x = UpdateHTTPFirewallRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_http_web_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateHTTPFirewallRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateHTTPFirewallRequest) ProtoMessage() {} + +func (x *UpdateHTTPFirewallRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_http_web_proto_msgTypes[14] + 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 UpdateHTTPFirewallRequest.ProtoReflect.Descriptor instead. +func (*UpdateHTTPFirewallRequest) Descriptor() ([]byte, []int) { + return file_service_http_web_proto_rawDescGZIP(), []int{14} +} + +func (x *UpdateHTTPFirewallRequest) GetWebId() int64 { + if x != nil { + return x.WebId + } + return 0 +} + +func (x *UpdateHTTPFirewallRequest) GetFirewallJSON() []byte { + if x != nil { + return x.FirewallJSON + } + return nil +} + var File_service_http_web_proto protoreflect.FileDescriptor var file_service_http_web_proto_rawDesc = []byte{ @@ -852,68 +908,78 @@ var file_service_http_web_proto_rawDesc = []byte{ 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x61, 0x63, 0x68, 0x65, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x61, 0x63, 0x68, 0x65, 0x4a, 0x53, 0x4f, - 0x4e, 0x32, 0xc5, 0x07, 0x0a, 0x0e, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, - 0x54, 0x50, 0x57, 0x65, 0x62, 0x12, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x19, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, - 0x65, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x66, 0x69, - 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, - 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, - 0x64, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, - 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x3f, 0x0a, 0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, - 0x12, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, - 0x57, 0x65, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, + 0x4e, 0x22, 0x55, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x46, + 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, + 0x0a, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x77, + 0x65, 0x62, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x66, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, + 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x66, 0x69, 0x72, 0x65, + 0x77, 0x61, 0x6c, 0x6c, 0x4a, 0x53, 0x4f, 0x4e, 0x32, 0x90, 0x08, 0x0a, 0x0e, 0x48, 0x54, 0x54, + 0x50, 0x57, 0x65, 0x62, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x12, 0x18, 0x2e, 0x70, + 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x53, 0x0a, 0x12, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, + 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, + 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, + 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x12, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x47, 0x0a, 0x11, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x47, 0x7a, 0x69, 0x70, 0x12, 0x1c, 0x2e, 0x70, + 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x47, + 0x7a, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x12, 0x47, 0x0a, 0x11, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, - 0x62, 0x47, 0x7a, 0x69, 0x70, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x47, 0x7a, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x4d, 0x0a, 0x14, 0x75, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x43, 0x68, 0x61, 0x72, 0x73, 0x65, - 0x74, 0x12, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, - 0x50, 0x57, 0x65, 0x62, 0x43, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x65, 0x0a, 0x20, 0x75, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x2b, 0x2e, 0x70, - 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, + 0x12, 0x4d, 0x0a, 0x14, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, + 0x62, 0x43, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x43, 0x68, 0x61, 0x72, 0x73, + 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, + 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, + 0x65, 0x0a, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x12, 0x2b, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, + 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, + 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x67, 0x0a, 0x21, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x2c, 0x2e, 0x70, 0x62, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, - 0x67, 0x0a, 0x21, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x12, 0x2c, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x4f, 0x0a, 0x15, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, + 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x53, 0x68, 0x75, 0x74, 0x64, + 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, + 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x12, 0x49, 0x0a, 0x12, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, + 0x62, 0x50, 0x61, 0x67, 0x65, 0x73, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x50, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x4b, 0x0a, 0x13, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4c, + 0x6f, 0x67, 0x12, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, + 0x54, 0x50, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x4f, 0x0a, 0x15, 0x75, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, - 0x6e, 0x12, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, - 0x50, 0x57, 0x65, 0x62, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x49, 0x0a, 0x12, 0x75, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x50, 0x61, 0x67, 0x65, 0x73, 0x12, - 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, - 0x65, 0x62, 0x50, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, - 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x12, 0x4b, 0x0a, 0x13, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, - 0x54, 0x50, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x6f, 0x67, 0x12, 0x1e, 0x2e, 0x70, 0x62, - 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x41, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, - 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x12, 0x41, 0x0a, 0x0e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x53, - 0x74, 0x61, 0x74, 0x12, 0x19, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, - 0x54, 0x54, 0x50, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, - 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, - 0x63, 0x65, 0x73, 0x73, 0x12, 0x43, 0x0a, 0x0f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, - 0x54, 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, - 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x41, 0x0a, 0x0e, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x53, 0x74, 0x61, 0x74, 0x12, 0x19, 0x2e, 0x70, 0x62, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x43, 0x0a, 0x0f, 0x75, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, 0x12, 0x1a, + 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x43, 0x61, + 0x63, 0x68, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, + 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x12, 0x49, 0x0a, 0x12, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x46, 0x69, + 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x46, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, + 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -928,7 +994,7 @@ func file_service_http_web_proto_rawDescGZIP() []byte { return file_service_http_web_proto_rawDescData } -var file_service_http_web_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_service_http_web_proto_msgTypes = make([]protoimpl.MessageInfo, 15) var file_service_http_web_proto_goTypes = []interface{}{ (*CreateHTTPWebRequest)(nil), // 0: pb.CreateHTTPWebRequest (*CreateHTTPWebResponse)(nil), // 1: pb.CreateHTTPWebResponse @@ -944,11 +1010,12 @@ var file_service_http_web_proto_goTypes = []interface{}{ (*UpdateHTTPAccessLogRequest)(nil), // 11: pb.UpdateHTTPAccessLogRequest (*UpdateHTTPStatRequest)(nil), // 12: pb.UpdateHTTPStatRequest (*UpdateHTTPCacheRequest)(nil), // 13: pb.UpdateHTTPCacheRequest - (*HTTPWeb)(nil), // 14: pb.HTTPWeb - (*RPCUpdateSuccess)(nil), // 15: pb.RPCUpdateSuccess + (*UpdateHTTPFirewallRequest)(nil), // 14: pb.UpdateHTTPFirewallRequest + (*HTTPWeb)(nil), // 15: pb.HTTPWeb + (*RPCUpdateSuccess)(nil), // 16: pb.RPCUpdateSuccess } var file_service_http_web_proto_depIdxs = []int32{ - 14, // 0: pb.FindEnabledHTTPWebResponse.web:type_name -> pb.HTTPWeb + 15, // 0: pb.FindEnabledHTTPWebResponse.web:type_name -> pb.HTTPWeb 0, // 1: pb.HTTPWebService.createHTTPWeb:input_type -> pb.CreateHTTPWebRequest 2, // 2: pb.HTTPWebService.findEnabledHTTPWeb:input_type -> pb.FindEnabledHTTPWebRequest 4, // 3: pb.HTTPWebService.updateHTTPWeb:input_type -> pb.UpdateHTTPWebRequest @@ -961,20 +1028,22 @@ var file_service_http_web_proto_depIdxs = []int32{ 11, // 10: pb.HTTPWebService.updateHTTPAccessLog:input_type -> pb.UpdateHTTPAccessLogRequest 12, // 11: pb.HTTPWebService.updateHTTPStat:input_type -> pb.UpdateHTTPStatRequest 13, // 12: pb.HTTPWebService.updateHTTPCache:input_type -> pb.UpdateHTTPCacheRequest - 1, // 13: pb.HTTPWebService.createHTTPWeb:output_type -> pb.CreateHTTPWebResponse - 3, // 14: pb.HTTPWebService.findEnabledHTTPWeb:output_type -> pb.FindEnabledHTTPWebResponse - 15, // 15: pb.HTTPWebService.updateHTTPWeb:output_type -> pb.RPCUpdateSuccess - 15, // 16: pb.HTTPWebService.updateHTTPWebGzip:output_type -> pb.RPCUpdateSuccess - 15, // 17: pb.HTTPWebService.updateHTTPWebCharset:output_type -> pb.RPCUpdateSuccess - 15, // 18: pb.HTTPWebService.updateHTTPWebRequestHeaderPolicy:output_type -> pb.RPCUpdateSuccess - 15, // 19: pb.HTTPWebService.updateHTTPWebResponseHeaderPolicy:output_type -> pb.RPCUpdateSuccess - 15, // 20: pb.HTTPWebService.updateHTTPWebShutdown:output_type -> pb.RPCUpdateSuccess - 15, // 21: pb.HTTPWebService.updateHTTPWebPages:output_type -> pb.RPCUpdateSuccess - 15, // 22: pb.HTTPWebService.updateHTTPAccessLog:output_type -> pb.RPCUpdateSuccess - 15, // 23: pb.HTTPWebService.updateHTTPStat:output_type -> pb.RPCUpdateSuccess - 15, // 24: pb.HTTPWebService.updateHTTPCache:output_type -> pb.RPCUpdateSuccess - 13, // [13:25] is the sub-list for method output_type - 1, // [1:13] is the sub-list for method input_type + 14, // 13: pb.HTTPWebService.updateHTTPFirewall:input_type -> pb.UpdateHTTPFirewallRequest + 1, // 14: pb.HTTPWebService.createHTTPWeb:output_type -> pb.CreateHTTPWebResponse + 3, // 15: pb.HTTPWebService.findEnabledHTTPWeb:output_type -> pb.FindEnabledHTTPWebResponse + 16, // 16: pb.HTTPWebService.updateHTTPWeb:output_type -> pb.RPCUpdateSuccess + 16, // 17: pb.HTTPWebService.updateHTTPWebGzip:output_type -> pb.RPCUpdateSuccess + 16, // 18: pb.HTTPWebService.updateHTTPWebCharset:output_type -> pb.RPCUpdateSuccess + 16, // 19: pb.HTTPWebService.updateHTTPWebRequestHeaderPolicy:output_type -> pb.RPCUpdateSuccess + 16, // 20: pb.HTTPWebService.updateHTTPWebResponseHeaderPolicy:output_type -> pb.RPCUpdateSuccess + 16, // 21: pb.HTTPWebService.updateHTTPWebShutdown:output_type -> pb.RPCUpdateSuccess + 16, // 22: pb.HTTPWebService.updateHTTPWebPages:output_type -> pb.RPCUpdateSuccess + 16, // 23: pb.HTTPWebService.updateHTTPAccessLog:output_type -> pb.RPCUpdateSuccess + 16, // 24: pb.HTTPWebService.updateHTTPStat:output_type -> pb.RPCUpdateSuccess + 16, // 25: pb.HTTPWebService.updateHTTPCache:output_type -> pb.RPCUpdateSuccess + 16, // 26: pb.HTTPWebService.updateHTTPFirewall:output_type -> pb.RPCUpdateSuccess + 14, // [14:27] is the sub-list for method output_type + 1, // [1:14] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name 1, // [1:1] is the sub-list for extension extendee 0, // [0:1] is the sub-list for field type_name @@ -1156,6 +1225,18 @@ func file_service_http_web_proto_init() { return nil } } + file_service_http_web_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateHTTPFirewallRequest); 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{ @@ -1163,7 +1244,7 @@ func file_service_http_web_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_service_http_web_proto_rawDesc, NumEnums: 0, - NumMessages: 14, + NumMessages: 15, NumExtensions: 0, NumServices: 1, }, @@ -1213,6 +1294,8 @@ type HTTPWebServiceClient interface { UpdateHTTPStat(ctx context.Context, in *UpdateHTTPStatRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) // 更改缓存配置 UpdateHTTPCache(ctx context.Context, in *UpdateHTTPCacheRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) + // 更改防火墙设置 + UpdateHTTPFirewall(ctx context.Context, in *UpdateHTTPFirewallRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) } type hTTPWebServiceClient struct { @@ -1331,6 +1414,15 @@ func (c *hTTPWebServiceClient) UpdateHTTPCache(ctx context.Context, in *UpdateHT return out, nil } +func (c *hTTPWebServiceClient) UpdateHTTPFirewall(ctx context.Context, in *UpdateHTTPFirewallRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) { + out := new(RPCUpdateSuccess) + err := c.cc.Invoke(ctx, "/pb.HTTPWebService/updateHTTPFirewall", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // HTTPWebServiceServer is the server API for HTTPWebService service. type HTTPWebServiceServer interface { // 创建Web配置 @@ -1357,6 +1449,8 @@ type HTTPWebServiceServer interface { UpdateHTTPStat(context.Context, *UpdateHTTPStatRequest) (*RPCUpdateSuccess, error) // 更改缓存配置 UpdateHTTPCache(context.Context, *UpdateHTTPCacheRequest) (*RPCUpdateSuccess, error) + // 更改防火墙设置 + UpdateHTTPFirewall(context.Context, *UpdateHTTPFirewallRequest) (*RPCUpdateSuccess, error) } // UnimplementedHTTPWebServiceServer can be embedded to have forward compatible implementations. @@ -1399,6 +1493,9 @@ func (*UnimplementedHTTPWebServiceServer) UpdateHTTPStat(context.Context, *Updat func (*UnimplementedHTTPWebServiceServer) UpdateHTTPCache(context.Context, *UpdateHTTPCacheRequest) (*RPCUpdateSuccess, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateHTTPCache not implemented") } +func (*UnimplementedHTTPWebServiceServer) UpdateHTTPFirewall(context.Context, *UpdateHTTPFirewallRequest) (*RPCUpdateSuccess, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateHTTPFirewall not implemented") +} func RegisterHTTPWebServiceServer(s *grpc.Server, srv HTTPWebServiceServer) { s.RegisterService(&_HTTPWebService_serviceDesc, srv) @@ -1620,6 +1717,24 @@ func _HTTPWebService_UpdateHTTPCache_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } +func _HTTPWebService_UpdateHTTPFirewall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateHTTPFirewallRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HTTPWebServiceServer).UpdateHTTPFirewall(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.HTTPWebService/UpdateHTTPFirewall", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HTTPWebServiceServer).UpdateHTTPFirewall(ctx, req.(*UpdateHTTPFirewallRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _HTTPWebService_serviceDesc = grpc.ServiceDesc{ ServiceName: "pb.HTTPWebService", HandlerType: (*HTTPWebServiceServer)(nil), @@ -1672,6 +1787,10 @@ var _HTTPWebService_serviceDesc = grpc.ServiceDesc{ MethodName: "updateHTTPCache", Handler: _HTTPWebService_UpdateHTTPCache_Handler, }, + { + MethodName: "updateHTTPFirewall", + Handler: _HTTPWebService_UpdateHTTPFirewall_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "service_http_web.proto", diff --git a/pkg/rpc/protos/model_http_firewall_policy.proto b/pkg/rpc/protos/model_http_firewall_policy.proto new file mode 100644 index 0000000..d777a2c --- /dev/null +++ b/pkg/rpc/protos/model_http_firewall_policy.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +message HTTPFirewallPolicy { + int64 id = 1; + string name = 2; + bool isOn = 3; +} \ No newline at end of file diff --git a/pkg/rpc/protos/service_http_firewall_policy.proto b/pkg/rpc/protos/service_http_firewall_policy.proto new file mode 100644 index 0000000..bc9cefc --- /dev/null +++ b/pkg/rpc/protos/service_http_firewall_policy.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +import "model_http_firewall_policy.proto"; + +service HTTPFirewallPolicyService { + // 获取所有可用策略 + rpc findAllEnabledHTTPFirewallPolicies (FindAllEnabledHTTPFirewallPoliciesRequest) returns (FindAllEnabledHTTPFirewallPoliciesResponse); +} + +// 获取所有可用策略 +message FindAllEnabledHTTPFirewallPoliciesRequest { + +} + +message FindAllEnabledHTTPFirewallPoliciesResponse { + repeated HTTPFirewallPolicy firewallPolicies = 1; +} + diff --git a/pkg/rpc/protos/service_http_web.proto b/pkg/rpc/protos/service_http_web.proto index 50da54e..7a659ae 100644 --- a/pkg/rpc/protos/service_http_web.proto +++ b/pkg/rpc/protos/service_http_web.proto @@ -42,6 +42,9 @@ service HTTPWebService { // 更改缓存配置 rpc updateHTTPCache (UpdateHTTPCacheRequest) returns (RPCUpdateSuccess); + + // 更改防火墙设置 + rpc updateHTTPFirewall (UpdateHTTPFirewallRequest) returns (RPCUpdateSuccess); } // 创建Web配置 @@ -120,4 +123,10 @@ message UpdateHTTPStatRequest { message UpdateHTTPCacheRequest { int64 webId = 1; bytes cacheJSON = 2; +} + +// 更改防火墙设置 +message UpdateHTTPFirewallRequest { + int64 webId = 1; + bytes firewallJSON = 2; } \ No newline at end of file diff --git a/pkg/serverconfigs/http_firewall_ref.go b/pkg/serverconfigs/http_firewall_ref.go new file mode 100644 index 0000000..b0e77c9 --- /dev/null +++ b/pkg/serverconfigs/http_firewall_ref.go @@ -0,0 +1,6 @@ +package serverconfigs + +type HTTPFirewallRef struct { + IsOn bool `yaml:"isOn" json:"isOn"` + FirewallPolicyId int64 `yaml:"firewallPolicyId" json:"firewallPolicyId"` +} diff --git a/pkg/serverconfigs/http_web_config.go b/pkg/serverconfigs/http_web_config.go index af8795d..7e10888 100644 --- a/pkg/serverconfigs/http_web_config.go +++ b/pkg/serverconfigs/http_web_config.go @@ -19,5 +19,6 @@ type HTTPWebConfig struct { ResponseHeaders *shared.HTTPHeaderPolicy `yaml:"responseHeaders" json:"responseHeaders"` // 响应Header` AccessLogRef *HTTPAccessLogRef `yaml:"accessLog" json:"accessLog"` // 访问日志配置 StatRef *HTTPStatRef `yaml:"statRef" json:"statRef"` // 统计配置 - CacheRef *HTTPCacheRef `yaml:"cache" json:"cacheRef"` + CacheRef *HTTPCacheRef `yaml:"cacheRef" json:"cacheRef"` // 缓存配置 + FirewallRef *HTTPFirewallRef `yaml:"firewallRef" json:"firewallRef"` // 防火墙设置 }