diff --git a/pkg/rpc/pb/model_server_daily_stat.pb.go b/pkg/rpc/pb/model_server_daily_stat.pb.go index 41e05d3..3595c4a 100644 --- a/pkg/rpc/pb/model_server_daily_stat.pb.go +++ b/pkg/rpc/pb/model_server_daily_stat.pb.go @@ -31,15 +31,16 @@ type ServerDailyStat struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ServerId int64 `protobuf:"varint,1,opt,name=serverId,proto3" json:"serverId,omitempty"` - RegionId int64 `protobuf:"varint,2,opt,name=regionId,proto3" json:"regionId,omitempty"` - Bytes int64 `protobuf:"varint,3,opt,name=bytes,proto3" json:"bytes,omitempty"` - CachedBytes int64 `protobuf:"varint,5,opt,name=cachedBytes,proto3" json:"cachedBytes,omitempty"` - CountRequests int64 `protobuf:"varint,6,opt,name=countRequests,proto3" json:"countRequests,omitempty"` - CountCachedRequests int64 `protobuf:"varint,7,opt,name=countCachedRequests,proto3" json:"countCachedRequests,omitempty"` - CreatedAt int64 `protobuf:"varint,4,opt,name=createdAt,proto3" json:"createdAt,omitempty"` - CountAttackRequests int64 `protobuf:"varint,8,opt,name=countAttackRequests,proto3" json:"countAttackRequests,omitempty"` - AttackBytes int64 `protobuf:"varint,9,opt,name=attackBytes,proto3" json:"attackBytes,omitempty"` + ServerId int64 `protobuf:"varint,1,opt,name=serverId,proto3" json:"serverId,omitempty"` + RegionId int64 `protobuf:"varint,2,opt,name=regionId,proto3" json:"regionId,omitempty"` + Bytes int64 `protobuf:"varint,3,opt,name=bytes,proto3" json:"bytes,omitempty"` + CachedBytes int64 `protobuf:"varint,5,opt,name=cachedBytes,proto3" json:"cachedBytes,omitempty"` + CountRequests int64 `protobuf:"varint,6,opt,name=countRequests,proto3" json:"countRequests,omitempty"` + CountCachedRequests int64 `protobuf:"varint,7,opt,name=countCachedRequests,proto3" json:"countCachedRequests,omitempty"` + CreatedAt int64 `protobuf:"varint,4,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + CountAttackRequests int64 `protobuf:"varint,8,opt,name=countAttackRequests,proto3" json:"countAttackRequests,omitempty"` + AttackBytes int64 `protobuf:"varint,9,opt,name=attackBytes,proto3" json:"attackBytes,omitempty"` + CheckTrafficLimiting bool `protobuf:"varint,10,opt,name=checkTrafficLimiting,proto3" json:"checkTrafficLimiting,omitempty"` } func (x *ServerDailyStat) Reset() { @@ -137,12 +138,19 @@ func (x *ServerDailyStat) GetAttackBytes() int64 { return 0 } +func (x *ServerDailyStat) GetCheckTrafficLimiting() bool { + if x != nil { + return x.CheckTrafficLimiting + } + return false +} + var File_models_model_server_daily_stat_proto protoreflect.FileDescriptor var file_models_model_server_daily_stat_proto_rawDesc = []byte{ 0x0a, 0x24, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x64, 0x61, 0x69, 0x6c, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xcb, 0x02, 0x0a, 0x0f, 0x53, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xff, 0x02, 0x0a, 0x0f, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, @@ -163,8 +171,11 @@ var file_models_model_server_daily_stat_proto_rawDesc = []byte{ 0x03, 0x52, 0x13, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x61, 0x74, 0x74, - 0x61, 0x63, 0x6b, 0x42, 0x79, 0x74, 0x65, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x63, 0x6b, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x14, 0x63, 0x68, 0x65, 0x63, + 0x6b, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x6e, 0x67, + 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x72, 0x61, + 0x66, 0x66, 0x69, 0x63, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x42, 0x06, 0x5a, 0x04, + 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/rpc/protos/models/model_server_daily_stat.proto b/pkg/rpc/protos/models/model_server_daily_stat.proto index 7344bc0..d9d8120 100644 --- a/pkg/rpc/protos/models/model_server_daily_stat.proto +++ b/pkg/rpc/protos/models/model_server_daily_stat.proto @@ -14,4 +14,5 @@ message ServerDailyStat { int64 createdAt = 4; int64 countAttackRequests = 8; int64 attackBytes = 9; + bool checkTrafficLimiting = 10; } diff --git a/pkg/serverconfigs/server_config.go b/pkg/serverconfigs/server_config.go index 3c3c487..8df1aa6 100644 --- a/pkg/serverconfigs/server_config.go +++ b/pkg/serverconfigs/server_config.go @@ -363,3 +363,8 @@ func (this *ServerConfig) FindAndCheckReverseProxy(dataType string) (*ReversePro return nil, errors.New("invalid data type:'" + dataType + "'") } } + +// ShouldCheckTrafficLimit 检查是否需要检查流量限制 +func (this *ServerConfig) ShouldCheckTrafficLimit() bool { + return this.TrafficLimit != nil && !this.TrafficLimit.IsEmpty() +}