Compare commits
7 Commits
database/m
...
api/v0.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e4e56bc2d | ||
|
|
411aabf0fa | ||
|
|
46bffc550a | ||
|
|
3f27534f13 | ||
|
|
8a4eb0c479 | ||
|
|
0b7e6265f4 | ||
|
|
b54b4252d9 |
@@ -9,7 +9,7 @@ package v1
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
_ "google.golang.org/protobuf/types/known/durationpb"
|
||||
durationpb "google.golang.org/protobuf/types/known/durationpb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
@@ -133,11 +133,15 @@ func (x *Middleware) GetEnableMetadata() bool {
|
||||
|
||||
// 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 秘钥
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
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() {
|
||||
@@ -184,6 +188,34 @@ func (x *Middleware_Auth) GetKey() string {
|
||||
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"`
|
||||
@@ -305,7 +337,7 @@ var file_conf_v1_kratos_conf_middleware_proto_rawDesc = string([]byte{
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x1a, 0x1e, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75,
|
||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xea, 0x04, 0x0a,
|
||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf7, 0x07, 0x0a,
|
||||
0x0a, 0x4d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x6c,
|
||||
0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x2e, 0x4d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x2e, 0x52,
|
||||
@@ -332,28 +364,53 @@ var file_conf_v1_kratos_conf_middleware_proto_rawDesc = string([]byte{
|
||||
0x74, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x6e, 0x61, 0x62,
|
||||
0x6c, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0f, 0x20, 0x01, 0x28,
|
||||
0x08, 0x52, 0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
|
||||
0x61, 0x1a, 0x30, 0x0a, 0x04, 0x41, 0x75, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74,
|
||||
0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f,
|
||||
0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
||||
0x6b, 0x65, 0x79, 0x1a, 0x21, 0x0a, 0x0b, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74,
|
||||
0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x1a, 0x71, 0x0a, 0x07, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63,
|
||||
0x73, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08,
|
||||
0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x61, 0x75,
|
||||
0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x67, 0x61, 0x75, 0x67, 0x65, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08,
|
||||
0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x42, 0x8b, 0x01, 0x0a, 0x08, 0x63, 0x6f,
|
||||
0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x19, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f,
|
||||
0x6e, 0x66, 0x4d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
|
||||
0x74, 0x78, 0x37, 0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d, 0x62, 0x6f, 0x6f,
|
||||
0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67,
|
||||
0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, 0xaa,
|
||||
0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xca, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xe2, 0x02, 0x10,
|
||||
0x43, 0x6f, 0x6e, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
|
||||
0xea, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x61, 0x1a, 0xbc, 0x03, 0x0a, 0x04, 0x41, 0x75, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65,
|
||||
0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68,
|
||||
0x6f, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x03, 0x6b, 0x65, 0x79, 0x12, 0x50, 0x0a, 0x14, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74,
|
||||
0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52,
|
||||
0x12, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x45, 0x78, 0x70, 0x69,
|
||||
0x72, 0x65, 0x73, 0x88, 0x01, 0x01, 0x12, 0x52, 0x0a, 0x15, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73,
|
||||
0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x18,
|
||||
0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x48, 0x01, 0x52, 0x13, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
|
||||
0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x88, 0x01, 0x01, 0x12, 0x3a, 0x0a, 0x17, 0x61, 0x63,
|
||||
0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x70,
|
||||
0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x14, 0x61,
|
||||
0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x65,
|
||||
0x66, 0x69, 0x78, 0x88, 0x01, 0x01, 0x12, 0x3c, 0x0a, 0x18, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73,
|
||||
0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x72, 0x65, 0x66,
|
||||
0x69, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x15, 0x72, 0x65, 0x66, 0x72,
|
||||
0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x65, 0x66, 0x69,
|
||||
0x78, 0x88, 0x01, 0x01, 0x42, 0x17, 0x0a, 0x15, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f,
|
||||
0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x42, 0x18, 0x0a,
|
||||
0x16, 0x5f, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f,
|
||||
0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x42, 0x1a, 0x0a, 0x18, 0x5f, 0x61, 0x63, 0x63, 0x65,
|
||||
0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x72, 0x65,
|
||||
0x66, 0x69, 0x78, 0x42, 0x1b, 0x0a, 0x19, 0x5f, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x5f,
|
||||
0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78,
|
||||
0x1a, 0x21, 0x0a, 0x0b, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
|
||||
0x61, 0x6d, 0x65, 0x1a, 0x71, 0x0a, 0x07, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x1c,
|
||||
0x0a, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x08, 0x52, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x12, 0x18, 0x0a, 0x07,
|
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x61, 0x75, 0x67, 0x65, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x67, 0x61, 0x75, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07,
|
||||
0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73,
|
||||
0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x42, 0x8b, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x42, 0x19, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x4d,
|
||||
0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
|
||||
0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x78, 0x37,
|
||||
0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74,
|
||||
0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, 0xaa, 0x02, 0x04, 0x43,
|
||||
0x6f, 0x6e, 0x66, 0xca, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xe2, 0x02, 0x10, 0x43, 0x6f, 0x6e,
|
||||
0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x04,
|
||||
0x43, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
})
|
||||
|
||||
var (
|
||||
@@ -374,16 +431,19 @@ var file_conf_v1_kratos_conf_middleware_proto_goTypes = []any{
|
||||
(*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
|
||||
3, // [3:3] is the sub-list for method output_type
|
||||
3, // [3:3] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
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() }
|
||||
@@ -391,6 +451,7 @@ 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{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -40,6 +40,7 @@ type PagingRequest struct {
|
||||
NoPaging *bool `protobuf:"varint,6,opt,name=no_paging,json=noPaging,proto3,oneof" json:"no_paging,omitempty"`
|
||||
// 字段掩码,其作用为SELECT中的字段,其语法为使用逗号分隔字段名,例如:id,realName,userName。如果为空则选中所有字段,即SELECT *。
|
||||
FieldMask *fieldmaskpb.FieldMask `protobuf:"bytes,7,opt,name=field_mask,json=fieldMask,proto3,oneof" json:"field_mask,omitempty"`
|
||||
TenantId *uint32 `protobuf:"varint,8,opt,name=tenant_id,json=tenantId,proto3,oneof" json:"tenant_id,omitempty"` // 租户ID
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@@ -123,6 +124,13 @@ func (x *PagingRequest) GetFieldMask() *fieldmaskpb.FieldMask {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *PagingRequest) GetTenantId() uint32 {
|
||||
if x != nil && x.TenantId != nil {
|
||||
return *x.TenantId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 分页通用结果
|
||||
type PagingResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
@@ -188,7 +196,7 @@ var file_pagination_v1_pagination_proto_rawDesc = string([]byte{
|
||||
0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24,
|
||||
0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2f,
|
||||
0x76, 0x33, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd5, 0x08, 0x0a, 0x0d, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x52,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x22, 0x95, 0x09, 0x0a, 0x0d, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x05, 0x42, 0x1e, 0xba, 0x47, 0x1b, 0x8a, 0x02, 0x09, 0x09, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xf0, 0x3f, 0x92, 0x02, 0x0c, 0xe5, 0xbd, 0x93, 0xe5, 0x89, 0x8d, 0xe9, 0xa1,
|
||||
@@ -253,11 +261,15 @@ var file_pagination_v1_pagination_proto_rawDesc = string([]byte{
|
||||
0x89, 0xe4, 0xb8, 0xad, 0xe6, 0x89, 0x80, 0xe6, 0x9c, 0x89, 0xe5, 0xad, 0x97, 0xe6, 0xae, 0xb5,
|
||||
0xef, 0xbc, 0x8c, 0xe5, 0x8d, 0xb3, 0x53, 0x45, 0x4c, 0x45, 0x43, 0x54, 0x20, 0x2a, 0xe3, 0x80,
|
||||
0x82, 0x48, 0x05, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x88, 0x01,
|
||||
0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x70,
|
||||
0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x71, 0x75, 0x65,
|
||||
0x72, 0x79, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6f, 0x72, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x42,
|
||||
0x0c, 0x0a, 0x0a, 0x5f, 0x6e, 0x6f, 0x5f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x42, 0x0d, 0x0a,
|
||||
0x0b, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x22, 0x3c, 0x0a, 0x0e,
|
||||
0x01, 0x12, 0x30, 0x0a, 0x09, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x08,
|
||||
0x20, 0x01, 0x28, 0x0d, 0x42, 0x0e, 0xba, 0x47, 0x0b, 0x92, 0x02, 0x08, 0xe7, 0xa7, 0x9f, 0xe6,
|
||||
0x88, 0xb7, 0x49, 0x44, 0x48, 0x06, 0x52, 0x08, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x49, 0x64,
|
||||
0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x42, 0x0c, 0x0a, 0x0a,
|
||||
0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x71,
|
||||
0x75, 0x65, 0x72, 0x79, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6f, 0x72, 0x5f, 0x71, 0x75, 0x65, 0x72,
|
||||
0x79, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x6e, 0x6f, 0x5f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x42,
|
||||
0x0d, 0x0a, 0x0b, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x42, 0x0c,
|
||||
0x0a, 0x0a, 0x5f, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x22, 0x3c, 0x0a, 0x0e,
|
||||
0x50, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14,
|
||||
0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x74,
|
||||
0x6f, 0x74, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20,
|
||||
|
||||
@@ -12,6 +12,12 @@ message Middleware {
|
||||
message Auth {
|
||||
string method = 1; // JWT签名的算法,支持算法:HS256
|
||||
string key = 2; // JWT 秘钥
|
||||
|
||||
optional google.protobuf.Duration access_token_expires = 3; // 访问令牌过期时间
|
||||
optional google.protobuf.Duration refresh_token_expires = 4; // 刷新令牌过期时间
|
||||
|
||||
optional string access_token_key_prefix = 5; // 访问令牌键前缀
|
||||
optional string refresh_token_key_prefix = 6; // 刷新令牌键前缀
|
||||
}
|
||||
|
||||
// 限流器
|
||||
|
||||
@@ -139,20 +139,107 @@ message Server {
|
||||
|
||||
// Asynq
|
||||
message Asynq {
|
||||
string endpoint = 1; // 对端网络地址
|
||||
string password = 2; // redis登录密码
|
||||
int32 db = 3; // 数据库索引
|
||||
string location = 4; // 时区
|
||||
TLS tls = 5; // TLS配置
|
||||
bool enable_keep_alive = 6; // 启用心跳
|
||||
string network = 1; // Redis对端网络地址
|
||||
string endpoint = 2; // Redis对端网络地址
|
||||
string password = 3; // Redis登录密码
|
||||
int32 db = 4; // Redis数据库索引
|
||||
int32 pool_size = 5; // Redis连接池大小
|
||||
|
||||
TLS tls = 6; // TLS配置
|
||||
string codec = 7; // 编解码器: json,xml,yaml...
|
||||
|
||||
string location = 10; // 时区
|
||||
int32 concurrency = 11; // 并发数
|
||||
int32 group_max_size = 12; // 组最大大小
|
||||
map<string, int32> queues = 13; // 队列
|
||||
|
||||
bool enable_keep_alive = 20; // 启用心跳
|
||||
bool enable_gracefully_shutdown = 21; // 优雅关闭
|
||||
bool enable_strict_priority = 22; // 严格优先级
|
||||
|
||||
google.protobuf.Duration shutdown_timeout = 30; // 关闭超时时间
|
||||
google.protobuf.Duration dial_timeout = 31; // 拨号超时时间
|
||||
google.protobuf.Duration read_timeout = 32; // 读取超时时间
|
||||
google.protobuf.Duration write_timeout = 33; // 写入超时时间
|
||||
|
||||
google.protobuf.Duration health_check_interval = 34; // 健康检查时间间隔
|
||||
google.protobuf.Duration delayed_task_check_interval = 35; // 延迟任务检查时间间隔
|
||||
google.protobuf.Duration group_grace_period = 36; // 组宽限期
|
||||
google.protobuf.Duration group_max_delay = 37; // 组最大延迟
|
||||
}
|
||||
|
||||
// Machinery
|
||||
message Machinery {
|
||||
repeated string brokers = 1; // broker的地址,可以根据实际使用的存储介质,分别指定Redis、AMQP或AWS SQS;
|
||||
repeated string backends = 2; // backend配置,用来指定存放结果的介质的配置。可以根据需求,分别指定为:Redis、memcached或mongodb等;
|
||||
TLS tls = 3; // TLS配置
|
||||
bool enable_keep_alive = 4; // 启用心跳
|
||||
string broker_type = 1; // broker类型,可以根据实际使用的存储介质,分别指定Redis、AMQP或AWS SQS;
|
||||
string broker_addr = 2; // broker的地址
|
||||
int32 broker_db = 3; // broker的数据库索引
|
||||
|
||||
string backend_type = 10; // backend类型,可以分别指定为:redis、memcached或mongodb等;
|
||||
string backend_addr = 11; // backend的地址
|
||||
int32 backend_db = 12; // backend的数据库索引
|
||||
|
||||
string lock_type = 20; // lock类型,可以分别指定为:redis、memcached或mongodb等;
|
||||
string lock_addr = 21; // lock的地址
|
||||
int32 lock_db = 22; // lock的数据库索引
|
||||
|
||||
string consumer_tag = 30; // 消费者标签
|
||||
int32 consumer_concurrency = 31; // 消费者并发数
|
||||
string consumer_queue = 32; // 消费者队列
|
||||
|
||||
TLS tls = 50; // TLS配置
|
||||
bool enable_keep_alive = 51; // 启用心跳
|
||||
string default_queue = 52; // 默认队列
|
||||
int32 results_expire_in = 53; // 结果过期时间
|
||||
bool no_unix_signals = 54; // 禁用Unix信号
|
||||
|
||||
message Redis {
|
||||
int32 max_idle = 1;
|
||||
int32 max_active = 2;
|
||||
int32 max_idle_timeout = 3;
|
||||
bool wait = 4;
|
||||
int32 read_timeout = 5;
|
||||
int32 write_timeout = 6;
|
||||
int32 connect_timeout = 7;
|
||||
int32 normal_tasks_poll_period = 8;
|
||||
int32 delayed_tasks_poll_period = 9;
|
||||
string delayed_tasks_key = 10;
|
||||
string master_name = 11;
|
||||
}
|
||||
Redis redis = 100; // Redis配置
|
||||
|
||||
message AMQP {
|
||||
string exchange = 1;
|
||||
string exchange_type = 2;
|
||||
map<string, string> queue_declare_args = 3;
|
||||
map<string, string> queue_binding_args = 4;
|
||||
string binding_key = 5;
|
||||
int32 prefetch_count = 6;
|
||||
bool auto_delete = 7;
|
||||
string delayed_queue = 8;
|
||||
}
|
||||
AMQP amqp = 101; // AMQP配置
|
||||
|
||||
message SQS {
|
||||
int32 receive_wait_time_seconds = 1;
|
||||
optional int32 receive_visibility_timeout = 2;
|
||||
}
|
||||
SQS sqs = 102; // SQS配置
|
||||
|
||||
message GCP {
|
||||
google.protobuf.Duration max_extension = 1;
|
||||
}
|
||||
GCP gcp = 103; // GCP配置
|
||||
|
||||
message MongoDB {
|
||||
string database = 1;
|
||||
}
|
||||
MongoDB mongodb = 104; // MongoDB配置
|
||||
|
||||
message DynamoDB {
|
||||
string task_states_table = 1;
|
||||
string group_metas_table = 2;
|
||||
}
|
||||
DynamoDB dynamodb = 105; // DynamoDB配置
|
||||
}
|
||||
|
||||
// SSE
|
||||
|
||||
@@ -70,6 +70,11 @@ message PagingRequest {
|
||||
example: {yaml : "id,realName,userName"}
|
||||
}
|
||||
];
|
||||
|
||||
optional uint32 tenant_id = 8 [
|
||||
(gnostic.openapi.v3.property) = {description: "租户ID"},
|
||||
json_name = "tenantId"
|
||||
]; // 租户ID
|
||||
}
|
||||
|
||||
// 分页通用结果
|
||||
|
||||
@@ -22,10 +22,10 @@ require (
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/spf13/cobra v1.9.1
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.13
|
||||
github.com/tx7do/kratos-bootstrap/config v0.0.8
|
||||
github.com/tx7do/kratos-bootstrap/logger v0.0.8
|
||||
github.com/tx7do/kratos-bootstrap/registry v0.0.8
|
||||
github.com/tx7do/kratos-bootstrap/tracer v0.0.8
|
||||
github.com/tx7do/kratos-bootstrap/config v0.0.9
|
||||
github.com/tx7do/kratos-bootstrap/logger v0.0.9
|
||||
github.com/tx7do/kratos-bootstrap/registry v0.0.9
|
||||
github.com/tx7do/kratos-bootstrap/tracer v0.0.9
|
||||
github.com/tx7do/kratos-bootstrap/utils v0.1.3
|
||||
golang.org/x/tools v0.33.0
|
||||
)
|
||||
|
||||
@@ -67,7 +67,6 @@ func initGrpcClientConfig(cfg *conf.Bootstrap, mds ...middleware.Middleware) []k
|
||||
options = append(options, kratosGrpc.WithTimeout(timeout))
|
||||
|
||||
var ms []middleware.Middleware
|
||||
ms = append(ms, mds...)
|
||||
if cfg.Client.Grpc.Middleware != nil {
|
||||
if cfg.Client.Grpc.Middleware.GetEnableRecovery() {
|
||||
ms = append(ms, recovery.Recovery())
|
||||
@@ -82,6 +81,8 @@ func initGrpcClientConfig(cfg *conf.Bootstrap, mds ...middleware.Middleware) []k
|
||||
ms = append(ms, metadata.Client())
|
||||
}
|
||||
}
|
||||
ms = append(ms, mds...)
|
||||
|
||||
options = append(options, kratosGrpc.WithMiddleware(ms...))
|
||||
|
||||
if cfg.Client.Grpc.Tls != nil {
|
||||
@@ -119,7 +120,6 @@ func initGrpcServerConfig(cfg *conf.Bootstrap, mds ...middleware.Middleware) []k
|
||||
var options []kratosGrpc.ServerOption
|
||||
|
||||
var ms []middleware.Middleware
|
||||
ms = append(ms, mds...)
|
||||
if cfg.Server.Grpc.Middleware != nil {
|
||||
if cfg.Server.Grpc.Middleware.GetEnableRecovery() {
|
||||
ms = append(ms, recovery.Recovery())
|
||||
@@ -144,6 +144,8 @@ func initGrpcServerConfig(cfg *conf.Bootstrap, mds ...middleware.Middleware) []k
|
||||
ms = append(ms, metadata.Server())
|
||||
}
|
||||
}
|
||||
ms = append(ms, mds...)
|
||||
|
||||
options = append(options, kratosGrpc.Middleware(ms...))
|
||||
|
||||
if cfg.Server.Grpc.Tls != nil {
|
||||
|
||||
@@ -53,7 +53,6 @@ func initRestConfig(cfg *conf.Bootstrap, mds ...middleware.Middleware) []kratosR
|
||||
}
|
||||
|
||||
var ms []middleware.Middleware
|
||||
ms = append(ms, mds...)
|
||||
if cfg.Server.Rest.Middleware != nil {
|
||||
if cfg.Server.Rest.Middleware.GetEnableRecovery() {
|
||||
ms = append(ms, recovery.Recovery())
|
||||
@@ -74,10 +73,12 @@ func initRestConfig(cfg *conf.Bootstrap, mds ...middleware.Middleware) []kratosR
|
||||
}
|
||||
ms = append(ms, midRateLimit.Server(midRateLimit.WithLimiter(limiter)))
|
||||
}
|
||||
if cfg.Server.Grpc.Middleware.GetEnableMetadata() {
|
||||
if cfg.Server.Rest.Middleware.GetEnableMetadata() {
|
||||
ms = append(ms, metadata.Server())
|
||||
}
|
||||
}
|
||||
ms = append(ms, mds...)
|
||||
|
||||
options = append(options, kratosRest.Middleware(ms...))
|
||||
|
||||
if cfg.Server.Rest.Network != "" {
|
||||
|
||||
4
tag.bat
4
tag.bat
@@ -1,4 +1,4 @@
|
||||
git tag api/v0.0.13 --force
|
||||
git tag api/v0.0.17 --force
|
||||
|
||||
git tag utils/v0.1.3 --force
|
||||
|
||||
@@ -7,7 +7,7 @@ git tag oss/minio/v0.0.9 --force
|
||||
git tag registry/v0.0.9 --force
|
||||
git tag config/v0.0.9 --force
|
||||
git tag logger/v0.0.9 --force
|
||||
git tag rpc/v0.0.11 --force
|
||||
git tag rpc/v0.0.13 --force
|
||||
git tag tracer/v0.0.9 --force
|
||||
|
||||
git tag database/ent/v0.0.9 --force
|
||||
|
||||
Reference in New Issue
Block a user