From e3c55b5d7ecc0c4274b3214cdf0b2e7c7704f651 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Sun, 20 Sep 2020 16:27:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E4=BF=AE=E6=94=B9=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/rpc/pb/model_http_cache_policy.pb.go | 165 ++++++++ pkg/rpc/pb/model_http_web.pb.go | 39 +- pkg/rpc/pb/service_http_cache_policy.pb.go | 308 +++++++++++++++ pkg/rpc/pb/service_http_web.pb.go | 360 ++++++++++++------ pkg/rpc/protos/model_http_cache_policy.proto | 10 + pkg/rpc/protos/model_http_web.proto | 7 +- .../protos/service_http_cache_policy.proto | 21 + pkg/rpc/protos/service_http_web.proto | 11 +- ...s_log_config.go => http_access_log_ref.go} | 12 +- ...ig_test.go => http_access_log_ref_test.go} | 6 +- pkg/serverconfigs/http_cache_policy.go | 26 +- pkg/serverconfigs/http_cache_ref.go | 6 + pkg/serverconfigs/http_gzip_ref.go | 6 + pkg/serverconfigs/http_stat_config.go | 4 +- pkg/serverconfigs/http_web_config.go | 12 +- 15 files changed, 802 insertions(+), 191 deletions(-) create mode 100644 pkg/rpc/pb/model_http_cache_policy.pb.go create mode 100644 pkg/rpc/pb/service_http_cache_policy.pb.go create mode 100644 pkg/rpc/protos/model_http_cache_policy.proto create mode 100644 pkg/rpc/protos/service_http_cache_policy.proto rename pkg/serverconfigs/{http_access_log_config.go => http_access_log_ref.go} (80%) rename pkg/serverconfigs/{http_access_log_config_test.go => http_access_log_ref_test.go} (88%) create mode 100644 pkg/serverconfigs/http_cache_ref.go create mode 100644 pkg/serverconfigs/http_gzip_ref.go diff --git a/pkg/rpc/pb/model_http_cache_policy.pb.go b/pkg/rpc/pb/model_http_cache_policy.pb.go new file mode 100644 index 0000000..372a287 --- /dev/null +++ b/pkg/rpc/pb/model_http_cache_policy.pb.go @@ -0,0 +1,165 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: model_http_cache_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 HTTPCachePolicy 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 *HTTPCachePolicy) Reset() { + *x = HTTPCachePolicy{} + if protoimpl.UnsafeEnabled { + mi := &file_model_http_cache_policy_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HTTPCachePolicy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HTTPCachePolicy) ProtoMessage() {} + +func (x *HTTPCachePolicy) ProtoReflect() protoreflect.Message { + mi := &file_model_http_cache_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 HTTPCachePolicy.ProtoReflect.Descriptor instead. +func (*HTTPCachePolicy) Descriptor() ([]byte, []int) { + return file_model_http_cache_policy_proto_rawDescGZIP(), []int{0} +} + +func (x *HTTPCachePolicy) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *HTTPCachePolicy) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *HTTPCachePolicy) GetIsOn() bool { + if x != nil { + return x.IsOn + } + return false +} + +var File_model_http_cache_policy_proto protoreflect.FileDescriptor + +var file_model_http_cache_policy_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x63, 0x61, 0x63, + 0x68, 0x65, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x02, 0x70, 0x62, 0x22, 0x49, 0x0a, 0x0f, 0x48, 0x54, 0x54, 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, + 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_cache_policy_proto_rawDescOnce sync.Once + file_model_http_cache_policy_proto_rawDescData = file_model_http_cache_policy_proto_rawDesc +) + +func file_model_http_cache_policy_proto_rawDescGZIP() []byte { + file_model_http_cache_policy_proto_rawDescOnce.Do(func() { + file_model_http_cache_policy_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_http_cache_policy_proto_rawDescData) + }) + return file_model_http_cache_policy_proto_rawDescData +} + +var file_model_http_cache_policy_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_model_http_cache_policy_proto_goTypes = []interface{}{ + (*HTTPCachePolicy)(nil), // 0: pb.HTTPCachePolicy +} +var file_model_http_cache_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_cache_policy_proto_init() } +func file_model_http_cache_policy_proto_init() { + if File_model_http_cache_policy_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_model_http_cache_policy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HTTPCachePolicy); 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_cache_policy_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_model_http_cache_policy_proto_goTypes, + DependencyIndexes: file_model_http_cache_policy_proto_depIdxs, + MessageInfos: file_model_http_cache_policy_proto_msgTypes, + }.Build() + File_model_http_cache_policy_proto = out.File + file_model_http_cache_policy_proto_rawDesc = nil + file_model_http_cache_policy_proto_goTypes = nil + file_model_http_cache_policy_proto_depIdxs = nil +} diff --git a/pkg/rpc/pb/model_http_web.pb.go b/pkg/rpc/pb/model_http_web.pb.go index d814478..dd560db 100644 --- a/pkg/rpc/pb/model_http_web.pb.go +++ b/pkg/rpc/pb/model_http_web.pb.go @@ -33,10 +33,9 @@ type HTTPWeb struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` IsOn bool `protobuf:"varint,2,opt,name=isOn,proto3" json:"isOn,omitempty"` Root string `protobuf:"bytes,3,opt,name=root,proto3" json:"root,omitempty"` - GzipId int64 `protobuf:"varint,4,opt,name=gzipId,proto3" json:"gzipId,omitempty"` - Charset string `protobuf:"bytes,5,opt,name=charset,proto3" json:"charset,omitempty"` - RequestHeaderPolicyId int64 `protobuf:"varint,6,opt,name=requestHeaderPolicyId,proto3" json:"requestHeaderPolicyId,omitempty"` - ResponseHeaderPolicyId int64 `protobuf:"varint,7,opt,name=responseHeaderPolicyId,proto3" json:"responseHeaderPolicyId,omitempty"` + Charset string `protobuf:"bytes,4,opt,name=charset,proto3" json:"charset,omitempty"` + RequestHeaderPolicyId int64 `protobuf:"varint,5,opt,name=requestHeaderPolicyId,proto3" json:"requestHeaderPolicyId,omitempty"` + ResponseHeaderPolicyId int64 `protobuf:"varint,6,opt,name=responseHeaderPolicyId,proto3" json:"responseHeaderPolicyId,omitempty"` } func (x *HTTPWeb) Reset() { @@ -92,13 +91,6 @@ func (x *HTTPWeb) GetRoot() string { return "" } -func (x *HTTPWeb) GetGzipId() int64 { - if x != nil { - return x.GzipId - } - return 0 -} - func (x *HTTPWeb) GetCharset() string { if x != nil { return x.Charset @@ -124,22 +116,21 @@ var File_model_http_web_proto protoreflect.FileDescriptor var file_model_http_web_proto_rawDesc = []byte{ 0x0a, 0x14, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x77, 0x65, 0x62, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xe1, 0x01, 0x0a, 0x07, 0x48, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xc9, 0x01, 0x0a, 0x07, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 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, 0x72, 0x6f, - 0x6f, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x12, 0x16, - 0x0a, 0x06, 0x67, 0x7a, 0x69, 0x70, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, - 0x67, 0x7a, 0x69, 0x70, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, - 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, - 0x12, 0x34, 0x0a, 0x15, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x15, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x16, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x16, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x42, 0x06, - 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x12, 0x18, + 0x0a, 0x07, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x12, 0x34, 0x0a, 0x15, 0x72, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, + 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x15, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x12, 0x36, + 0x0a, 0x16, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x16, + 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, + 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/rpc/pb/service_http_cache_policy.pb.go b/pkg/rpc/pb/service_http_cache_policy.pb.go new file mode 100644 index 0000000..70d74f9 --- /dev/null +++ b/pkg/rpc/pb/service_http_cache_policy.pb.go @@ -0,0 +1,308 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: service_http_cache_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 FindAllEnabledHTTPCachePoliciesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *FindAllEnabledHTTPCachePoliciesRequest) Reset() { + *x = FindAllEnabledHTTPCachePoliciesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_http_cache_policy_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindAllEnabledHTTPCachePoliciesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindAllEnabledHTTPCachePoliciesRequest) ProtoMessage() {} + +func (x *FindAllEnabledHTTPCachePoliciesRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_http_cache_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 FindAllEnabledHTTPCachePoliciesRequest.ProtoReflect.Descriptor instead. +func (*FindAllEnabledHTTPCachePoliciesRequest) Descriptor() ([]byte, []int) { + return file_service_http_cache_policy_proto_rawDescGZIP(), []int{0} +} + +type FindAllEnabledHTTPCachePoliciesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CachePolicies []*HTTPCachePolicy `protobuf:"bytes,1,rep,name=cachePolicies,proto3" json:"cachePolicies,omitempty"` +} + +func (x *FindAllEnabledHTTPCachePoliciesResponse) Reset() { + *x = FindAllEnabledHTTPCachePoliciesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_http_cache_policy_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindAllEnabledHTTPCachePoliciesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindAllEnabledHTTPCachePoliciesResponse) ProtoMessage() {} + +func (x *FindAllEnabledHTTPCachePoliciesResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_http_cache_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 FindAllEnabledHTTPCachePoliciesResponse.ProtoReflect.Descriptor instead. +func (*FindAllEnabledHTTPCachePoliciesResponse) Descriptor() ([]byte, []int) { + return file_service_http_cache_policy_proto_rawDescGZIP(), []int{1} +} + +func (x *FindAllEnabledHTTPCachePoliciesResponse) GetCachePolicies() []*HTTPCachePolicy { + if x != nil { + return x.CachePolicies + } + return nil +} + +var File_service_http_cache_policy_proto protoreflect.FileDescriptor + +var file_service_http_cache_policy_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x63, + 0x61, 0x63, 0x68, 0x65, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x1d, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x68, 0x74, 0x74, + 0x70, 0x5f, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x28, 0x0a, 0x26, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, 0x50, + 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x64, + 0x0a, 0x27, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, + 0x48, 0x54, 0x54, 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x0d, 0x63, 0x61, 0x63, + 0x68, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, 0x50, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0d, 0x63, 0x61, 0x63, 0x68, 0x65, 0x50, 0x6f, 0x6c, 0x69, + 0x63, 0x69, 0x65, 0x73, 0x32, 0x94, 0x01, 0x0a, 0x16, 0x48, 0x54, 0x54, 0x50, 0x43, 0x61, 0x63, + 0x68, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x7a, 0x0a, 0x1f, 0x66, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x48, 0x54, 0x54, 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, + 0x65, 0x73, 0x12, 0x2a, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, 0x50, + 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, + 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, 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_cache_policy_proto_rawDescOnce sync.Once + file_service_http_cache_policy_proto_rawDescData = file_service_http_cache_policy_proto_rawDesc +) + +func file_service_http_cache_policy_proto_rawDescGZIP() []byte { + file_service_http_cache_policy_proto_rawDescOnce.Do(func() { + file_service_http_cache_policy_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_http_cache_policy_proto_rawDescData) + }) + return file_service_http_cache_policy_proto_rawDescData +} + +var file_service_http_cache_policy_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_service_http_cache_policy_proto_goTypes = []interface{}{ + (*FindAllEnabledHTTPCachePoliciesRequest)(nil), // 0: pb.FindAllEnabledHTTPCachePoliciesRequest + (*FindAllEnabledHTTPCachePoliciesResponse)(nil), // 1: pb.FindAllEnabledHTTPCachePoliciesResponse + (*HTTPCachePolicy)(nil), // 2: pb.HTTPCachePolicy +} +var file_service_http_cache_policy_proto_depIdxs = []int32{ + 2, // 0: pb.FindAllEnabledHTTPCachePoliciesResponse.cachePolicies:type_name -> pb.HTTPCachePolicy + 0, // 1: pb.HTTPCachePolicyService.findAllEnabledHTTPCachePolicies:input_type -> pb.FindAllEnabledHTTPCachePoliciesRequest + 1, // 2: pb.HTTPCachePolicyService.findAllEnabledHTTPCachePolicies:output_type -> pb.FindAllEnabledHTTPCachePoliciesResponse + 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_cache_policy_proto_init() } +func file_service_http_cache_policy_proto_init() { + if File_service_http_cache_policy_proto != nil { + return + } + file_model_http_cache_policy_proto_init() + if !protoimpl.UnsafeEnabled { + file_service_http_cache_policy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindAllEnabledHTTPCachePoliciesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_http_cache_policy_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindAllEnabledHTTPCachePoliciesResponse); 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_cache_policy_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_http_cache_policy_proto_goTypes, + DependencyIndexes: file_service_http_cache_policy_proto_depIdxs, + MessageInfos: file_service_http_cache_policy_proto_msgTypes, + }.Build() + File_service_http_cache_policy_proto = out.File + file_service_http_cache_policy_proto_rawDesc = nil + file_service_http_cache_policy_proto_goTypes = nil + file_service_http_cache_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 + +// HTTPCachePolicyServiceClient is the client API for HTTPCachePolicyService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type HTTPCachePolicyServiceClient interface { + // 获取所有可用策略 + FindAllEnabledHTTPCachePolicies(ctx context.Context, in *FindAllEnabledHTTPCachePoliciesRequest, opts ...grpc.CallOption) (*FindAllEnabledHTTPCachePoliciesResponse, error) +} + +type hTTPCachePolicyServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewHTTPCachePolicyServiceClient(cc grpc.ClientConnInterface) HTTPCachePolicyServiceClient { + return &hTTPCachePolicyServiceClient{cc} +} + +func (c *hTTPCachePolicyServiceClient) FindAllEnabledHTTPCachePolicies(ctx context.Context, in *FindAllEnabledHTTPCachePoliciesRequest, opts ...grpc.CallOption) (*FindAllEnabledHTTPCachePoliciesResponse, error) { + out := new(FindAllEnabledHTTPCachePoliciesResponse) + err := c.cc.Invoke(ctx, "/pb.HTTPCachePolicyService/findAllEnabledHTTPCachePolicies", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// HTTPCachePolicyServiceServer is the server API for HTTPCachePolicyService service. +type HTTPCachePolicyServiceServer interface { + // 获取所有可用策略 + FindAllEnabledHTTPCachePolicies(context.Context, *FindAllEnabledHTTPCachePoliciesRequest) (*FindAllEnabledHTTPCachePoliciesResponse, error) +} + +// UnimplementedHTTPCachePolicyServiceServer can be embedded to have forward compatible implementations. +type UnimplementedHTTPCachePolicyServiceServer struct { +} + +func (*UnimplementedHTTPCachePolicyServiceServer) FindAllEnabledHTTPCachePolicies(context.Context, *FindAllEnabledHTTPCachePoliciesRequest) (*FindAllEnabledHTTPCachePoliciesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindAllEnabledHTTPCachePolicies not implemented") +} + +func RegisterHTTPCachePolicyServiceServer(s *grpc.Server, srv HTTPCachePolicyServiceServer) { + s.RegisterService(&_HTTPCachePolicyService_serviceDesc, srv) +} + +func _HTTPCachePolicyService_FindAllEnabledHTTPCachePolicies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindAllEnabledHTTPCachePoliciesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HTTPCachePolicyServiceServer).FindAllEnabledHTTPCachePolicies(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.HTTPCachePolicyService/FindAllEnabledHTTPCachePolicies", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HTTPCachePolicyServiceServer).FindAllEnabledHTTPCachePolicies(ctx, req.(*FindAllEnabledHTTPCachePoliciesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _HTTPCachePolicyService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pb.HTTPCachePolicyService", + HandlerType: (*HTTPCachePolicyServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "findAllEnabledHTTPCachePolicies", + Handler: _HTTPCachePolicyService_FindAllEnabledHTTPCachePolicies_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service_http_cache_policy.proto", +} diff --git a/pkg/rpc/pb/service_http_web.pb.go b/pkg/rpc/pb/service_http_web.pb.go index c7f4e98..bcd32d0 100644 --- a/pkg/rpc/pb/service_http_web.pb.go +++ b/pkg/rpc/pb/service_http_web.pb.go @@ -281,8 +281,8 @@ type UpdateHTTPWebGzipRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - WebId int64 `protobuf:"varint,1,opt,name=webId,proto3" json:"webId,omitempty"` - GzipId int64 `protobuf:"varint,2,opt,name=gzipId,proto3" json:"gzipId,omitempty"` + WebId int64 `protobuf:"varint,1,opt,name=webId,proto3" json:"webId,omitempty"` + GzipJSON []byte `protobuf:"bytes,2,opt,name=gzipJSON,proto3" json:"gzipJSON,omitempty"` } func (x *UpdateHTTPWebGzipRequest) Reset() { @@ -324,11 +324,11 @@ func (x *UpdateHTTPWebGzipRequest) GetWebId() int64 { return 0 } -func (x *UpdateHTTPWebGzipRequest) GetGzipId() int64 { +func (x *UpdateHTTPWebGzipRequest) GetGzipJSON() []byte { if x != nil { - return x.GzipId + return x.GzipJSON } - return 0 + return nil } // 更改字符集配置 @@ -723,6 +723,62 @@ func (x *UpdateHTTPStatRequest) GetStatJSON() []byte { return nil } +// 更改缓存配置 +type UpdateHTTPCacheRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WebId int64 `protobuf:"varint,1,opt,name=webId,proto3" json:"webId,omitempty"` + CacheJSON []byte `protobuf:"bytes,2,opt,name=cacheJSON,proto3" json:"cacheJSON,omitempty"` +} + +func (x *UpdateHTTPCacheRequest) Reset() { + *x = UpdateHTTPCacheRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_http_web_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateHTTPCacheRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateHTTPCacheRequest) ProtoMessage() {} + +func (x *UpdateHTTPCacheRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_http_web_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateHTTPCacheRequest.ProtoReflect.Descriptor instead. +func (*UpdateHTTPCacheRequest) Descriptor() ([]byte, []int) { + return file_service_http_web_proto_rawDescGZIP(), []int{13} +} + +func (x *UpdateHTTPCacheRequest) GetWebId() int64 { + if x != nil { + return x.WebId + } + return 0 +} + +func (x *UpdateHTTPCacheRequest) GetCacheJSON() []byte { + if x != nil { + return x.CacheJSON + } + return nil +} + var File_service_http_web_proto protoreflect.FileDescriptor var file_service_http_web_proto_rawDesc = []byte{ @@ -747,108 +803,117 @@ var file_service_http_web_proto_rawDesc = []byte{ 0x65, 0x62, 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, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, - 0x6f, 0x6f, 0x74, 0x22, 0x48, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, + 0x6f, 0x6f, 0x74, 0x22, 0x4c, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x47, 0x7a, 0x69, 0x70, 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, 0x16, 0x0a, 0x06, 0x67, 0x7a, 0x69, 0x70, 0x49, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x67, 0x7a, 0x69, 0x70, 0x49, 0x64, 0x22, 0x4d, 0x0a, - 0x1b, 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, 0x12, 0x14, 0x0a, 0x05, - 0x77, 0x65, 0x62, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x77, 0x65, 0x62, - 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x22, 0x67, 0x0a, 0x27, - 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, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x12, 0x26, 0x0a, - 0x0e, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x6c, - 0x69, 0x63, 0x79, 0x49, 0x64, 0x22, 0x68, 0x0a, 0x28, 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, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x68, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x0e, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x22, - 0x58, 0x0a, 0x1c, 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, 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, 0x73, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, - 0x6e, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x73, 0x68, 0x75, - 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x4f, 0x0a, 0x19, 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, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, - 0x70, 0x61, 0x67, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x09, 0x70, 0x61, 0x67, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x58, 0x0a, 0x1a, 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, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x65, 0x62, 0x49, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x12, 0x24, - 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x6f, 0x67, 0x4a, 0x53, 0x4f, 0x4e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x6f, 0x67, - 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x49, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, - 0x54, 0x50, 0x53, 0x74, 0x61, 0x74, 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, 0x1a, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x73, 0x74, 0x61, 0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x32, - 0x80, 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, 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, + 0x77, 0x65, 0x62, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x7a, 0x69, 0x70, 0x4a, 0x53, 0x4f, + 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x67, 0x7a, 0x69, 0x70, 0x4a, 0x53, 0x4f, + 0x4e, 0x22, 0x4d, 0x0a, 0x1b, 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, 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, + 0x12, 0x14, 0x0a, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, + 0x22, 0x67, 0x0a, 0x27, 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, 0x12, 0x14, 0x0a, 0x05, 0x77, + 0x65, 0x62, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x77, 0x65, 0x62, 0x49, + 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x68, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x22, 0x68, 0x0a, 0x28, 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, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x68, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x0e, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x49, 0x64, 0x22, 0x58, 0x0a, 0x1c, 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, 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, 0x73, 0x68, 0x75, + 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x0c, 0x73, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x4f, 0x0a, + 0x19, 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, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x65, + 0x62, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, + 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x58, + 0x0a, 0x1a, 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, 0x12, 0x14, 0x0a, 0x05, + 0x77, 0x65, 0x62, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x77, 0x65, 0x62, + 0x49, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x6f, 0x67, 0x4a, + 0x53, 0x4f, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, + 0x73, 0x4c, 0x6f, 0x67, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x49, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x53, 0x74, 0x61, 0x74, 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, 0x1a, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x74, 0x4a, + 0x53, 0x4f, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x73, 0x74, 0x61, 0x74, 0x4a, + 0x53, 0x4f, 0x4e, 0x22, 0x4c, 0x0a, 0x16, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, + 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, 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, 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, + 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, + 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, - 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, + 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, 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, } var ( @@ -863,7 +928,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, 13) +var file_service_http_web_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_service_http_web_proto_goTypes = []interface{}{ (*CreateHTTPWebRequest)(nil), // 0: pb.CreateHTTPWebRequest (*CreateHTTPWebResponse)(nil), // 1: pb.CreateHTTPWebResponse @@ -878,11 +943,12 @@ var file_service_http_web_proto_goTypes = []interface{}{ (*UpdateHTTPWebPagesRequest)(nil), // 10: pb.UpdateHTTPWebPagesRequest (*UpdateHTTPAccessLogRequest)(nil), // 11: pb.UpdateHTTPAccessLogRequest (*UpdateHTTPStatRequest)(nil), // 12: pb.UpdateHTTPStatRequest - (*HTTPWeb)(nil), // 13: pb.HTTPWeb - (*RPCUpdateSuccess)(nil), // 14: pb.RPCUpdateSuccess + (*UpdateHTTPCacheRequest)(nil), // 13: pb.UpdateHTTPCacheRequest + (*HTTPWeb)(nil), // 14: pb.HTTPWeb + (*RPCUpdateSuccess)(nil), // 15: pb.RPCUpdateSuccess } var file_service_http_web_proto_depIdxs = []int32{ - 13, // 0: pb.FindEnabledHTTPWebResponse.web:type_name -> pb.HTTPWeb + 14, // 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 @@ -894,19 +960,21 @@ var file_service_http_web_proto_depIdxs = []int32{ 10, // 9: pb.HTTPWebService.updateHTTPWebPages:input_type -> pb.UpdateHTTPWebPagesRequest 11, // 10: pb.HTTPWebService.updateHTTPAccessLog:input_type -> pb.UpdateHTTPAccessLogRequest 12, // 11: pb.HTTPWebService.updateHTTPStat:input_type -> pb.UpdateHTTPStatRequest - 1, // 12: pb.HTTPWebService.createHTTPWeb:output_type -> pb.CreateHTTPWebResponse - 3, // 13: pb.HTTPWebService.findEnabledHTTPWeb:output_type -> pb.FindEnabledHTTPWebResponse - 14, // 14: pb.HTTPWebService.updateHTTPWeb:output_type -> pb.RPCUpdateSuccess - 14, // 15: pb.HTTPWebService.updateHTTPWebGzip:output_type -> pb.RPCUpdateSuccess - 14, // 16: pb.HTTPWebService.updateHTTPWebCharset:output_type -> pb.RPCUpdateSuccess - 14, // 17: pb.HTTPWebService.updateHTTPWebRequestHeaderPolicy:output_type -> pb.RPCUpdateSuccess - 14, // 18: pb.HTTPWebService.updateHTTPWebResponseHeaderPolicy:output_type -> pb.RPCUpdateSuccess - 14, // 19: pb.HTTPWebService.updateHTTPWebShutdown:output_type -> pb.RPCUpdateSuccess - 14, // 20: pb.HTTPWebService.updateHTTPWebPages:output_type -> pb.RPCUpdateSuccess - 14, // 21: pb.HTTPWebService.updateHTTPAccessLog:output_type -> pb.RPCUpdateSuccess - 14, // 22: pb.HTTPWebService.updateHTTPStat:output_type -> pb.RPCUpdateSuccess - 12, // [12:23] is the sub-list for method output_type - 1, // [1:12] is the sub-list for method input_type + 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 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 @@ -1076,6 +1144,18 @@ func file_service_http_web_proto_init() { return nil } } + file_service_http_web_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateHTTPCacheRequest); 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{ @@ -1083,7 +1163,7 @@ func file_service_http_web_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_service_http_web_proto_rawDesc, NumEnums: 0, - NumMessages: 13, + NumMessages: 14, NumExtensions: 0, NumServices: 1, }, @@ -1131,6 +1211,8 @@ type HTTPWebServiceClient interface { UpdateHTTPAccessLog(ctx context.Context, in *UpdateHTTPAccessLogRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) // 更改统计配置 UpdateHTTPStat(ctx context.Context, in *UpdateHTTPStatRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) + // 更改缓存配置 + UpdateHTTPCache(ctx context.Context, in *UpdateHTTPCacheRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) } type hTTPWebServiceClient struct { @@ -1240,6 +1322,15 @@ func (c *hTTPWebServiceClient) UpdateHTTPStat(ctx context.Context, in *UpdateHTT return out, nil } +func (c *hTTPWebServiceClient) UpdateHTTPCache(ctx context.Context, in *UpdateHTTPCacheRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) { + out := new(RPCUpdateSuccess) + err := c.cc.Invoke(ctx, "/pb.HTTPWebService/updateHTTPCache", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // HTTPWebServiceServer is the server API for HTTPWebService service. type HTTPWebServiceServer interface { // 创建Web配置 @@ -1264,6 +1355,8 @@ type HTTPWebServiceServer interface { UpdateHTTPAccessLog(context.Context, *UpdateHTTPAccessLogRequest) (*RPCUpdateSuccess, error) // 更改统计配置 UpdateHTTPStat(context.Context, *UpdateHTTPStatRequest) (*RPCUpdateSuccess, error) + // 更改缓存配置 + UpdateHTTPCache(context.Context, *UpdateHTTPCacheRequest) (*RPCUpdateSuccess, error) } // UnimplementedHTTPWebServiceServer can be embedded to have forward compatible implementations. @@ -1303,6 +1396,9 @@ func (*UnimplementedHTTPWebServiceServer) UpdateHTTPAccessLog(context.Context, * func (*UnimplementedHTTPWebServiceServer) UpdateHTTPStat(context.Context, *UpdateHTTPStatRequest) (*RPCUpdateSuccess, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateHTTPStat not implemented") } +func (*UnimplementedHTTPWebServiceServer) UpdateHTTPCache(context.Context, *UpdateHTTPCacheRequest) (*RPCUpdateSuccess, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateHTTPCache not implemented") +} func RegisterHTTPWebServiceServer(s *grpc.Server, srv HTTPWebServiceServer) { s.RegisterService(&_HTTPWebService_serviceDesc, srv) @@ -1506,6 +1602,24 @@ func _HTTPWebService_UpdateHTTPStat_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } +func _HTTPWebService_UpdateHTTPCache_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateHTTPCacheRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HTTPWebServiceServer).UpdateHTTPCache(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.HTTPWebService/UpdateHTTPCache", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HTTPWebServiceServer).UpdateHTTPCache(ctx, req.(*UpdateHTTPCacheRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _HTTPWebService_serviceDesc = grpc.ServiceDesc{ ServiceName: "pb.HTTPWebService", HandlerType: (*HTTPWebServiceServer)(nil), @@ -1554,6 +1668,10 @@ var _HTTPWebService_serviceDesc = grpc.ServiceDesc{ MethodName: "updateHTTPStat", Handler: _HTTPWebService_UpdateHTTPStat_Handler, }, + { + MethodName: "updateHTTPCache", + Handler: _HTTPWebService_UpdateHTTPCache_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "service_http_web.proto", diff --git a/pkg/rpc/protos/model_http_cache_policy.proto b/pkg/rpc/protos/model_http_cache_policy.proto new file mode 100644 index 0000000..60ba463 --- /dev/null +++ b/pkg/rpc/protos/model_http_cache_policy.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +message HTTPCachePolicy { + int64 id = 1; + string name = 2; + bool isOn = 3; +} \ No newline at end of file diff --git a/pkg/rpc/protos/model_http_web.proto b/pkg/rpc/protos/model_http_web.proto index 6014f37..4e62f3b 100644 --- a/pkg/rpc/protos/model_http_web.proto +++ b/pkg/rpc/protos/model_http_web.proto @@ -7,8 +7,7 @@ message HTTPWeb { int64 id = 1; bool isOn = 2; string root = 3; - int64 gzipId = 4; - string charset = 5; - int64 requestHeaderPolicyId = 6; - int64 responseHeaderPolicyId = 7; + string charset = 4; + int64 requestHeaderPolicyId = 5; + int64 responseHeaderPolicyId = 6; } \ No newline at end of file diff --git a/pkg/rpc/protos/service_http_cache_policy.proto b/pkg/rpc/protos/service_http_cache_policy.proto new file mode 100644 index 0000000..e968615 --- /dev/null +++ b/pkg/rpc/protos/service_http_cache_policy.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +import "model_http_cache_policy.proto"; + +service HTTPCachePolicyService { + // 获取所有可用策略 + rpc findAllEnabledHTTPCachePolicies (FindAllEnabledHTTPCachePoliciesRequest) returns (FindAllEnabledHTTPCachePoliciesResponse); +} + +// 获取所有可用策略 +message FindAllEnabledHTTPCachePoliciesRequest { + +} + +message FindAllEnabledHTTPCachePoliciesResponse { + repeated HTTPCachePolicy cachePolicies = 1; +} + diff --git a/pkg/rpc/protos/service_http_web.proto b/pkg/rpc/protos/service_http_web.proto index a0e9a40..50da54e 100644 --- a/pkg/rpc/protos/service_http_web.proto +++ b/pkg/rpc/protos/service_http_web.proto @@ -39,6 +39,9 @@ service HTTPWebService { // 更改统计配置 rpc updateHTTPStat (UpdateHTTPStatRequest) returns (RPCUpdateSuccess); + + // 更改缓存配置 + rpc updateHTTPCache (UpdateHTTPCacheRequest) returns (RPCUpdateSuccess); } // 创建Web配置 @@ -68,7 +71,7 @@ message UpdateHTTPWebRequest { // 更改Gzip配置 message UpdateHTTPWebGzipRequest { int64 webId = 1; - int64 gzipId = 2; + bytes gzipJSON = 2; } // 更改字符集配置 @@ -111,4 +114,10 @@ message UpdateHTTPAccessLogRequest { message UpdateHTTPStatRequest { int64 webId = 1; bytes statJSON = 2; +} + +// 更改缓存配置 +message UpdateHTTPCacheRequest { + int64 webId = 1; + bytes cacheJSON = 2; } \ No newline at end of file diff --git a/pkg/serverconfigs/http_access_log_config.go b/pkg/serverconfigs/http_access_log_ref.go similarity index 80% rename from pkg/serverconfigs/http_access_log_config.go rename to pkg/serverconfigs/http_access_log_ref.go index 152cd6c..9efc804 100644 --- a/pkg/serverconfigs/http_access_log_config.go +++ b/pkg/serverconfigs/http_access_log_ref.go @@ -1,7 +1,7 @@ package serverconfigs // 代理访问日志配置 -type HTTPAccessLogConfig struct { +type HTTPAccessLogRef struct { IsOn bool `yaml:"isOn" json:"isOn"` Fields []int `yaml:"fields" json:"fields"` // 记录的字段 @@ -17,8 +17,8 @@ type HTTPAccessLogConfig struct { } // 获取新对象 -func NewHTTPAccessLogConfig() *HTTPAccessLogConfig { - return &HTTPAccessLogConfig{ +func NewHTTPAccessLogRef() *HTTPAccessLogRef { + return &HTTPAccessLogRef{ IsOn: true, Fields: []int{}, Status1: true, @@ -30,12 +30,12 @@ func NewHTTPAccessLogConfig() *HTTPAccessLogConfig { } // 校验 -func (this *HTTPAccessLogConfig) Init() error { +func (this *HTTPAccessLogRef) Init() error { return nil } // 判断是否应该记录 -func (this *HTTPAccessLogConfig) Match(status int) bool { +func (this *HTTPAccessLogRef) Match(status int) bool { s := status / 100 switch s { case 1: @@ -64,7 +64,7 @@ func (this *HTTPAccessLogConfig) Match(status int) bool { } // 是否包含某个存储策略 -func (this *HTTPAccessLogConfig) ContainsStoragePolicy(storagePolicyId int64) bool { +func (this *HTTPAccessLogRef) ContainsStoragePolicy(storagePolicyId int64) bool { for _, s := range this.StoragePolicies { if s == storagePolicyId { return true diff --git a/pkg/serverconfigs/http_access_log_config_test.go b/pkg/serverconfigs/http_access_log_ref_test.go similarity index 88% rename from pkg/serverconfigs/http_access_log_config_test.go rename to pkg/serverconfigs/http_access_log_ref_test.go index a7835c7..0b00785 100644 --- a/pkg/serverconfigs/http_access_log_config_test.go +++ b/pkg/serverconfigs/http_access_log_ref_test.go @@ -9,7 +9,7 @@ func TestHTTPAccessLogConfig_Match(t *testing.T) { a := assert.NewAssertion(t) { - accessLog := NewHTTPAccessLogConfig() + accessLog := NewHTTPAccessLogRef() a.IsNil(accessLog.Init()) a.IsTrue(accessLog.Match(100)) a.IsTrue(accessLog.Match(200)) @@ -19,7 +19,7 @@ func TestHTTPAccessLogConfig_Match(t *testing.T) { } { - accessLog := NewHTTPAccessLogConfig() + accessLog := NewHTTPAccessLogRef() accessLog.Status1 = false accessLog.Status2 = false a.IsNil(accessLog.Init()) @@ -31,7 +31,7 @@ func TestHTTPAccessLogConfig_Match(t *testing.T) { } { - accessLog := NewHTTPAccessLogConfig() + accessLog := NewHTTPAccessLogRef() accessLog.Status3 = false accessLog.Status4 = false accessLog.Status5 = false diff --git a/pkg/serverconfigs/http_cache_policy.go b/pkg/serverconfigs/http_cache_policy.go index 3e696d5..dab6504 100644 --- a/pkg/serverconfigs/http_cache_policy.go +++ b/pkg/serverconfigs/http_cache_policy.go @@ -7,7 +7,6 @@ import ( "github.com/iwind/TeaGo/files" "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/logs" - "strconv" "strings" "time" ) @@ -16,7 +15,7 @@ var DefaultSkippedResponseCacheControlValues = []string{"private", "no-cache", " // 缓存策略配置 type HTTPCachePolicy struct { - Id int `yaml:"id" json:"id"` + Id int64 `yaml:"id" json:"id"` IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启 TODO Name string `yaml:"name" json:"name"` // 名称 @@ -114,29 +113,6 @@ func (this *HTTPCachePolicy) LifeDuration() time.Duration { return this.life } -// 保存 -func (this *HTTPCachePolicy) Save() error { - shared.Locker.Lock() - defer shared.Locker.Unlock() - - filename := "cache.policy." + strconv.Itoa(this.Id) + ".conf" - writer, err := files.NewWriter(Tea.ConfigFile(filename)) - if err != nil { - return err - } - defer func() { - _ = writer.Close() - }() - _, err = writer.WriteYAML(this) - return err -} - -// 删除 -func (this *HTTPCachePolicy) Delete() error { - filename := "cache.policy." + strconv.Itoa(this.Id) + ".conf" - return files.NewFile(Tea.ConfigFile(filename)).Delete() -} - // 是否包含某个Cache-Control值 func (this *HTTPCachePolicy) ContainsCacheControl(value string) bool { return lists.ContainsString(this.uppercaseSkipCacheControlValues, strings.ToUpper(value)) diff --git a/pkg/serverconfigs/http_cache_ref.go b/pkg/serverconfigs/http_cache_ref.go new file mode 100644 index 0000000..532c7b9 --- /dev/null +++ b/pkg/serverconfigs/http_cache_ref.go @@ -0,0 +1,6 @@ +package serverconfigs + +type HTTPCacheRef struct { + IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启 + CachePolicyId int64 `yaml:"cachePolicyId" json:"cachePolicyId"` // 缓存策略ID +} diff --git a/pkg/serverconfigs/http_gzip_ref.go b/pkg/serverconfigs/http_gzip_ref.go new file mode 100644 index 0000000..e994712 --- /dev/null +++ b/pkg/serverconfigs/http_gzip_ref.go @@ -0,0 +1,6 @@ +package serverconfigs + +type HTTPGzipRef struct { + IsOn bool `yaml:"isOn" json:"isOn"` + GzipId int64 `yaml:"gzipId" json:"gzipId"` +} diff --git a/pkg/serverconfigs/http_stat_config.go b/pkg/serverconfigs/http_stat_config.go index e88307a..9301595 100644 --- a/pkg/serverconfigs/http_stat_config.go +++ b/pkg/serverconfigs/http_stat_config.go @@ -1,9 +1,9 @@ package serverconfigs -type HTTPStatConfig struct { +type HTTPStatRef struct { IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启 } -func (this *HTTPStatConfig) Init() error { +func (this *HTTPStatRef) Init() error { return nil } diff --git a/pkg/serverconfigs/http_web_config.go b/pkg/serverconfigs/http_web_config.go index 0426d41..af8795d 100644 --- a/pkg/serverconfigs/http_web_config.go +++ b/pkg/serverconfigs/http_web_config.go @@ -3,9 +3,10 @@ package serverconfigs import "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" type HTTPWebConfig struct { - Id int64 `yaml:"id" json:"id"` // ID - IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用 - Locations []*LocationConfig `yaml:"locations" json:"locations"` // 路径规则 TODO + Id int64 `yaml:"id" json:"id"` // ID + IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用 + Locations []*LocationConfig `yaml:"locations" json:"locations"` // 路径规则 TODO + GzipRef *HTTPGzipRef `yaml:"gzipRef" json:"gzipRef"` Gzip *HTTPGzipConfig `yaml:"gzip" json:"gzip"` // Gzip配置 Charset string `yaml:"charset" json:"charset"` // 字符编码 Shutdown *HTTPShutdownConfig `yaml:"shutdown" json:"shutdown"` // 临时关闭配置 @@ -16,6 +17,7 @@ type HTTPWebConfig struct { MaxRequestBodySize string `yaml:"maxRequestBodySize" json:"maxRequestBodySize"` // 请求body最大尺寸 RequestHeaders *shared.HTTPHeaderPolicy `yaml:"requestHeaders" json:"requestHeaders"` // 请求Header ResponseHeaders *shared.HTTPHeaderPolicy `yaml:"responseHeaders" json:"responseHeaders"` // 响应Header` - AccessLog *HTTPAccessLogConfig `yaml:"accessLog" json:"accessLog"` // 访问日志配置 - Stat *HTTPStatConfig `yaml:"stat" json:"stat"` // 统计配置 + AccessLogRef *HTTPAccessLogRef `yaml:"accessLog" json:"accessLog"` // 访问日志配置 + StatRef *HTTPStatRef `yaml:"statRef" json:"statRef"` // 统计配置 + CacheRef *HTTPCacheRef `yaml:"cache" json:"cacheRef"` }