427 lines
15 KiB
Go
427 lines
15 KiB
Go
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||
// versions:
|
||
// protoc-gen-go v1.36.6
|
||
// protoc (unknown)
|
||
// source: conf/v1/kratos_conf_middleware.proto
|
||
|
||
package v1
|
||
|
||
import (
|
||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||
durationpb "google.golang.org/protobuf/types/known/durationpb"
|
||
reflect "reflect"
|
||
sync "sync"
|
||
unsafe "unsafe"
|
||
)
|
||
|
||
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)
|
||
)
|
||
|
||
// 中间件
|
||
type Middleware struct {
|
||
state protoimpl.MessageState `protogen:"open.v1"`
|
||
Limiter *Middleware_RateLimiter `protobuf:"bytes,1,opt,name=limiter,proto3" json:"limiter,omitempty"`
|
||
Metrics *Middleware_Metrics `protobuf:"bytes,2,opt,name=metrics,proto3" json:"metrics,omitempty"`
|
||
Auth *Middleware_Auth `protobuf:"bytes,3,opt,name=auth,proto3" json:"auth,omitempty"`
|
||
EnableLogging bool `protobuf:"varint,10,opt,name=enable_logging,json=enableLogging,proto3" json:"enable_logging,omitempty"` // 日志开关
|
||
EnableRecovery bool `protobuf:"varint,11,opt,name=enable_recovery,json=enableRecovery,proto3" json:"enable_recovery,omitempty"` // 异常恢复
|
||
EnableTracing bool `protobuf:"varint,12,opt,name=enable_tracing,json=enableTracing,proto3" json:"enable_tracing,omitempty"` // 链路追踪开关
|
||
EnableValidate bool `protobuf:"varint,13,opt,name=enable_validate,json=enableValidate,proto3" json:"enable_validate,omitempty"` // 参数校验开关
|
||
EnableCircuitBreaker bool `protobuf:"varint,14,opt,name=enable_circuit_breaker,json=enableCircuitBreaker,proto3" json:"enable_circuit_breaker,omitempty"` // 熔断器
|
||
EnableMetadata bool `protobuf:"varint,15,opt,name=enable_metadata,json=enableMetadata,proto3" json:"enable_metadata,omitempty"` // 元数据
|
||
unknownFields protoimpl.UnknownFields
|
||
sizeCache protoimpl.SizeCache
|
||
}
|
||
|
||
func (x *Middleware) Reset() {
|
||
*x = Middleware{}
|
||
mi := &file_conf_v1_kratos_conf_middleware_proto_msgTypes[0]
|
||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||
ms.StoreMessageInfo(mi)
|
||
}
|
||
|
||
func (x *Middleware) String() string {
|
||
return protoimpl.X.MessageStringOf(x)
|
||
}
|
||
|
||
func (*Middleware) ProtoMessage() {}
|
||
|
||
func (x *Middleware) ProtoReflect() protoreflect.Message {
|
||
mi := &file_conf_v1_kratos_conf_middleware_proto_msgTypes[0]
|
||
if x != nil {
|
||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||
if ms.LoadMessageInfo() == nil {
|
||
ms.StoreMessageInfo(mi)
|
||
}
|
||
return ms
|
||
}
|
||
return mi.MessageOf(x)
|
||
}
|
||
|
||
// Deprecated: Use Middleware.ProtoReflect.Descriptor instead.
|
||
func (*Middleware) Descriptor() ([]byte, []int) {
|
||
return file_conf_v1_kratos_conf_middleware_proto_rawDescGZIP(), []int{0}
|
||
}
|
||
|
||
func (x *Middleware) GetLimiter() *Middleware_RateLimiter {
|
||
if x != nil {
|
||
return x.Limiter
|
||
}
|
||
return nil
|
||
}
|
||
|
||
func (x *Middleware) GetMetrics() *Middleware_Metrics {
|
||
if x != nil {
|
||
return x.Metrics
|
||
}
|
||
return nil
|
||
}
|
||
|
||
func (x *Middleware) GetAuth() *Middleware_Auth {
|
||
if x != nil {
|
||
return x.Auth
|
||
}
|
||
return nil
|
||
}
|
||
|
||
func (x *Middleware) GetEnableLogging() bool {
|
||
if x != nil {
|
||
return x.EnableLogging
|
||
}
|
||
return false
|
||
}
|
||
|
||
func (x *Middleware) GetEnableRecovery() bool {
|
||
if x != nil {
|
||
return x.EnableRecovery
|
||
}
|
||
return false
|
||
}
|
||
|
||
func (x *Middleware) GetEnableTracing() bool {
|
||
if x != nil {
|
||
return x.EnableTracing
|
||
}
|
||
return false
|
||
}
|
||
|
||
func (x *Middleware) GetEnableValidate() bool {
|
||
if x != nil {
|
||
return x.EnableValidate
|
||
}
|
||
return false
|
||
}
|
||
|
||
func (x *Middleware) GetEnableCircuitBreaker() bool {
|
||
if x != nil {
|
||
return x.EnableCircuitBreaker
|
||
}
|
||
return false
|
||
}
|
||
|
||
func (x *Middleware) GetEnableMetadata() bool {
|
||
if x != nil {
|
||
return x.EnableMetadata
|
||
}
|
||
return false
|
||
}
|
||
|
||
// JWT校验
|
||
type Middleware_Auth struct {
|
||
state protoimpl.MessageState `protogen:"open.v1"`
|
||
Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"` // JWT签名的算法,支持算法:HS256
|
||
Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` // JWT 秘钥
|
||
AccessTokenExpires *durationpb.Duration `protobuf:"bytes,3,opt,name=access_token_expires,json=accessTokenExpires,proto3,oneof" json:"access_token_expires,omitempty"` // 访问令牌过期时间
|
||
RefreshTokenExpires *durationpb.Duration `protobuf:"bytes,4,opt,name=refresh_token_expires,json=refreshTokenExpires,proto3,oneof" json:"refresh_token_expires,omitempty"` // 刷新令牌过期时间
|
||
AccessTokenKeyPrefix *string `protobuf:"bytes,5,opt,name=access_token_key_prefix,json=accessTokenKeyPrefix,proto3,oneof" json:"access_token_key_prefix,omitempty"` // 访问令牌键前缀
|
||
RefreshTokenKeyPrefix *string `protobuf:"bytes,6,opt,name=refresh_token_key_prefix,json=refreshTokenKeyPrefix,proto3,oneof" json:"refresh_token_key_prefix,omitempty"` // 刷新令牌键前缀
|
||
unknownFields protoimpl.UnknownFields
|
||
sizeCache protoimpl.SizeCache
|
||
}
|
||
|
||
func (x *Middleware_Auth) Reset() {
|
||
*x = Middleware_Auth{}
|
||
mi := &file_conf_v1_kratos_conf_middleware_proto_msgTypes[1]
|
||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||
ms.StoreMessageInfo(mi)
|
||
}
|
||
|
||
func (x *Middleware_Auth) String() string {
|
||
return protoimpl.X.MessageStringOf(x)
|
||
}
|
||
|
||
func (*Middleware_Auth) ProtoMessage() {}
|
||
|
||
func (x *Middleware_Auth) ProtoReflect() protoreflect.Message {
|
||
mi := &file_conf_v1_kratos_conf_middleware_proto_msgTypes[1]
|
||
if x != nil {
|
||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||
if ms.LoadMessageInfo() == nil {
|
||
ms.StoreMessageInfo(mi)
|
||
}
|
||
return ms
|
||
}
|
||
return mi.MessageOf(x)
|
||
}
|
||
|
||
// Deprecated: Use Middleware_Auth.ProtoReflect.Descriptor instead.
|
||
func (*Middleware_Auth) Descriptor() ([]byte, []int) {
|
||
return file_conf_v1_kratos_conf_middleware_proto_rawDescGZIP(), []int{0, 0}
|
||
}
|
||
|
||
func (x *Middleware_Auth) GetMethod() string {
|
||
if x != nil {
|
||
return x.Method
|
||
}
|
||
return ""
|
||
}
|
||
|
||
func (x *Middleware_Auth) GetKey() string {
|
||
if x != nil {
|
||
return x.Key
|
||
}
|
||
return ""
|
||
}
|
||
|
||
func (x *Middleware_Auth) GetAccessTokenExpires() *durationpb.Duration {
|
||
if x != nil {
|
||
return x.AccessTokenExpires
|
||
}
|
||
return nil
|
||
}
|
||
|
||
func (x *Middleware_Auth) GetRefreshTokenExpires() *durationpb.Duration {
|
||
if x != nil {
|
||
return x.RefreshTokenExpires
|
||
}
|
||
return nil
|
||
}
|
||
|
||
func (x *Middleware_Auth) GetAccessTokenKeyPrefix() string {
|
||
if x != nil && x.AccessTokenKeyPrefix != nil {
|
||
return *x.AccessTokenKeyPrefix
|
||
}
|
||
return ""
|
||
}
|
||
|
||
func (x *Middleware_Auth) GetRefreshTokenKeyPrefix() string {
|
||
if x != nil && x.RefreshTokenKeyPrefix != nil {
|
||
return *x.RefreshTokenKeyPrefix
|
||
}
|
||
return ""
|
||
}
|
||
|
||
// 限流器
|
||
type Middleware_RateLimiter struct {
|
||
state protoimpl.MessageState `protogen:"open.v1"`
|
||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // 限流器名字,支持:bbr。
|
||
unknownFields protoimpl.UnknownFields
|
||
sizeCache protoimpl.SizeCache
|
||
}
|
||
|
||
func (x *Middleware_RateLimiter) Reset() {
|
||
*x = Middleware_RateLimiter{}
|
||
mi := &file_conf_v1_kratos_conf_middleware_proto_msgTypes[2]
|
||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||
ms.StoreMessageInfo(mi)
|
||
}
|
||
|
||
func (x *Middleware_RateLimiter) String() string {
|
||
return protoimpl.X.MessageStringOf(x)
|
||
}
|
||
|
||
func (*Middleware_RateLimiter) ProtoMessage() {}
|
||
|
||
func (x *Middleware_RateLimiter) ProtoReflect() protoreflect.Message {
|
||
mi := &file_conf_v1_kratos_conf_middleware_proto_msgTypes[2]
|
||
if x != nil {
|
||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||
if ms.LoadMessageInfo() == nil {
|
||
ms.StoreMessageInfo(mi)
|
||
}
|
||
return ms
|
||
}
|
||
return mi.MessageOf(x)
|
||
}
|
||
|
||
// Deprecated: Use Middleware_RateLimiter.ProtoReflect.Descriptor instead.
|
||
func (*Middleware_RateLimiter) Descriptor() ([]byte, []int) {
|
||
return file_conf_v1_kratos_conf_middleware_proto_rawDescGZIP(), []int{0, 1}
|
||
}
|
||
|
||
func (x *Middleware_RateLimiter) GetName() string {
|
||
if x != nil {
|
||
return x.Name
|
||
}
|
||
return ""
|
||
}
|
||
|
||
// 性能指标
|
||
type Middleware_Metrics struct {
|
||
state protoimpl.MessageState `protogen:"open.v1"`
|
||
Histogram bool `protobuf:"varint,1,opt,name=histogram,proto3" json:"histogram,omitempty"` // 直方图
|
||
Counter bool `protobuf:"varint,2,opt,name=counter,proto3" json:"counter,omitempty"` // 计数器
|
||
Gauge bool `protobuf:"varint,3,opt,name=gauge,proto3" json:"gauge,omitempty"` // 仪表盘
|
||
Summary bool `protobuf:"varint,4,opt,name=summary,proto3" json:"summary,omitempty"` // 摘要
|
||
unknownFields protoimpl.UnknownFields
|
||
sizeCache protoimpl.SizeCache
|
||
}
|
||
|
||
func (x *Middleware_Metrics) Reset() {
|
||
*x = Middleware_Metrics{}
|
||
mi := &file_conf_v1_kratos_conf_middleware_proto_msgTypes[3]
|
||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||
ms.StoreMessageInfo(mi)
|
||
}
|
||
|
||
func (x *Middleware_Metrics) String() string {
|
||
return protoimpl.X.MessageStringOf(x)
|
||
}
|
||
|
||
func (*Middleware_Metrics) ProtoMessage() {}
|
||
|
||
func (x *Middleware_Metrics) ProtoReflect() protoreflect.Message {
|
||
mi := &file_conf_v1_kratos_conf_middleware_proto_msgTypes[3]
|
||
if x != nil {
|
||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||
if ms.LoadMessageInfo() == nil {
|
||
ms.StoreMessageInfo(mi)
|
||
}
|
||
return ms
|
||
}
|
||
return mi.MessageOf(x)
|
||
}
|
||
|
||
// Deprecated: Use Middleware_Metrics.ProtoReflect.Descriptor instead.
|
||
func (*Middleware_Metrics) Descriptor() ([]byte, []int) {
|
||
return file_conf_v1_kratos_conf_middleware_proto_rawDescGZIP(), []int{0, 2}
|
||
}
|
||
|
||
func (x *Middleware_Metrics) GetHistogram() bool {
|
||
if x != nil {
|
||
return x.Histogram
|
||
}
|
||
return false
|
||
}
|
||
|
||
func (x *Middleware_Metrics) GetCounter() bool {
|
||
if x != nil {
|
||
return x.Counter
|
||
}
|
||
return false
|
||
}
|
||
|
||
func (x *Middleware_Metrics) GetGauge() bool {
|
||
if x != nil {
|
||
return x.Gauge
|
||
}
|
||
return false
|
||
}
|
||
|
||
func (x *Middleware_Metrics) GetSummary() bool {
|
||
if x != nil {
|
||
return x.Summary
|
||
}
|
||
return false
|
||
}
|
||
|
||
var File_conf_v1_kratos_conf_middleware_proto protoreflect.FileDescriptor
|
||
|
||
const file_conf_v1_kratos_conf_middleware_proto_rawDesc = "" +
|
||
"\n" +
|
||
"$conf/v1/kratos_conf_middleware.proto\x12\x04conf\x1a\x1egoogle/protobuf/duration.proto\"\xf7\a\n" +
|
||
"\n" +
|
||
"Middleware\x126\n" +
|
||
"\alimiter\x18\x01 \x01(\v2\x1c.conf.Middleware.RateLimiterR\alimiter\x122\n" +
|
||
"\ametrics\x18\x02 \x01(\v2\x18.conf.Middleware.MetricsR\ametrics\x12)\n" +
|
||
"\x04auth\x18\x03 \x01(\v2\x15.conf.Middleware.AuthR\x04auth\x12%\n" +
|
||
"\x0eenable_logging\x18\n" +
|
||
" \x01(\bR\renableLogging\x12'\n" +
|
||
"\x0fenable_recovery\x18\v \x01(\bR\x0eenableRecovery\x12%\n" +
|
||
"\x0eenable_tracing\x18\f \x01(\bR\renableTracing\x12'\n" +
|
||
"\x0fenable_validate\x18\r \x01(\bR\x0eenableValidate\x124\n" +
|
||
"\x16enable_circuit_breaker\x18\x0e \x01(\bR\x14enableCircuitBreaker\x12'\n" +
|
||
"\x0fenable_metadata\x18\x0f \x01(\bR\x0eenableMetadata\x1a\xbc\x03\n" +
|
||
"\x04Auth\x12\x16\n" +
|
||
"\x06method\x18\x01 \x01(\tR\x06method\x12\x10\n" +
|
||
"\x03key\x18\x02 \x01(\tR\x03key\x12P\n" +
|
||
"\x14access_token_expires\x18\x03 \x01(\v2\x19.google.protobuf.DurationH\x00R\x12accessTokenExpires\x88\x01\x01\x12R\n" +
|
||
"\x15refresh_token_expires\x18\x04 \x01(\v2\x19.google.protobuf.DurationH\x01R\x13refreshTokenExpires\x88\x01\x01\x12:\n" +
|
||
"\x17access_token_key_prefix\x18\x05 \x01(\tH\x02R\x14accessTokenKeyPrefix\x88\x01\x01\x12<\n" +
|
||
"\x18refresh_token_key_prefix\x18\x06 \x01(\tH\x03R\x15refreshTokenKeyPrefix\x88\x01\x01B\x17\n" +
|
||
"\x15_access_token_expiresB\x18\n" +
|
||
"\x16_refresh_token_expiresB\x1a\n" +
|
||
"\x18_access_token_key_prefixB\x1b\n" +
|
||
"\x19_refresh_token_key_prefix\x1a!\n" +
|
||
"\vRateLimiter\x12\x12\n" +
|
||
"\x04name\x18\x01 \x01(\tR\x04name\x1aq\n" +
|
||
"\aMetrics\x12\x1c\n" +
|
||
"\thistogram\x18\x01 \x01(\bR\thistogram\x12\x18\n" +
|
||
"\acounter\x18\x02 \x01(\bR\acounter\x12\x14\n" +
|
||
"\x05gauge\x18\x03 \x01(\bR\x05gauge\x12\x18\n" +
|
||
"\asummary\x18\x04 \x01(\bR\asummaryB\x8b\x01\n" +
|
||
"\bcom.confB\x19KratosConfMiddlewareProtoP\x01Z4github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1\xa2\x02\x03CXX\xaa\x02\x04Conf\xca\x02\x04Conf\xe2\x02\x10Conf\\GPBMetadata\xea\x02\x04Confb\x06proto3"
|
||
|
||
var (
|
||
file_conf_v1_kratos_conf_middleware_proto_rawDescOnce sync.Once
|
||
file_conf_v1_kratos_conf_middleware_proto_rawDescData []byte
|
||
)
|
||
|
||
func file_conf_v1_kratos_conf_middleware_proto_rawDescGZIP() []byte {
|
||
file_conf_v1_kratos_conf_middleware_proto_rawDescOnce.Do(func() {
|
||
file_conf_v1_kratos_conf_middleware_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_conf_v1_kratos_conf_middleware_proto_rawDesc), len(file_conf_v1_kratos_conf_middleware_proto_rawDesc)))
|
||
})
|
||
return file_conf_v1_kratos_conf_middleware_proto_rawDescData
|
||
}
|
||
|
||
var file_conf_v1_kratos_conf_middleware_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||
var file_conf_v1_kratos_conf_middleware_proto_goTypes = []any{
|
||
(*Middleware)(nil), // 0: conf.Middleware
|
||
(*Middleware_Auth)(nil), // 1: conf.Middleware.Auth
|
||
(*Middleware_RateLimiter)(nil), // 2: conf.Middleware.RateLimiter
|
||
(*Middleware_Metrics)(nil), // 3: conf.Middleware.Metrics
|
||
(*durationpb.Duration)(nil), // 4: google.protobuf.Duration
|
||
}
|
||
var file_conf_v1_kratos_conf_middleware_proto_depIdxs = []int32{
|
||
2, // 0: conf.Middleware.limiter:type_name -> conf.Middleware.RateLimiter
|
||
3, // 1: conf.Middleware.metrics:type_name -> conf.Middleware.Metrics
|
||
1, // 2: conf.Middleware.auth:type_name -> conf.Middleware.Auth
|
||
4, // 3: conf.Middleware.Auth.access_token_expires:type_name -> google.protobuf.Duration
|
||
4, // 4: conf.Middleware.Auth.refresh_token_expires:type_name -> google.protobuf.Duration
|
||
5, // [5:5] is the sub-list for method output_type
|
||
5, // [5:5] is the sub-list for method input_type
|
||
5, // [5:5] is the sub-list for extension type_name
|
||
5, // [5:5] is the sub-list for extension extendee
|
||
0, // [0:5] is the sub-list for field type_name
|
||
}
|
||
|
||
func init() { file_conf_v1_kratos_conf_middleware_proto_init() }
|
||
func file_conf_v1_kratos_conf_middleware_proto_init() {
|
||
if File_conf_v1_kratos_conf_middleware_proto != nil {
|
||
return
|
||
}
|
||
file_conf_v1_kratos_conf_middleware_proto_msgTypes[1].OneofWrappers = []any{}
|
||
type x struct{}
|
||
out := protoimpl.TypeBuilder{
|
||
File: protoimpl.DescBuilder{
|
||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_conf_v1_kratos_conf_middleware_proto_rawDesc), len(file_conf_v1_kratos_conf_middleware_proto_rawDesc)),
|
||
NumEnums: 0,
|
||
NumMessages: 4,
|
||
NumExtensions: 0,
|
||
NumServices: 0,
|
||
},
|
||
GoTypes: file_conf_v1_kratos_conf_middleware_proto_goTypes,
|
||
DependencyIndexes: file_conf_v1_kratos_conf_middleware_proto_depIdxs,
|
||
MessageInfos: file_conf_v1_kratos_conf_middleware_proto_msgTypes,
|
||
}.Build()
|
||
File_conf_v1_kratos_conf_middleware_proto = out.File
|
||
file_conf_v1_kratos_conf_middleware_proto_goTypes = nil
|
||
file_conf_v1_kratos_conf_middleware_proto_depIdxs = nil
|
||
}
|