Compare commits
56 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
883b23dbbb | ||
|
|
40ec693f17 | ||
|
|
968f1b72b0 | ||
|
|
43da1db483 | ||
|
|
16f4462220 | ||
|
|
9e051505a1 | ||
|
|
e755b6cfc8 | ||
|
|
91b483ac9a | ||
|
|
01424e4387 | ||
|
|
5e85934e35 | ||
|
|
edbcad5973 | ||
|
|
6711cb7613 | ||
|
|
d7b7e9e8fd | ||
|
|
ad13aafe69 | ||
|
|
f1fa4176af | ||
|
|
8044bb92b3 | ||
|
|
3eb9f014bc | ||
|
|
7eb628e676 | ||
|
|
7b10a94188 | ||
|
|
cf902efeca | ||
|
|
e043284a58 | ||
|
|
f4658eb5d9 | ||
|
|
72daf43151 | ||
|
|
7ce746e181 | ||
|
|
9df72bbad8 | ||
|
|
7471dbf968 | ||
|
|
601a7e5545 | ||
|
|
8e16b4309c | ||
|
|
cfb5aefaf9 | ||
|
|
22382d11e0 | ||
|
|
f428916cd1 | ||
|
|
3fc082fef5 | ||
|
|
094a996690 | ||
|
|
ce00339301 | ||
|
|
52d7c62d98 | ||
|
|
0c75b390be | ||
|
|
34547d6ff9 | ||
|
|
9e31da73be | ||
|
|
1c54fc7554 | ||
|
|
efbbf420c3 | ||
|
|
76ac31b836 | ||
|
|
cfea51ec49 | ||
|
|
fe52212ed3 | ||
|
|
7884cc05c6 | ||
|
|
05b8fbc90c | ||
|
|
da6a64f306 | ||
|
|
6451e0fd06 | ||
|
|
670e33498a | ||
|
|
83924b6740 | ||
|
|
4cc1bb658a | ||
|
|
d1dd6af5d3 | ||
|
|
4ffb6d77ea | ||
|
|
1f708cdf67 | ||
|
|
4bf4e02919 | ||
|
|
78ae649d26 | ||
|
|
adcd17b3e2 |
26
.gitignore
vendored
26
.gitignore
vendored
@@ -1,6 +1,4 @@
|
||||
# If you prefer the allow list template instead of the deny list, see community template:
|
||||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
|
||||
#
|
||||
# Reference https://github.com/github/gitignore/blob/master/Go.gitignore
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
@@ -15,7 +13,23 @@
|
||||
*.out
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
# vendor/
|
||||
vendor/
|
||||
|
||||
# Go workspace file
|
||||
go.work
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
|
||||
# OS General
|
||||
Thumbs.db
|
||||
.DS_Store
|
||||
|
||||
# project
|
||||
*.cert
|
||||
*.key
|
||||
*.log
|
||||
bin/
|
||||
|
||||
# Develop tools
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
|
||||
1
Makefile
1
Makefile
@@ -13,6 +13,7 @@ SRCS_MK := $(foreach dir, app, $(wildcard $(dir)/*/*/Makefile))
|
||||
|
||||
# generate protobuf api go code
|
||||
api:
|
||||
cd api && \
|
||||
buf generate
|
||||
|
||||
# show help
|
||||
|
||||
22
api/buf.gen.yaml
Normal file
22
api/buf.gen.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
# 配置protoc生成规则
|
||||
version: v1
|
||||
|
||||
managed:
|
||||
enabled: true
|
||||
optimize_for: SPEED
|
||||
|
||||
go_package_prefix:
|
||||
default: github.com/tx7do/kratos-bootstrap/api/gen/go
|
||||
except:
|
||||
- 'buf.build/googleapis/googleapis'
|
||||
- 'buf.build/envoyproxy/protoc-gen-validate'
|
||||
- 'buf.build/kratos/apis'
|
||||
- 'buf.build/gnostic/gnostic'
|
||||
- 'buf.build/gogo/protobuf'
|
||||
|
||||
plugins:
|
||||
# generate go struct code
|
||||
#- plugin: buf.build/protocolbuffers/go
|
||||
- name: go
|
||||
out: gen/go
|
||||
opt: paths=source_relative
|
||||
@@ -1,3 +1,4 @@
|
||||
version: v1
|
||||
|
||||
directories:
|
||||
- api
|
||||
- protos
|
||||
@@ -1,26 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package conf;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1;conf";
|
||||
|
||||
import "google/protobuf/duration.proto";
|
||||
import "conf/v1/kratos_conf_middleware.proto";
|
||||
|
||||
// 客户端
|
||||
message Client {
|
||||
// REST
|
||||
message REST {
|
||||
google.protobuf.Duration timeout = 1; // 超时时间
|
||||
Middleware middleware = 2;
|
||||
}
|
||||
|
||||
// gPRC
|
||||
message GRPC {
|
||||
google.protobuf.Duration timeout = 1; // 超时时间
|
||||
Middleware middleware = 2;
|
||||
}
|
||||
|
||||
REST rest = 1; // REST服务
|
||||
GRPC grpc = 2; // gRPC服务
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package conf;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1;conf";
|
||||
|
||||
import "google/protobuf/duration.proto";
|
||||
|
||||
// 配置服务
|
||||
message RemoteConfig {
|
||||
message Nacos {
|
||||
string address = 1; // 服务端地址
|
||||
uint64 port = 2; // 服务端端口
|
||||
string key = 3; //
|
||||
}
|
||||
|
||||
message Etcd {
|
||||
repeated string endpoints = 1;
|
||||
google.protobuf.Duration timeout = 2;
|
||||
string key = 3; //
|
||||
}
|
||||
|
||||
message Consul {
|
||||
string scheme = 1; // 网络样式
|
||||
string address = 2; // 服务端地址
|
||||
string key = 3; //
|
||||
}
|
||||
|
||||
message Apollo {
|
||||
string endpoint = 1;
|
||||
string app_id = 2;
|
||||
string cluster = 3;
|
||||
string namespace = 4;
|
||||
string secret = 5;
|
||||
}
|
||||
|
||||
message Kubernetes {
|
||||
string namespace = 1;
|
||||
}
|
||||
|
||||
message Polaris {
|
||||
|
||||
}
|
||||
|
||||
string type = 1;
|
||||
|
||||
Etcd etcd = 2;
|
||||
Consul consul = 3;
|
||||
Nacos nacos = 4;
|
||||
Apollo apollo = 6;
|
||||
Kubernetes kubernetes = 7;
|
||||
Polaris polaris = 8;
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package conf;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1;conf";
|
||||
|
||||
import "google/protobuf/duration.proto";
|
||||
|
||||
// 数据
|
||||
message Data {
|
||||
// 数据库
|
||||
message Database {
|
||||
string driver = 1; // 驱动名:mysql、postgresql、mongodb、sqlite……
|
||||
string source = 2; // 数据源(DSN字符串)
|
||||
bool migrate = 3; // 数据迁移开关
|
||||
bool debug = 4; // 调试开关
|
||||
int32 max_idle_connections = 5; // 连接池最大空闲连接数
|
||||
int32 max_open_connections = 6; // 连接池最大打开连接数
|
||||
google.protobuf.Duration connection_max_lifetime = 7; // 连接可重用的最大时间长度
|
||||
}
|
||||
|
||||
// redis
|
||||
message Redis {
|
||||
string network = 1; // 网络
|
||||
string addr = 2; // 服务端地址
|
||||
string password = 3; // 密码
|
||||
int32 db = 4; // 数据库索引
|
||||
google.protobuf.Duration dial_timeout = 5; // 连接超时时间
|
||||
google.protobuf.Duration read_timeout = 6; // 读取超时时间
|
||||
google.protobuf.Duration write_timeout = 7; // 写入超时时间
|
||||
}
|
||||
|
||||
Database database = 1; // 数据库
|
||||
Redis redis = 2; // Redis
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package conf;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1;conf";
|
||||
|
||||
message OSS {
|
||||
// MinIO
|
||||
message MinIO {
|
||||
string endpoint = 1; // 对端端口
|
||||
string access_key = 2; // 访问密钥
|
||||
string secret_key = 3; // 密钥
|
||||
string token = 4; // 令牌
|
||||
bool use_ssl = 5; // 使用SSL
|
||||
string upload_host = 6; // 上传链接的主机名
|
||||
string download_host = 7; // 下载链接的主机名
|
||||
}
|
||||
|
||||
MinIO minio = 1;
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package conf;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1;conf";
|
||||
|
||||
import "google/protobuf/duration.proto";
|
||||
import "conf/v1/kratos_conf_middleware.proto";
|
||||
|
||||
// 服务器
|
||||
message Server {
|
||||
// REST
|
||||
message REST {
|
||||
message CORS {
|
||||
repeated string headers = 1; //
|
||||
repeated string methods = 2; //
|
||||
repeated string origins = 3; //
|
||||
}
|
||||
|
||||
string network = 1; // 网络
|
||||
string addr = 2; // 服务监听地址
|
||||
google.protobuf.Duration timeout = 3; // 超时时间
|
||||
CORS cors = 4; // 服务监听地址
|
||||
Middleware middleware = 5; // 中间件
|
||||
}
|
||||
|
||||
// gPRC
|
||||
message GRPC {
|
||||
string network = 1; // 网络
|
||||
string addr = 2; // 服务监听地址
|
||||
google.protobuf.Duration timeout = 3; // 超时时间
|
||||
Middleware middleware = 4;
|
||||
}
|
||||
|
||||
// Websocket
|
||||
message Websocket {
|
||||
string network = 1; // 网络样式:http、https
|
||||
string addr = 2; // 服务监听地址
|
||||
string path = 3; // 路径
|
||||
google.protobuf.Duration timeout = 4; // 超时时间
|
||||
}
|
||||
|
||||
// MQTT
|
||||
message Mqtt {
|
||||
string addr = 1; // 对端网络地址
|
||||
}
|
||||
|
||||
// Kafka
|
||||
message Kafka {
|
||||
repeated string addrs = 1; // 对端网络地址
|
||||
}
|
||||
|
||||
// RabbitMQ
|
||||
message RabbitMQ {
|
||||
repeated string addrs = 1; // 对端网络地址
|
||||
}
|
||||
|
||||
// Asynq
|
||||
message Asynq {
|
||||
string endpoint = 1; // 对端网络地址
|
||||
string password = 2; // redis登录密码
|
||||
int32 db = 3; // 数据库索引
|
||||
}
|
||||
|
||||
// Machinery
|
||||
message Machinery {
|
||||
repeated string brokers = 1; // broker的地址,可以根据实际使用的存储介质,分别指定Redis、AMQP或AWS SQS;
|
||||
repeated string backends = 2; // backend配置,用来指定存放结果的介质的配置。可以根据需求,分别指定为:Redis、memcached或mongodb等;
|
||||
}
|
||||
|
||||
REST rest = 1; // REST服务
|
||||
GRPC grpc = 2; // gRPC服务
|
||||
Websocket websocket = 3; // Websocket服务
|
||||
Mqtt mqtt = 4; // MQTT服务
|
||||
Kafka kafka = 5; // Kafka服务
|
||||
RabbitMQ rabbitmq = 6; // RabbitMQ服务
|
||||
Asynq asynq = 7; // Asynq服务
|
||||
Machinery machinery = 8; // Machinery服务
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_bootstrap.proto
|
||||
|
||||
package conf
|
||||
package v1
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
@@ -179,10 +179,15 @@ var file_conf_v1_kratos_conf_bootstrap_proto_rawDesc = []byte{
|
||||
0x6f, 0x73, 0x73, 0x12, 0x2a, 0x0a, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x18, 0x09, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66,
|
||||
0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x42,
|
||||
0x3b, 0x5a, 0x39, 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, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f,
|
||||
0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72,
|
||||
0x8a, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x18, 0x4b, 0x72,
|
||||
0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61,
|
||||
0x70, 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,
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_client.proto
|
||||
|
||||
package conf
|
||||
package v1
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
@@ -27,8 +27,8 @@ type Client struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Rest *Client_REST `protobuf:"bytes,1,opt,name=rest,proto3" json:"rest,omitempty"` // REST服务
|
||||
Grpc *Client_GRPC `protobuf:"bytes,2,opt,name=grpc,proto3" json:"grpc,omitempty"` // gRPC服务
|
||||
Rest *Client_REST `protobuf:"bytes,1,opt,name=rest,proto3,oneof" json:"rest,omitempty"` // REST服务
|
||||
Grpc *Client_GRPC `protobuf:"bytes,2,opt,name=grpc,proto3,oneof" json:"grpc,omitempty"` // gRPC服务
|
||||
}
|
||||
|
||||
func (x *Client) Reset() {
|
||||
@@ -83,8 +83,9 @@ type Client_REST struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Timeout *durationpb.Duration `protobuf:"bytes,1,opt,name=timeout,proto3" json:"timeout,omitempty"` // 超时时间
|
||||
Middleware *Middleware `protobuf:"bytes,2,opt,name=middleware,proto3" json:"middleware,omitempty"`
|
||||
Timeout *durationpb.Duration `protobuf:"bytes,1,opt,name=timeout,proto3" json:"timeout,omitempty"` // 超时时间
|
||||
Middleware *Middleware `protobuf:"bytes,2,opt,name=middleware,proto3" json:"middleware,omitempty"` // 中间件
|
||||
Tls *TLS `protobuf:"bytes,3,opt,name=tls,proto3" json:"tls,omitempty"` // TLS配置
|
||||
}
|
||||
|
||||
func (x *Client_REST) Reset() {
|
||||
@@ -133,14 +134,22 @@ func (x *Client_REST) GetMiddleware() *Middleware {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Client_REST) GetTls() *TLS {
|
||||
if x != nil {
|
||||
return x.Tls
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// gPRC
|
||||
type Client_GRPC struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Timeout *durationpb.Duration `protobuf:"bytes,1,opt,name=timeout,proto3" json:"timeout,omitempty"` // 超时时间
|
||||
Middleware *Middleware `protobuf:"bytes,2,opt,name=middleware,proto3" json:"middleware,omitempty"`
|
||||
Timeout *durationpb.Duration `protobuf:"bytes,1,opt,name=timeout,proto3" json:"timeout,omitempty"` // 超时时间
|
||||
Middleware *Middleware `protobuf:"bytes,2,opt,name=middleware,proto3" json:"middleware,omitempty"` // 中间件
|
||||
Tls *TLS `protobuf:"bytes,3,opt,name=tls,proto3" json:"tls,omitempty"` // TLS配置
|
||||
}
|
||||
|
||||
func (x *Client_GRPC) Reset() {
|
||||
@@ -189,6 +198,13 @@ func (x *Client_GRPC) GetMiddleware() *Middleware {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Client_GRPC) GetTls() *TLS {
|
||||
if x != nil {
|
||||
return x.Tls
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_conf_v1_kratos_conf_client_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_client_proto_rawDesc = []byte{
|
||||
@@ -198,31 +214,43 @@ var file_conf_v1_kratos_conf_client_proto_rawDesc = []byte{
|
||||
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76,
|
||||
0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x6d, 0x69,
|
||||
0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb4,
|
||||
0x02, 0x0a, 0x06, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x04, 0x72, 0x65, 0x73,
|
||||
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x43,
|
||||
0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x45, 0x53, 0x54, 0x52, 0x04, 0x72, 0x65, 0x73, 0x74,
|
||||
0x12, 0x25, 0x0a, 0x04, 0x67, 0x72, 0x70, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11,
|
||||
0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x52, 0x50,
|
||||
0x43, 0x52, 0x04, 0x67, 0x72, 0x70, 0x63, 0x1a, 0x6d, 0x0a, 0x04, 0x52, 0x45, 0x53, 0x54, 0x12,
|
||||
0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x01, 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, 0x52, 0x07, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x6f, 0x75, 0x74, 0x12, 0x30, 0x0a, 0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61,
|
||||
0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e,
|
||||
0x4d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x52, 0x0a, 0x6d, 0x69, 0x64, 0x64,
|
||||
0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x1a, 0x6d, 0x0a, 0x04, 0x47, 0x52, 0x50, 0x43, 0x12, 0x33,
|
||||
0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x01, 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, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65,
|
||||
0x6f, 0x75, 0x74, 0x12, 0x30, 0x0a, 0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4d,
|
||||
0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x52, 0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c,
|
||||
0x65, 0x77, 0x61, 0x72, 0x65, 0x42, 0x3b, 0x5a, 0x39, 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, 0x67, 0x65, 0x6e, 0x2f, 0x61,
|
||||
0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d,
|
||||
0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x5f, 0x74, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8c, 0x03,
|
||||
0x0a, 0x06, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x04, 0x72, 0x65, 0x73, 0x74,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x43, 0x6c,
|
||||
0x69, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x45, 0x53, 0x54, 0x48, 0x00, 0x52, 0x04, 0x72, 0x65, 0x73,
|
||||
0x74, 0x88, 0x01, 0x01, 0x12, 0x2a, 0x0a, 0x04, 0x67, 0x72, 0x70, 0x63, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74,
|
||||
0x2e, 0x47, 0x52, 0x50, 0x43, 0x48, 0x01, 0x52, 0x04, 0x67, 0x72, 0x70, 0x63, 0x88, 0x01, 0x01,
|
||||
0x1a, 0x8a, 0x01, 0x0a, 0x04, 0x52, 0x45, 0x53, 0x54, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x6f, 0x75, 0x74, 0x18, 0x01, 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, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x30,
|
||||
0x0a, 0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4d, 0x69, 0x64, 0x64, 0x6c, 0x65,
|
||||
0x77, 0x61, 0x72, 0x65, 0x52, 0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65,
|
||||
0x12, 0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e,
|
||||
0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x1a, 0x8a, 0x01,
|
||||
0x0a, 0x04, 0x47, 0x52, 0x50, 0x43, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75,
|
||||
0x74, 0x18, 0x01, 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, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x30, 0x0a, 0x0a, 0x6d,
|
||||
0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x10, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72,
|
||||
0x65, 0x52, 0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x12, 0x1b, 0x0a,
|
||||
0x03, 0x74, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x72,
|
||||
0x65, 0x73, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x42, 0x87, 0x01, 0x0a,
|
||||
0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x15, 0x4b, 0x72, 0x61, 0x74, 0x6f,
|
||||
0x73, 0x43, 0x6f, 0x6e, 0x66, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 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 (
|
||||
@@ -244,19 +272,22 @@ var file_conf_v1_kratos_conf_client_proto_goTypes = []interface{}{
|
||||
(*Client_GRPC)(nil), // 2: conf.Client.GRPC
|
||||
(*durationpb.Duration)(nil), // 3: google.protobuf.Duration
|
||||
(*Middleware)(nil), // 4: conf.Middleware
|
||||
(*TLS)(nil), // 5: conf.TLS
|
||||
}
|
||||
var file_conf_v1_kratos_conf_client_proto_depIdxs = []int32{
|
||||
1, // 0: conf.Client.rest:type_name -> conf.Client.REST
|
||||
2, // 1: conf.Client.grpc:type_name -> conf.Client.GRPC
|
||||
3, // 2: conf.Client.REST.timeout:type_name -> google.protobuf.Duration
|
||||
4, // 3: conf.Client.REST.middleware:type_name -> conf.Middleware
|
||||
3, // 4: conf.Client.GRPC.timeout:type_name -> google.protobuf.Duration
|
||||
4, // 5: conf.Client.GRPC.middleware:type_name -> conf.Middleware
|
||||
6, // [6:6] is the sub-list for method output_type
|
||||
6, // [6:6] is the sub-list for method input_type
|
||||
6, // [6:6] is the sub-list for extension type_name
|
||||
6, // [6:6] is the sub-list for extension extendee
|
||||
0, // [0:6] is the sub-list for field type_name
|
||||
5, // 4: conf.Client.REST.tls:type_name -> conf.TLS
|
||||
3, // 5: conf.Client.GRPC.timeout:type_name -> google.protobuf.Duration
|
||||
4, // 6: conf.Client.GRPC.middleware:type_name -> conf.Middleware
|
||||
5, // 7: conf.Client.GRPC.tls:type_name -> conf.TLS
|
||||
8, // [8:8] is the sub-list for method output_type
|
||||
8, // [8:8] is the sub-list for method input_type
|
||||
8, // [8:8] is the sub-list for extension type_name
|
||||
8, // [8:8] is the sub-list for extension extendee
|
||||
0, // [0:8] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_conf_v1_kratos_conf_client_proto_init() }
|
||||
@@ -265,6 +296,7 @@ func file_conf_v1_kratos_conf_client_proto_init() {
|
||||
return
|
||||
}
|
||||
file_conf_v1_kratos_conf_middleware_proto_init()
|
||||
file_conf_v1_kratos_conf_tls_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_conf_v1_kratos_conf_client_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Client); i {
|
||||
@@ -303,6 +335,7 @@ func file_conf_v1_kratos_conf_client_proto_init() {
|
||||
}
|
||||
}
|
||||
}
|
||||
file_conf_v1_kratos_conf_client_proto_msgTypes[0].OneofWrappers = []interface{}{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
@@ -4,7 +4,7 @@
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_config.proto
|
||||
|
||||
package conf
|
||||
package v1
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
@@ -27,13 +27,13 @@ type RemoteConfig struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
|
||||
Etcd *RemoteConfig_Etcd `protobuf:"bytes,2,opt,name=etcd,proto3" json:"etcd,omitempty"`
|
||||
Consul *RemoteConfig_Consul `protobuf:"bytes,3,opt,name=consul,proto3" json:"consul,omitempty"`
|
||||
Nacos *RemoteConfig_Nacos `protobuf:"bytes,4,opt,name=nacos,proto3" json:"nacos,omitempty"`
|
||||
Apollo *RemoteConfig_Apollo `protobuf:"bytes,6,opt,name=apollo,proto3" json:"apollo,omitempty"`
|
||||
Kubernetes *RemoteConfig_Kubernetes `protobuf:"bytes,7,opt,name=kubernetes,proto3" json:"kubernetes,omitempty"`
|
||||
Polaris *RemoteConfig_Polaris `protobuf:"bytes,8,opt,name=polaris,proto3" json:"polaris,omitempty"`
|
||||
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` // 配置类型
|
||||
Etcd *RemoteConfig_Etcd `protobuf:"bytes,2,opt,name=etcd,proto3,oneof" json:"etcd,omitempty"`
|
||||
Consul *RemoteConfig_Consul `protobuf:"bytes,3,opt,name=consul,proto3,oneof" json:"consul,omitempty"`
|
||||
Nacos *RemoteConfig_Nacos `protobuf:"bytes,4,opt,name=nacos,proto3,oneof" json:"nacos,omitempty"`
|
||||
Apollo *RemoteConfig_Apollo `protobuf:"bytes,6,opt,name=apollo,proto3,oneof" json:"apollo,omitempty"`
|
||||
Kubernetes *RemoteConfig_Kubernetes `protobuf:"bytes,7,opt,name=kubernetes,proto3,oneof" json:"kubernetes,omitempty"`
|
||||
Polaris *RemoteConfig_Polaris `protobuf:"bytes,8,opt,name=polaris,proto3,oneof" json:"polaris,omitempty"`
|
||||
}
|
||||
|
||||
func (x *RemoteConfig) Reset() {
|
||||
@@ -124,7 +124,7 @@ type RemoteConfig_Nacos struct {
|
||||
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // 服务端地址
|
||||
Port uint64 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` // 服务端端口
|
||||
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` //
|
||||
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` // 配置键
|
||||
}
|
||||
|
||||
func (x *RemoteConfig_Nacos) Reset() {
|
||||
@@ -185,9 +185,9 @@ type RemoteConfig_Etcd struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Endpoints []string `protobuf:"bytes,1,rep,name=endpoints,proto3" json:"endpoints,omitempty"`
|
||||
Timeout *durationpb.Duration `protobuf:"bytes,2,opt,name=timeout,proto3" json:"timeout,omitempty"`
|
||||
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` //
|
||||
Endpoints []string `protobuf:"bytes,1,rep,name=endpoints,proto3" json:"endpoints,omitempty"` // 服务端地址
|
||||
Timeout *durationpb.Duration `protobuf:"bytes,2,opt,name=timeout,proto3" json:"timeout,omitempty"` // 超时时间
|
||||
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` // 配置键
|
||||
}
|
||||
|
||||
func (x *RemoteConfig_Etcd) Reset() {
|
||||
@@ -250,7 +250,7 @@ type RemoteConfig_Consul struct {
|
||||
|
||||
Scheme string `protobuf:"bytes,1,opt,name=scheme,proto3" json:"scheme,omitempty"` // 网络样式
|
||||
Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` // 服务端地址
|
||||
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` //
|
||||
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` // 配置键
|
||||
}
|
||||
|
||||
func (x *RemoteConfig_Consul) Reset() {
|
||||
@@ -311,11 +311,11 @@ type RemoteConfig_Apollo struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Endpoint string `protobuf:"bytes,1,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
|
||||
AppId string `protobuf:"bytes,2,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
|
||||
Cluster string `protobuf:"bytes,3,opt,name=cluster,proto3" json:"cluster,omitempty"`
|
||||
Namespace string `protobuf:"bytes,4,opt,name=namespace,proto3" json:"namespace,omitempty"`
|
||||
Secret string `protobuf:"bytes,5,opt,name=secret,proto3" json:"secret,omitempty"`
|
||||
Endpoint string `protobuf:"bytes,1,opt,name=endpoint,proto3" json:"endpoint,omitempty"` // 服务端地址
|
||||
AppId string `protobuf:"bytes,2,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"` // 应用ID
|
||||
Cluster string `protobuf:"bytes,3,opt,name=cluster,proto3" json:"cluster,omitempty"` // 集群
|
||||
Namespace string `protobuf:"bytes,4,opt,name=namespace,proto3" json:"namespace,omitempty"` // 命名空间
|
||||
Secret string `protobuf:"bytes,5,opt,name=secret,proto3" json:"secret,omitempty"` // 密钥
|
||||
}
|
||||
|
||||
func (x *RemoteConfig_Apollo) Reset() {
|
||||
@@ -390,7 +390,7 @@ type RemoteConfig_Kubernetes struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
|
||||
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` // 命名空间
|
||||
}
|
||||
|
||||
func (x *RemoteConfig_Kubernetes) Reset() {
|
||||
@@ -477,62 +477,73 @@ var file_conf_v1_kratos_conf_config_proto_rawDesc = []byte{
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 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, 0xa3, 0x06, 0x0a, 0x0c, 0x52, 0x65, 0x6d,
|
||||
0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x07, 0x0a, 0x0c, 0x52, 0x65, 0x6d,
|
||||
0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70,
|
||||
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2b, 0x0a,
|
||||
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x30, 0x0a,
|
||||
0x04, 0x65, 0x74, 0x63, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e,
|
||||
0x45, 0x74, 0x63, 0x64, 0x52, 0x04, 0x65, 0x74, 0x63, 0x64, 0x12, 0x31, 0x0a, 0x06, 0x63, 0x6f,
|
||||
0x6e, 0x73, 0x75, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43,
|
||||
0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x12, 0x2e, 0x0a,
|
||||
0x05, 0x6e, 0x61, 0x63, 0x6f, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63,
|
||||
0x45, 0x74, 0x63, 0x64, 0x48, 0x00, 0x52, 0x04, 0x65, 0x74, 0x63, 0x64, 0x88, 0x01, 0x01, 0x12,
|
||||
0x36, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x19, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e,
|
||||
0x66, 0x69, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x48, 0x01, 0x52, 0x06, 0x63, 0x6f,
|
||||
0x6e, 0x73, 0x75, 0x6c, 0x88, 0x01, 0x01, 0x12, 0x33, 0x0a, 0x05, 0x6e, 0x61, 0x63, 0x6f, 0x73,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x52, 0x65,
|
||||
0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4e, 0x61, 0x63, 0x6f, 0x73,
|
||||
0x48, 0x02, 0x52, 0x05, 0x6e, 0x61, 0x63, 0x6f, 0x73, 0x88, 0x01, 0x01, 0x12, 0x36, 0x0a, 0x06,
|
||||
0x61, 0x70, 0x6f, 0x6c, 0x6c, 0x6f, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
|
||||
0x2e, 0x4e, 0x61, 0x63, 0x6f, 0x73, 0x52, 0x05, 0x6e, 0x61, 0x63, 0x6f, 0x73, 0x12, 0x31, 0x0a,
|
||||
0x06, 0x61, 0x70, 0x6f, 0x6c, 0x6c, 0x6f, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e,
|
||||
0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69,
|
||||
0x67, 0x2e, 0x41, 0x70, 0x6f, 0x6c, 0x6c, 0x6f, 0x52, 0x06, 0x61, 0x70, 0x6f, 0x6c, 0x6c, 0x6f,
|
||||
0x12, 0x3d, 0x0a, 0x0a, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x18, 0x07,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x52, 0x65, 0x6d, 0x6f,
|
||||
0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65,
|
||||
0x74, 0x65, 0x73, 0x52, 0x0a, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x12,
|
||||
0x34, 0x0a, 0x07, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f,
|
||||
0x6e, 0x66, 0x69, 0x67, 0x2e, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x52, 0x07, 0x70, 0x6f,
|
||||
0x6c, 0x61, 0x72, 0x69, 0x73, 0x1a, 0x47, 0x0a, 0x05, 0x4e, 0x61, 0x63, 0x6f, 0x73, 0x12, 0x18,
|
||||
0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03,
|
||||
0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x1a, 0x6b,
|
||||
0x0a, 0x04, 0x45, 0x74, 0x63, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69,
|
||||
0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f,
|
||||
0x69, 0x6e, 0x74, 0x73, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18,
|
||||
0x02, 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,
|
||||
0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x1a, 0x4c, 0x0a, 0x06, 0x43,
|
||||
0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
|
||||
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x1a, 0x8b, 0x01, 0x0a, 0x06, 0x41, 0x70,
|
||||
0x6f, 0x6c, 0x6c, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74,
|
||||
0x12, 0x15, 0x0a, 0x06, 0x61, 0x70, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74,
|
||||
0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65,
|
||||
0x72, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x04,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12,
|
||||
0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x1a, 0x2a, 0x0a, 0x0a, 0x4b, 0x75, 0x62, 0x65, 0x72,
|
||||
0x6e, 0x65, 0x74, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61,
|
||||
0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70,
|
||||
0x61, 0x63, 0x65, 0x1a, 0x09, 0x0a, 0x07, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x42, 0x3b,
|
||||
0x5a, 0x39, 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, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
0x2e, 0x41, 0x70, 0x6f, 0x6c, 0x6c, 0x6f, 0x48, 0x03, 0x52, 0x06, 0x61, 0x70, 0x6f, 0x6c, 0x6c,
|
||||
0x6f, 0x88, 0x01, 0x01, 0x12, 0x42, 0x0a, 0x0a, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74,
|
||||
0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e,
|
||||
0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4b, 0x75, 0x62,
|
||||
0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x48, 0x04, 0x52, 0x0a, 0x6b, 0x75, 0x62, 0x65, 0x72,
|
||||
0x6e, 0x65, 0x74, 0x65, 0x73, 0x88, 0x01, 0x01, 0x12, 0x39, 0x0a, 0x07, 0x70, 0x6f, 0x6c, 0x61,
|
||||
0x72, 0x69, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x50, 0x6f,
|
||||
0x6c, 0x61, 0x72, 0x69, 0x73, 0x48, 0x05, 0x52, 0x07, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73,
|
||||
0x88, 0x01, 0x01, 0x1a, 0x47, 0x0a, 0x05, 0x4e, 0x61, 0x63, 0x6f, 0x73, 0x12, 0x18, 0x0a, 0x07,
|
||||
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61,
|
||||
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
|
||||
0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x1a, 0x6b, 0x0a, 0x04,
|
||||
0x45, 0x74, 0x63, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74,
|
||||
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e,
|
||||
0x74, 0x73, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x02, 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, 0x52, 0x07,
|
||||
0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x1a, 0x4c, 0x0a, 0x06, 0x43, 0x6f, 0x6e,
|
||||
0x73, 0x75, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61,
|
||||
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64,
|
||||
0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x1a, 0x8b, 0x01, 0x0a, 0x06, 0x41, 0x70, 0x6f, 0x6c,
|
||||
0x6c, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x15,
|
||||
0x0a, 0x06, 0x61, 0x70, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
|
||||
0x61, 0x70, 0x70, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12,
|
||||
0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x16, 0x0a,
|
||||
0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73,
|
||||
0x65, 0x63, 0x72, 0x65, 0x74, 0x1a, 0x2a, 0x0a, 0x0a, 0x4b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65,
|
||||
0x74, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63,
|
||||
0x65, 0x1a, 0x09, 0x0a, 0x07, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x42, 0x07, 0x0a, 0x05,
|
||||
0x5f, 0x65, 0x74, 0x63, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c,
|
||||
0x42, 0x08, 0x0a, 0x06, 0x5f, 0x6e, 0x61, 0x63, 0x6f, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x61,
|
||||
0x70, 0x6f, 0x6c, 0x6c, 0x6f, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e,
|
||||
0x65, 0x74, 0x65, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73,
|
||||
0x42, 0x87, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x15, 0x4b,
|
||||
0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 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 (
|
||||
@@ -664,6 +675,7 @@ func file_conf_v1_kratos_conf_config_proto_init() {
|
||||
}
|
||||
}
|
||||
}
|
||||
file_conf_v1_kratos_conf_config_proto_msgTypes[0].OneofWrappers = []interface{}{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
2199
api/gen/go/conf/v1/kratos_conf_data.pb.go
Normal file
2199
api/gen/go/conf/v1/kratos_conf_data.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_logger.proto
|
||||
|
||||
package conf
|
||||
package v1
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
@@ -27,11 +27,11 @@ type Logger struct {
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
|
||||
Zap *Logger_Zap `protobuf:"bytes,2,opt,name=zap,proto3" json:"zap,omitempty"`
|
||||
Logrus *Logger_Logrus `protobuf:"bytes,3,opt,name=logrus,proto3" json:"logrus,omitempty"`
|
||||
Fluent *Logger_Fluent `protobuf:"bytes,4,opt,name=fluent,proto3" json:"fluent,omitempty"`
|
||||
Aliyun *Logger_Aliyun `protobuf:"bytes,5,opt,name=aliyun,proto3" json:"aliyun,omitempty"`
|
||||
Tencent *Logger_Tencent `protobuf:"bytes,6,opt,name=tencent,proto3" json:"tencent,omitempty"`
|
||||
Zap *Logger_Zap `protobuf:"bytes,2,opt,name=zap,proto3,oneof" json:"zap,omitempty"`
|
||||
Logrus *Logger_Logrus `protobuf:"bytes,3,opt,name=logrus,proto3,oneof" json:"logrus,omitempty"`
|
||||
Fluent *Logger_Fluent `protobuf:"bytes,4,opt,name=fluent,proto3,oneof" json:"fluent,omitempty"`
|
||||
Aliyun *Logger_Aliyun `protobuf:"bytes,5,opt,name=aliyun,proto3,oneof" json:"aliyun,omitempty"`
|
||||
Tencent *Logger_Tencent `protobuf:"bytes,6,opt,name=tencent,proto3,oneof" json:"tencent,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Logger) Reset() {
|
||||
@@ -465,67 +465,77 @@ var File_conf_v1_kratos_conf_logger_proto protoreflect.FileDescriptor
|
||||
var file_conf_v1_kratos_conf_logger_proto_rawDesc = []byte{
|
||||
0x0a, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x6c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x22, 0xf6, 0x06, 0x0a, 0x06, 0x4c, 0x6f, 0x67,
|
||||
0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x22, 0xc4, 0x07, 0x0a, 0x06, 0x4c, 0x6f, 0x67,
|
||||
0x67, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x03, 0x7a, 0x61, 0x70, 0x18, 0x02,
|
||||
0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x27, 0x0a, 0x03, 0x7a, 0x61, 0x70, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4c, 0x6f, 0x67, 0x67,
|
||||
0x65, 0x72, 0x2e, 0x5a, 0x61, 0x70, 0x52, 0x03, 0x7a, 0x61, 0x70, 0x12, 0x2b, 0x0a, 0x06, 0x6c,
|
||||
0x6f, 0x67, 0x72, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x2e, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x72, 0x75, 0x73,
|
||||
0x52, 0x06, 0x6c, 0x6f, 0x67, 0x72, 0x75, 0x73, 0x12, 0x2b, 0x0a, 0x06, 0x66, 0x6c, 0x75, 0x65,
|
||||
0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e,
|
||||
0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x46, 0x6c, 0x75, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x66,
|
||||
0x6c, 0x75, 0x65, 0x6e, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x61, 0x6c, 0x69, 0x79, 0x75, 0x6e, 0x18,
|
||||
0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4c, 0x6f, 0x67,
|
||||
0x67, 0x65, 0x72, 0x2e, 0x41, 0x6c, 0x69, 0x79, 0x75, 0x6e, 0x52, 0x06, 0x61, 0x6c, 0x69, 0x79,
|
||||
0x75, 0x6e, 0x12, 0x2e, 0x0a, 0x07, 0x74, 0x65, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4c, 0x6f, 0x67, 0x67, 0x65,
|
||||
0x72, 0x2e, 0x54, 0x65, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x52, 0x07, 0x74, 0x65, 0x6e, 0x63, 0x65,
|
||||
0x6e, 0x74, 0x1a, 0x8c, 0x01, 0x0a, 0x03, 0x5a, 0x61, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69,
|
||||
0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69,
|
||||
0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x19, 0x0a, 0x08,
|
||||
0x6d, 0x61, 0x78, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07,
|
||||
0x6d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x5f, 0x61,
|
||||
0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6d, 0x61, 0x78, 0x41, 0x67, 0x65,
|
||||
0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x61, 0x78, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x73, 0x18,
|
||||
0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6d, 0x61, 0x78, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70,
|
||||
0x73, 0x1a, 0xbb, 0x01, 0x0a, 0x06, 0x4c, 0x6f, 0x67, 0x72, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05,
|
||||
0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x65, 0x76,
|
||||
0x65, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x74, 0x65, 0x72,
|
||||
0x12, 0x29, 0x0a, 0x10, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x66, 0x6f,
|
||||
0x72, 0x6d, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x69, 0x6d, 0x65,
|
||||
0x73, 0x74, 0x61, 0x6d, 0x70, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x64,
|
||||
0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x73, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x0d, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6c, 0x6f,
|
||||
0x72, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x69,
|
||||
0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x64,
|
||||
0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x1a,
|
||||
0x24, 0x0a, 0x06, 0x46, 0x6c, 0x75, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64,
|
||||
0x65, 0x72, 0x2e, 0x5a, 0x61, 0x70, 0x48, 0x00, 0x52, 0x03, 0x7a, 0x61, 0x70, 0x88, 0x01, 0x01,
|
||||
0x12, 0x30, 0x0a, 0x06, 0x6c, 0x6f, 0x67, 0x72, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x4c,
|
||||
0x6f, 0x67, 0x72, 0x75, 0x73, 0x48, 0x01, 0x52, 0x06, 0x6c, 0x6f, 0x67, 0x72, 0x75, 0x73, 0x88,
|
||||
0x01, 0x01, 0x12, 0x30, 0x0a, 0x06, 0x66, 0x6c, 0x75, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72,
|
||||
0x2e, 0x46, 0x6c, 0x75, 0x65, 0x6e, 0x74, 0x48, 0x02, 0x52, 0x06, 0x66, 0x6c, 0x75, 0x65, 0x6e,
|
||||
0x74, 0x88, 0x01, 0x01, 0x12, 0x30, 0x0a, 0x06, 0x61, 0x6c, 0x69, 0x79, 0x75, 0x6e, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4c, 0x6f, 0x67, 0x67,
|
||||
0x65, 0x72, 0x2e, 0x41, 0x6c, 0x69, 0x79, 0x75, 0x6e, 0x48, 0x03, 0x52, 0x06, 0x61, 0x6c, 0x69,
|
||||
0x79, 0x75, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x65, 0x6e, 0x63, 0x65, 0x6e,
|
||||
0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4c,
|
||||
0x6f, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x48, 0x04, 0x52,
|
||||
0x07, 0x74, 0x65, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x1a, 0x8c, 0x01, 0x0a, 0x03,
|
||||
0x5a, 0x61, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
|
||||
0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x69, 0x7a,
|
||||
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65,
|
||||
0x12, 0x17, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x06, 0x6d, 0x61, 0x78, 0x41, 0x67, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x61, 0x78,
|
||||
0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a,
|
||||
0x6d, 0x61, 0x78, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x73, 0x1a, 0xbb, 0x01, 0x0a, 0x06, 0x4c,
|
||||
0x6f, 0x67, 0x72, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x66,
|
||||
0x6f, 0x72, 0x6d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
|
||||
0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x12, 0x29, 0x0a, 0x10, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x46, 0x6f,
|
||||
0x72, 0x6d, 0x61, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f,
|
||||
0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x64, 0x69,
|
||||
0x73, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x64,
|
||||
0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
|
||||
0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x54,
|
||||
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x1a, 0x24, 0x0a, 0x06, 0x46, 0x6c, 0x75, 0x65,
|
||||
0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x1a, 0x82,
|
||||
0x01, 0x0a, 0x06, 0x41, 0x6c, 0x69, 0x79, 0x75, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64,
|
||||
0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64,
|
||||
0x70, 0x6f, 0x69, 0x6e, 0x74, 0x1a, 0x82, 0x01, 0x0a, 0x06, 0x41, 0x6c, 0x69, 0x79, 0x75, 0x6e,
|
||||
0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07,
|
||||
0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70,
|
||||
0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73,
|
||||
0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12,
|
||||
0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x23,
|
||||
0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18,
|
||||
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x53, 0x65, 0x63,
|
||||
0x72, 0x65, 0x74, 0x1a, 0x84, 0x01, 0x0a, 0x07, 0x54, 0x65, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x12,
|
||||
0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x74,
|
||||
0x6f, 0x70, 0x69, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74,
|
||||
0x6f, 0x70, 0x69, 0x63, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73,
|
||||
0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x63, 0x63, 0x65,
|
||||
0x73, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f,
|
||||
0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63,
|
||||
0x63, 0x65, 0x73, 0x73, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x1a, 0x84, 0x01, 0x0a, 0x07, 0x54,
|
||||
0x65, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69,
|
||||
0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69,
|
||||
0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x49, 0x64, 0x12, 0x1d, 0x0a,
|
||||
0x0a, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x09, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0d,
|
||||
0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x53, 0x65, 0x63, 0x72, 0x65,
|
||||
0x74, 0x42, 0x3b, 0x5a, 0x39, 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, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67,
|
||||
0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6e, 0x66, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x63, 0x65, 0x73, 0x73, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x7a,
|
||||
0x61, 0x70, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x6f, 0x67, 0x72, 0x75, 0x73, 0x42, 0x09, 0x0a,
|
||||
0x07, 0x5f, 0x66, 0x6c, 0x75, 0x65, 0x6e, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x61, 0x6c, 0x69,
|
||||
0x79, 0x75, 0x6e, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x74, 0x65, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x42,
|
||||
0x87, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x15, 0x4b, 0x72,
|
||||
0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 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 (
|
||||
@@ -641,6 +651,7 @@ func file_conf_v1_kratos_conf_logger_proto_init() {
|
||||
}
|
||||
}
|
||||
}
|
||||
file_conf_v1_kratos_conf_logger_proto_msgTypes[0].OneofWrappers = []interface{}{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
@@ -4,7 +4,7 @@
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_middleware.proto
|
||||
|
||||
package conf
|
||||
package v1
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
@@ -344,11 +344,16 @@ var file_conf_v1_kratos_conf_middleware_proto_rawDesc = []byte{
|
||||
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, 0x3b, 0x5a, 0x39, 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, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f,
|
||||
0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
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 (
|
||||
@@ -4,7 +4,7 @@
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_notify.proto
|
||||
|
||||
package conf
|
||||
package v1
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
@@ -158,11 +158,16 @@ var file_conf_v1_kratos_conf_notify_proto_rawDesc = []byte{
|
||||
0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x63, 0x63, 0x65,
|
||||
0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x53, 0x65,
|
||||
0x63, 0x72, 0x65, 0x74, 0x42, 0x3b, 0x5a, 0x39, 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, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70,
|
||||
0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x63, 0x72, 0x65, 0x74, 0x42, 0x87, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x42, 0x15, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x4e, 0x6f, 0x74,
|
||||
0x69, 0x66, 0x79, 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 (
|
||||
@@ -4,7 +4,7 @@
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_oss.proto
|
||||
|
||||
package conf
|
||||
package v1
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
@@ -73,13 +73,14 @@ type OSS_MinIO struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Endpoint string `protobuf:"bytes,1,opt,name=endpoint,proto3" json:"endpoint,omitempty"` // 对端端口
|
||||
AccessKey string `protobuf:"bytes,2,opt,name=access_key,json=accessKey,proto3" json:"access_key,omitempty"` // 访问密钥
|
||||
SecretKey string `protobuf:"bytes,3,opt,name=secret_key,json=secretKey,proto3" json:"secret_key,omitempty"` // 密钥
|
||||
Token string `protobuf:"bytes,4,opt,name=token,proto3" json:"token,omitempty"` // 令牌
|
||||
UseSsl bool `protobuf:"varint,5,opt,name=use_ssl,json=useSsl,proto3" json:"use_ssl,omitempty"` // 使用SSL
|
||||
UploadHost string `protobuf:"bytes,6,opt,name=upload_host,json=uploadHost,proto3" json:"upload_host,omitempty"` // 上传链接的主机名
|
||||
DownloadHost string `protobuf:"bytes,7,opt,name=download_host,json=downloadHost,proto3" json:"download_host,omitempty"` // 下载链接的主机名
|
||||
Endpoint string `protobuf:"bytes,1,opt,name=endpoint,proto3" json:"endpoint,omitempty"` // 对端端口
|
||||
AccessKey string `protobuf:"bytes,2,opt,name=access_key,json=accessKey,proto3" json:"access_key,omitempty"` // 访问密钥
|
||||
SecretKey string `protobuf:"bytes,3,opt,name=secret_key,json=secretKey,proto3" json:"secret_key,omitempty"` // 密钥
|
||||
Token string `protobuf:"bytes,4,opt,name=token,proto3" json:"token,omitempty"` // 令牌
|
||||
UseSsl bool `protobuf:"varint,10,opt,name=use_ssl,json=useSsl,proto3" json:"use_ssl,omitempty"` // 使用SSL
|
||||
Tls *TLS `protobuf:"bytes,11,opt,name=tls,proto3" json:"tls,omitempty"` // TLS配置
|
||||
UploadHost string `protobuf:"bytes,20,opt,name=upload_host,json=uploadHost,proto3" json:"upload_host,omitempty"` // 上传链接的主机名
|
||||
DownloadHost string `protobuf:"bytes,21,opt,name=download_host,json=downloadHost,proto3" json:"download_host,omitempty"` // 下载链接的主机名
|
||||
}
|
||||
|
||||
func (x *OSS_MinIO) Reset() {
|
||||
@@ -149,6 +150,13 @@ func (x *OSS_MinIO) GetUseSsl() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *OSS_MinIO) GetTls() *TLS {
|
||||
if x != nil {
|
||||
return x.Tls
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *OSS_MinIO) GetUploadHost() string {
|
||||
if x != nil {
|
||||
return x.UploadHost
|
||||
@@ -168,28 +176,36 @@ var File_conf_v1_kratos_conf_oss_proto protoreflect.FileDescriptor
|
||||
var file_conf_v1_kratos_conf_oss_proto_rawDesc = []byte{
|
||||
0x0a, 0x1d, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x6f, 0x73, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
||||
0x04, 0x63, 0x6f, 0x6e, 0x66, 0x22, 0x85, 0x02, 0x0a, 0x03, 0x4f, 0x53, 0x53, 0x12, 0x25, 0x0a,
|
||||
0x05, 0x6d, 0x69, 0x6e, 0x69, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x2e, 0x4f, 0x53, 0x53, 0x2e, 0x4d, 0x69, 0x6e, 0x49, 0x4f, 0x52, 0x05, 0x6d,
|
||||
0x69, 0x6e, 0x69, 0x6f, 0x1a, 0xd6, 0x01, 0x0a, 0x05, 0x4d, 0x69, 0x6e, 0x49, 0x4f, 0x12, 0x1a,
|
||||
0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63,
|
||||
0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
|
||||
0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x63,
|
||||
0x72, 0x65, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73,
|
||||
0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65,
|
||||
0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x17,
|
||||
0x0a, 0x07, 0x75, 0x73, 0x65, 0x5f, 0x73, 0x73, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52,
|
||||
0x06, 0x75, 0x73, 0x65, 0x53, 0x73, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x6c, 0x6f, 0x61,
|
||||
0x64, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x75, 0x70,
|
||||
0x6c, 0x6f, 0x61, 0x64, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x6f, 0x77, 0x6e,
|
||||
0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x0c, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x6f, 0x73, 0x74, 0x42, 0x3b, 0x5a,
|
||||
0x39, 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, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
0x04, 0x63, 0x6f, 0x6e, 0x66, 0x1a, 0x1d, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b,
|
||||
0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x74, 0x6c, 0x73, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa2, 0x02, 0x0a, 0x03, 0x4f, 0x53, 0x53, 0x12, 0x25, 0x0a, 0x05,
|
||||
0x6d, 0x69, 0x6e, 0x69, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x2e, 0x4f, 0x53, 0x53, 0x2e, 0x4d, 0x69, 0x6e, 0x49, 0x4f, 0x52, 0x05, 0x6d, 0x69,
|
||||
0x6e, 0x69, 0x6f, 0x1a, 0xf3, 0x01, 0x0a, 0x05, 0x4d, 0x69, 0x6e, 0x49, 0x4f, 0x12, 0x1a, 0x0a,
|
||||
0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x63,
|
||||
0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61,
|
||||
0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x63, 0x72,
|
||||
0x65, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65,
|
||||
0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x17, 0x0a,
|
||||
0x07, 0x75, 0x73, 0x65, 0x5f, 0x73, 0x73, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06,
|
||||
0x75, 0x73, 0x65, 0x53, 0x73, 0x6c, 0x12, 0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18, 0x0b, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03,
|
||||
0x74, 0x6c, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x68, 0x6f,
|
||||
0x73, 0x74, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64,
|
||||
0x48, 0x6f, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64,
|
||||
0x5f, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x6f, 0x77,
|
||||
0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x6f, 0x73, 0x74, 0x42, 0x84, 0x01, 0x0a, 0x08, 0x63, 0x6f,
|
||||
0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x12, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f,
|
||||
0x6e, 0x66, 0x4f, 0x73, 0x73, 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 (
|
||||
@@ -208,14 +224,16 @@ var file_conf_v1_kratos_conf_oss_proto_msgTypes = make([]protoimpl.MessageInfo,
|
||||
var file_conf_v1_kratos_conf_oss_proto_goTypes = []interface{}{
|
||||
(*OSS)(nil), // 0: conf.OSS
|
||||
(*OSS_MinIO)(nil), // 1: conf.OSS.MinIO
|
||||
(*TLS)(nil), // 2: conf.TLS
|
||||
}
|
||||
var file_conf_v1_kratos_conf_oss_proto_depIdxs = []int32{
|
||||
1, // 0: conf.OSS.minio:type_name -> conf.OSS.MinIO
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] 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
|
||||
2, // 1: conf.OSS.MinIO.tls:type_name -> conf.TLS
|
||||
2, // [2:2] is the sub-list for method output_type
|
||||
2, // [2:2] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_conf_v1_kratos_conf_oss_proto_init() }
|
||||
@@ -223,6 +241,7 @@ func file_conf_v1_kratos_conf_oss_proto_init() {
|
||||
if File_conf_v1_kratos_conf_oss_proto != nil {
|
||||
return
|
||||
}
|
||||
file_conf_v1_kratos_conf_tls_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_conf_v1_kratos_conf_oss_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*OSS); i {
|
||||
@@ -4,7 +4,7 @@
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_registry.proto
|
||||
|
||||
package conf
|
||||
package v1
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
@@ -780,11 +780,16 @@ var file_conf_v1_kratos_conf_registry_proto_rawDesc = []byte{
|
||||
0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x1a, 0x2b, 0x0a, 0x0b,
|
||||
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x63, 0x6f, 0x6d, 0x62, 0x12, 0x1c, 0x0a, 0x09, 0x65,
|
||||
0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09,
|
||||
0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x42, 0x3b, 0x5a, 0x39, 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, 0x67,
|
||||
0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76,
|
||||
0x31, 0x3b, 0x63, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x42, 0x89, 0x01, 0x0a, 0x08, 0x63, 0x6f,
|
||||
0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x17, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f,
|
||||
0x6e, 0x66, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 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 (
|
||||
2523
api/gen/go/conf/v1/kratos_conf_server.pb.go
Normal file
2523
api/gen/go/conf/v1/kratos_conf_server.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
349
api/gen/go/conf/v1/kratos_conf_tls.pb.go
Normal file
349
api/gen/go/conf/v1/kratos_conf_tls.pb.go
Normal file
@@ -0,0 +1,349 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_tls.proto
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
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)
|
||||
)
|
||||
|
||||
type TLS struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
File *TLS_File `protobuf:"bytes,1,opt,name=file,proto3,oneof" json:"file,omitempty"`
|
||||
Config *TLS_Config `protobuf:"bytes,2,opt,name=config,proto3,oneof" json:"config,omitempty"`
|
||||
InsecureSkipVerify bool `protobuf:"varint,3,opt,name=insecure_skip_verify,json=insecureSkipVerify,proto3" json:"insecure_skip_verify,omitempty"`
|
||||
}
|
||||
|
||||
func (x *TLS) Reset() {
|
||||
*x = TLS{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_conf_v1_kratos_conf_tls_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *TLS) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*TLS) ProtoMessage() {}
|
||||
|
||||
func (x *TLS) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_tls_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 TLS.ProtoReflect.Descriptor instead.
|
||||
func (*TLS) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_tls_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *TLS) GetFile() *TLS_File {
|
||||
if x != nil {
|
||||
return x.File
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *TLS) GetConfig() *TLS_Config {
|
||||
if x != nil {
|
||||
return x.Config
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *TLS) GetInsecureSkipVerify() bool {
|
||||
if x != nil {
|
||||
return x.InsecureSkipVerify
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type TLS_File struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
CertPath *string `protobuf:"bytes,1,opt,name=cert_path,json=certPath,proto3,oneof" json:"cert_path,omitempty"`
|
||||
KeyPath *string `protobuf:"bytes,2,opt,name=key_path,json=keyPath,proto3,oneof" json:"key_path,omitempty"`
|
||||
CaPath *string `protobuf:"bytes,3,opt,name=ca_path,json=caPath,proto3,oneof" json:"ca_path,omitempty"`
|
||||
}
|
||||
|
||||
func (x *TLS_File) Reset() {
|
||||
*x = TLS_File{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_conf_v1_kratos_conf_tls_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *TLS_File) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*TLS_File) ProtoMessage() {}
|
||||
|
||||
func (x *TLS_File) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_tls_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 TLS_File.ProtoReflect.Descriptor instead.
|
||||
func (*TLS_File) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_tls_proto_rawDescGZIP(), []int{0, 0}
|
||||
}
|
||||
|
||||
func (x *TLS_File) GetCertPath() string {
|
||||
if x != nil && x.CertPath != nil {
|
||||
return *x.CertPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *TLS_File) GetKeyPath() string {
|
||||
if x != nil && x.KeyPath != nil {
|
||||
return *x.KeyPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *TLS_File) GetCaPath() string {
|
||||
if x != nil && x.CaPath != nil {
|
||||
return *x.CaPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type TLS_Config struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
CertPem []byte `protobuf:"bytes,1,opt,name=cert_pem,json=certPem,proto3,oneof" json:"cert_pem,omitempty"`
|
||||
KeyPem []byte `protobuf:"bytes,2,opt,name=key_pem,json=keyPem,proto3,oneof" json:"key_pem,omitempty"`
|
||||
CaPem []byte `protobuf:"bytes,3,opt,name=ca_pem,json=caPem,proto3,oneof" json:"ca_pem,omitempty"`
|
||||
}
|
||||
|
||||
func (x *TLS_Config) Reset() {
|
||||
*x = TLS_Config{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_conf_v1_kratos_conf_tls_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *TLS_Config) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*TLS_Config) ProtoMessage() {}
|
||||
|
||||
func (x *TLS_Config) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_tls_proto_msgTypes[2]
|
||||
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 TLS_Config.ProtoReflect.Descriptor instead.
|
||||
func (*TLS_Config) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_tls_proto_rawDescGZIP(), []int{0, 1}
|
||||
}
|
||||
|
||||
func (x *TLS_Config) GetCertPem() []byte {
|
||||
if x != nil {
|
||||
return x.CertPem
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *TLS_Config) GetKeyPem() []byte {
|
||||
if x != nil {
|
||||
return x.KeyPem
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *TLS_Config) GetCaPem() []byte {
|
||||
if x != nil {
|
||||
return x.CaPem
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_conf_v1_kratos_conf_tls_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_tls_proto_rawDesc = []byte{
|
||||
0x0a, 0x1d, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x74, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
||||
0x04, 0x63, 0x6f, 0x6e, 0x66, 0x22, 0xbc, 0x03, 0x0a, 0x03, 0x54, 0x4c, 0x53, 0x12, 0x27, 0x0a,
|
||||
0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x48, 0x00, 0x52, 0x04, 0x66,
|
||||
0x69, 0x6c, 0x65, 0x88, 0x01, 0x01, 0x12, 0x2d, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c,
|
||||
0x53, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x01, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x69, 0x67, 0x88, 0x01, 0x01, 0x12, 0x30, 0x0a, 0x14, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72,
|
||||
0x65, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x12, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x53, 0x6b, 0x69,
|
||||
0x70, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x1a, 0x8d, 0x01, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65,
|
||||
0x12, 0x20, 0x0a, 0x09, 0x63, 0x65, 0x72, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x63, 0x65, 0x72, 0x74, 0x50, 0x61, 0x74, 0x68, 0x88,
|
||||
0x01, 0x01, 0x12, 0x1e, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x50, 0x61, 0x74, 0x68, 0x88,
|
||||
0x01, 0x01, 0x12, 0x1c, 0x0a, 0x07, 0x63, 0x61, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x06, 0x63, 0x61, 0x50, 0x61, 0x74, 0x68, 0x88, 0x01, 0x01,
|
||||
0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x42, 0x0b,
|
||||
0x0a, 0x09, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x42, 0x0a, 0x0a, 0x08, 0x5f,
|
||||
0x63, 0x61, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x1a, 0x86, 0x01, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66,
|
||||
0x69, 0x67, 0x12, 0x1e, 0x0a, 0x08, 0x63, 0x65, 0x72, 0x74, 0x5f, 0x70, 0x65, 0x6d, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x07, 0x63, 0x65, 0x72, 0x74, 0x50, 0x65, 0x6d, 0x88,
|
||||
0x01, 0x01, 0x12, 0x1c, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x65, 0x6d, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x0c, 0x48, 0x01, 0x52, 0x06, 0x6b, 0x65, 0x79, 0x50, 0x65, 0x6d, 0x88, 0x01, 0x01,
|
||||
0x12, 0x1a, 0x0a, 0x06, 0x63, 0x61, 0x5f, 0x70, 0x65, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c,
|
||||
0x48, 0x02, 0x52, 0x05, 0x63, 0x61, 0x50, 0x65, 0x6d, 0x88, 0x01, 0x01, 0x42, 0x0b, 0x0a, 0x09,
|
||||
0x5f, 0x63, 0x65, 0x72, 0x74, 0x5f, 0x70, 0x65, 0x6d, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6b, 0x65,
|
||||
0x79, 0x5f, 0x70, 0x65, 0x6d, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x61, 0x5f, 0x70, 0x65, 0x6d,
|
||||
0x42, 0x07, 0x0a, 0x05, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x69, 0x67, 0x42, 0x84, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x42, 0x12, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x54, 0x6c, 0x73,
|
||||
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 (
|
||||
file_conf_v1_kratos_conf_tls_proto_rawDescOnce sync.Once
|
||||
file_conf_v1_kratos_conf_tls_proto_rawDescData = file_conf_v1_kratos_conf_tls_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_conf_v1_kratos_conf_tls_proto_rawDescGZIP() []byte {
|
||||
file_conf_v1_kratos_conf_tls_proto_rawDescOnce.Do(func() {
|
||||
file_conf_v1_kratos_conf_tls_proto_rawDescData = protoimpl.X.CompressGZIP(file_conf_v1_kratos_conf_tls_proto_rawDescData)
|
||||
})
|
||||
return file_conf_v1_kratos_conf_tls_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_conf_v1_kratos_conf_tls_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_conf_v1_kratos_conf_tls_proto_goTypes = []interface{}{
|
||||
(*TLS)(nil), // 0: conf.TLS
|
||||
(*TLS_File)(nil), // 1: conf.TLS.File
|
||||
(*TLS_Config)(nil), // 2: conf.TLS.Config
|
||||
}
|
||||
var file_conf_v1_kratos_conf_tls_proto_depIdxs = []int32{
|
||||
1, // 0: conf.TLS.file:type_name -> conf.TLS.File
|
||||
2, // 1: conf.TLS.config:type_name -> conf.TLS.Config
|
||||
2, // [2:2] is the sub-list for method output_type
|
||||
2, // [2:2] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_conf_v1_kratos_conf_tls_proto_init() }
|
||||
func file_conf_v1_kratos_conf_tls_proto_init() {
|
||||
if File_conf_v1_kratos_conf_tls_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_conf_v1_kratos_conf_tls_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*TLS); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_conf_v1_kratos_conf_tls_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*TLS_File); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_conf_v1_kratos_conf_tls_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*TLS_Config); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
file_conf_v1_kratos_conf_tls_proto_msgTypes[0].OneofWrappers = []interface{}{}
|
||||
file_conf_v1_kratos_conf_tls_proto_msgTypes[1].OneofWrappers = []interface{}{}
|
||||
file_conf_v1_kratos_conf_tls_proto_msgTypes[2].OneofWrappers = []interface{}{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_conf_v1_kratos_conf_tls_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_conf_v1_kratos_conf_tls_proto_goTypes,
|
||||
DependencyIndexes: file_conf_v1_kratos_conf_tls_proto_depIdxs,
|
||||
MessageInfos: file_conf_v1_kratos_conf_tls_proto_msgTypes,
|
||||
}.Build()
|
||||
File_conf_v1_kratos_conf_tls_proto = out.File
|
||||
file_conf_v1_kratos_conf_tls_proto_rawDesc = nil
|
||||
file_conf_v1_kratos_conf_tls_proto_goTypes = nil
|
||||
file_conf_v1_kratos_conf_tls_proto_depIdxs = nil
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_tracer.proto
|
||||
|
||||
package conf
|
||||
package v1
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
@@ -30,6 +30,7 @@ type Tracer struct {
|
||||
Endpoint string `protobuf:"bytes,2,opt,name=endpoint,proto3" json:"endpoint,omitempty"` // 端口
|
||||
Sampler float64 `protobuf:"fixed64,3,opt,name=sampler,proto3" json:"sampler,omitempty"` // 采样率,默认:1.0
|
||||
Env string `protobuf:"bytes,4,opt,name=env,proto3" json:"env,omitempty"` // 运行环境:dev、debug、product
|
||||
Insecure bool `protobuf:"varint,5,opt,name=insecure,proto3" json:"insecure,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Tracer) Reset() {
|
||||
@@ -92,23 +93,37 @@ func (x *Tracer) GetEnv() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Tracer) GetInsecure() bool {
|
||||
if x != nil {
|
||||
return x.Insecure
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var File_conf_v1_kratos_conf_tracer_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_tracer_proto_rawDesc = []byte{
|
||||
0x0a, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x22, 0x6a, 0x0a, 0x06, 0x54, 0x72, 0x61, 0x63,
|
||||
0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08,
|
||||
0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
|
||||
0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x61, 0x6d, 0x70,
|
||||
0x6c, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x73, 0x61, 0x6d, 0x70, 0x6c,
|
||||
0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x76, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x03, 0x65, 0x6e, 0x76, 0x42, 0x3b, 0x5a, 0x39, 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, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70,
|
||||
0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x22, 0x86, 0x01, 0x0a, 0x06, 0x54, 0x72, 0x61,
|
||||
0x63, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x1a, 0x0a,
|
||||
0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x61, 0x6d,
|
||||
0x70, 0x6c, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x73, 0x61, 0x6d, 0x70,
|
||||
0x6c, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x76, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x03, 0x65, 0x6e, 0x76, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72,
|
||||
0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72,
|
||||
0x65, 0x42, 0x87, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x15,
|
||||
0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x54, 0x72, 0x61, 0x63, 0x65, 0x72,
|
||||
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 (
|
||||
340
api/gen/go/pagination/v1/pagination.pb.go
Normal file
340
api/gen/go/pagination/v1/pagination.pb.go
Normal file
@@ -0,0 +1,340 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc (unknown)
|
||||
// source: pagination/v1/pagination.proto
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
_ "github.com/google/gnostic/openapiv3"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
anypb "google.golang.org/protobuf/types/known/anypb"
|
||||
fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb"
|
||||
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)
|
||||
)
|
||||
|
||||
// 分页通用请求
|
||||
type PagingRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// 当前页码
|
||||
Page *int32 `protobuf:"varint,1,opt,name=page,proto3,oneof" json:"page,omitempty"`
|
||||
// 每页的行数
|
||||
PageSize *int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3,oneof" json:"page_size,omitempty"`
|
||||
// 与过滤参数
|
||||
Query *string `protobuf:"bytes,3,opt,name=query,proto3,oneof" json:"query,omitempty"`
|
||||
// 或过滤参数
|
||||
OrQuery *string `protobuf:"bytes,4,opt,name=or_query,json=or,proto3,oneof" json:"or_query,omitempty"`
|
||||
// 排序条件
|
||||
OrderBy []string `protobuf:"bytes,5,rep,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"`
|
||||
// 是否不分页
|
||||
NoPaging *bool `protobuf:"varint,6,opt,name=no_paging,json=nopaging,proto3,oneof" json:"no_paging,omitempty"`
|
||||
// 字段掩码
|
||||
FieldMask *fieldmaskpb.FieldMask `protobuf:"bytes,7,opt,name=field_mask,json=fieldMask,proto3" json:"field_mask,omitempty"`
|
||||
}
|
||||
|
||||
func (x *PagingRequest) Reset() {
|
||||
*x = PagingRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pagination_v1_pagination_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PagingRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PagingRequest) ProtoMessage() {}
|
||||
|
||||
func (x *PagingRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pagination_v1_pagination_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 PagingRequest.ProtoReflect.Descriptor instead.
|
||||
func (*PagingRequest) Descriptor() ([]byte, []int) {
|
||||
return file_pagination_v1_pagination_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *PagingRequest) GetPage() int32 {
|
||||
if x != nil && x.Page != nil {
|
||||
return *x.Page
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PagingRequest) GetPageSize() int32 {
|
||||
if x != nil && x.PageSize != nil {
|
||||
return *x.PageSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PagingRequest) GetQuery() string {
|
||||
if x != nil && x.Query != nil {
|
||||
return *x.Query
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PagingRequest) GetOrQuery() string {
|
||||
if x != nil && x.OrQuery != nil {
|
||||
return *x.OrQuery
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *PagingRequest) GetOrderBy() []string {
|
||||
if x != nil {
|
||||
return x.OrderBy
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *PagingRequest) GetNoPaging() bool {
|
||||
if x != nil && x.NoPaging != nil {
|
||||
return *x.NoPaging
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *PagingRequest) GetFieldMask() *fieldmaskpb.FieldMask {
|
||||
if x != nil {
|
||||
return x.FieldMask
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 分页通用结果
|
||||
type PagingResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// 总数
|
||||
Total int32 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
|
||||
// 分页数据
|
||||
Items []*anypb.Any `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"`
|
||||
}
|
||||
|
||||
func (x *PagingResponse) Reset() {
|
||||
*x = PagingResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pagination_v1_pagination_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PagingResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PagingResponse) ProtoMessage() {}
|
||||
|
||||
func (x *PagingResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pagination_v1_pagination_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 PagingResponse.ProtoReflect.Descriptor instead.
|
||||
func (*PagingResponse) Descriptor() ([]byte, []int) {
|
||||
return file_pagination_v1_pagination_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *PagingResponse) GetTotal() int32 {
|
||||
if x != nil {
|
||||
return x.Total
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *PagingResponse) GetItems() []*anypb.Any {
|
||||
if x != nil {
|
||||
return x.Items
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_pagination_v1_pagination_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_pagination_v1_pagination_proto_rawDesc = []byte{
|
||||
0x0a, 0x1e, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f,
|
||||
0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x12, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x19, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e,
|
||||
0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 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,
|
||||
0xb1, 0x05, 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, 0xb5, 0xe7, 0xa0, 0x81, 0x48,
|
||||
0x00, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x12, 0x46, 0x0a, 0x09, 0x70, 0x61,
|
||||
0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x42, 0x24, 0xba,
|
||||
0x47, 0x21, 0x8a, 0x02, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x40, 0x92, 0x02,
|
||||
0x12, 0xe6, 0xaf, 0x8f, 0xe4, 0xb8, 0x80, 0xe9, 0xa1, 0xb5, 0xe7, 0x9a, 0x84, 0xe8, 0xa1, 0x8c,
|
||||
0xe6, 0x95, 0xb0, 0x48, 0x01, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x88,
|
||||
0x01, 0x01, 0x12, 0x51, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x09, 0x42, 0x36, 0xba, 0x47, 0x33, 0x3a, 0x1f, 0x12, 0x1d, 0x7b, 0x22, 0x6b, 0x65, 0x79, 0x31,
|
||||
0x22, 0x3a, 0x22, 0x76, 0x61, 0x6c, 0x31, 0x22, 0x2c, 0x22, 0x6b, 0x65, 0x79, 0x32, 0x22, 0x3a,
|
||||
0x22, 0x76, 0x61, 0x6c, 0x32, 0x22, 0x7d, 0x92, 0x02, 0x0f, 0xe4, 0xb8, 0x8e, 0xe8, 0xbf, 0x87,
|
||||
0xe6, 0xbb, 0xa4, 0xe5, 0x8f, 0x82, 0xe6, 0x95, 0xb0, 0x48, 0x02, 0x52, 0x05, 0x71, 0x75, 0x65,
|
||||
0x72, 0x79, 0x88, 0x01, 0x01, 0x12, 0x51, 0x0a, 0x08, 0x6f, 0x72, 0x5f, 0x71, 0x75, 0x65, 0x72,
|
||||
0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x36, 0xba, 0x47, 0x33, 0x3a, 0x1f, 0x12, 0x1d,
|
||||
0x7b, 0x22, 0x6b, 0x65, 0x79, 0x31, 0x22, 0x3a, 0x22, 0x76, 0x61, 0x6c, 0x31, 0x22, 0x2c, 0x22,
|
||||
0x6b, 0x65, 0x79, 0x32, 0x22, 0x3a, 0x22, 0x76, 0x61, 0x6c, 0x32, 0x22, 0x7d, 0x92, 0x02, 0x0f,
|
||||
0xe6, 0x88, 0x96, 0xe8, 0xbf, 0x87, 0xe6, 0xbb, 0xa4, 0xe5, 0x8f, 0x82, 0xe6, 0x95, 0xb0, 0x48,
|
||||
0x03, 0x52, 0x02, 0x6f, 0x72, 0x88, 0x01, 0x01, 0x12, 0x75, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65,
|
||||
0x72, 0x5f, 0x62, 0x79, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x42, 0x5a, 0xba, 0x47, 0x57, 0x3a,
|
||||
0x13, 0x12, 0x11, 0x7b, 0x22, 0x76, 0x61, 0x6c, 0x31, 0x22, 0x2c, 0x20, 0x22, 0x2d, 0x76, 0x61,
|
||||
0x6c, 0x32, 0x22, 0x7d, 0x92, 0x02, 0x3f, 0xe6, 0x8e, 0x92, 0xe5, 0xba, 0x8f, 0xe6, 0x9d, 0xa1,
|
||||
0xe4, 0xbb, 0xb6, 0xef, 0xbc, 0x8c, 0xe5, 0xad, 0x97, 0xe6, 0xae, 0xb5, 0xe5, 0x90, 0x8d, 0xe5,
|
||||
0x89, 0x8d, 0xe5, 0x8a, 0xa0, 0x27, 0x2d, 0x27, 0xe4, 0xb8, 0xba, 0xe9, 0x99, 0x8d, 0xe5, 0xba,
|
||||
0x8f, 0xef, 0xbc, 0x8c, 0xe5, 0x90, 0xa6, 0xe5, 0x88, 0x99, 0xe4, 0xb8, 0xba, 0xe5, 0x8d, 0x87,
|
||||
0xe5, 0xba, 0x8f, 0xe3, 0x80, 0x82, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x42, 0x79, 0x12,
|
||||
0x37, 0x0a, 0x09, 0x6e, 0x6f, 0x5f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x18, 0x06, 0x20, 0x01,
|
||||
0x28, 0x08, 0x42, 0x15, 0xba, 0x47, 0x12, 0x92, 0x02, 0x0f, 0xe6, 0x98, 0xaf, 0xe5, 0x90, 0xa6,
|
||||
0xe4, 0xb8, 0x8d, 0xe5, 0x88, 0x86, 0xe9, 0xa1, 0xb5, 0x48, 0x04, 0x52, 0x08, 0x6e, 0x6f, 0x70,
|
||||
0x61, 0x67, 0x69, 0x6e, 0x67, 0x88, 0x01, 0x01, 0x12, 0x8c, 0x01, 0x0a, 0x0a, 0x66, 0x69, 0x65,
|
||||
0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
|
||||
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
|
||||
0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x42, 0x51, 0xba, 0x47, 0x4e, 0x3a, 0x16,
|
||||
0x12, 0x14, 0x69, 0x64, 0x2c, 0x72, 0x65, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x2c, 0x75, 0x73,
|
||||
0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x92, 0x02, 0x33, 0xe5, 0xad, 0x97, 0xe6, 0xae, 0xb5, 0xe6,
|
||||
0x8e, 0xa9, 0xe7, 0xa0, 0x81, 0xef, 0xbc, 0x8c, 0xe5, 0xa6, 0x82, 0xe6, 0x9e, 0x9c, 0xe4, 0xb8,
|
||||
0xba, 0xe7, 0xa9, 0xba, 0xe5, 0x88, 0x99, 0xe9, 0x80, 0x89, 0xe4, 0xb8, 0xad, 0xe6, 0x89, 0x80,
|
||||
0xe6, 0x9c, 0x89, 0xe5, 0xad, 0x97, 0xe6, 0xae, 0xb5, 0xe3, 0x80, 0x82, 0x52, 0x09, 0x66, 0x69,
|
||||
0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 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, 0x22, 0x52, 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, 0x2a, 0x0a, 0x05, 0x69,
|
||||
0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f,
|
||||
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79,
|
||||
0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x42, 0xa5, 0x01, 0x0a, 0x0e, 0x63, 0x6f, 0x6d, 0x2e,
|
||||
0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0f, 0x50, 0x61, 0x67, 0x69,
|
||||
0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3a, 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, 0x70, 0x61, 0x67, 0x69,
|
||||
0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x50, 0x58, 0x58, 0xaa,
|
||||
0x02, 0x0a, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca, 0x02, 0x0a, 0x50,
|
||||
0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x16, 0x50, 0x61, 0x67, 0x69,
|
||||
0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,
|
||||
0x74, 0x61, 0xea, 0x02, 0x0a, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_pagination_v1_pagination_proto_rawDescOnce sync.Once
|
||||
file_pagination_v1_pagination_proto_rawDescData = file_pagination_v1_pagination_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_pagination_v1_pagination_proto_rawDescGZIP() []byte {
|
||||
file_pagination_v1_pagination_proto_rawDescOnce.Do(func() {
|
||||
file_pagination_v1_pagination_proto_rawDescData = protoimpl.X.CompressGZIP(file_pagination_v1_pagination_proto_rawDescData)
|
||||
})
|
||||
return file_pagination_v1_pagination_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_pagination_v1_pagination_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_pagination_v1_pagination_proto_goTypes = []interface{}{
|
||||
(*PagingRequest)(nil), // 0: pagination.PagingRequest
|
||||
(*PagingResponse)(nil), // 1: pagination.PagingResponse
|
||||
(*fieldmaskpb.FieldMask)(nil), // 2: google.protobuf.FieldMask
|
||||
(*anypb.Any)(nil), // 3: google.protobuf.Any
|
||||
}
|
||||
var file_pagination_v1_pagination_proto_depIdxs = []int32{
|
||||
2, // 0: pagination.PagingRequest.field_mask:type_name -> google.protobuf.FieldMask
|
||||
3, // 1: pagination.PagingResponse.items:type_name -> google.protobuf.Any
|
||||
2, // [2:2] is the sub-list for method output_type
|
||||
2, // [2:2] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_pagination_v1_pagination_proto_init() }
|
||||
func file_pagination_v1_pagination_proto_init() {
|
||||
if File_pagination_v1_pagination_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_pagination_v1_pagination_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PagingRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_pagination_v1_pagination_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PagingResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
file_pagination_v1_pagination_proto_msgTypes[0].OneofWrappers = []interface{}{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_pagination_v1_pagination_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_pagination_v1_pagination_proto_goTypes,
|
||||
DependencyIndexes: file_pagination_v1_pagination_proto_depIdxs,
|
||||
MessageInfos: file_pagination_v1_pagination_proto_msgTypes,
|
||||
}.Build()
|
||||
File_pagination_v1_pagination_proto = out.File
|
||||
file_pagination_v1_pagination_proto_rawDesc = nil
|
||||
file_pagination_v1_pagination_proto_goTypes = nil
|
||||
file_pagination_v1_pagination_proto_depIdxs = nil
|
||||
}
|
||||
18
api/go.mod
Normal file
18
api/go.mod
Normal file
@@ -0,0 +1,18 @@
|
||||
module github.com/tx7do/kratos-bootstrap/api
|
||||
|
||||
go 1.22.0
|
||||
|
||||
toolchain go1.22.1
|
||||
|
||||
require (
|
||||
github.com/google/gnostic v0.7.0
|
||||
google.golang.org/protobuf v1.35.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/kr/pretty v0.3.1 // indirect
|
||||
github.com/rogpeppe/go-internal v1.10.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
1523
api/go.sum
Normal file
1523
api/go.sum
Normal file
File diff suppressed because it is too large
Load Diff
28
api/protos/buf.lock
Normal file
28
api/protos/buf.lock
Normal file
@@ -0,0 +1,28 @@
|
||||
# Generated by buf. DO NOT EDIT.
|
||||
version: v1
|
||||
deps:
|
||||
- remote: buf.build
|
||||
owner: envoyproxy
|
||||
repository: protoc-gen-validate
|
||||
commit: eac44469a7af47e7839a7f1f3d7ac004
|
||||
digest: shake256:0feabcde01b6b11e3c75a5e3f807968d5995626546f39c37e5d4205892b3a59cced0ed83b35a2eb9e6dddd3309660ad46b737c9dcd224b425de0a6654ce04417
|
||||
- remote: buf.build
|
||||
owner: gnostic
|
||||
repository: gnostic
|
||||
commit: 087bc8072ce44e339f213209e4d57bf0
|
||||
digest: shake256:4689c26f0460fea84c4c277c1b9c7e7d657388c5b4116d1065f907a92100ffbea87de05bbd138a0166411361e1f6ce063b4c0c6002358d39710f3c4a8de788d5
|
||||
- remote: buf.build
|
||||
owner: gogo
|
||||
repository: protobuf
|
||||
commit: 5461a3dfa9d941da82028ab185dc2a0e
|
||||
digest: shake256:37c7c75224982038cb1abf45b481ef06716c1f806ffaa162018d0df092bd11a2a9b62c2d0dc0a2ae43beff86b6014fc0eb8c594ffd84d52ade4b08fca901eadc
|
||||
- remote: buf.build
|
||||
owner: googleapis
|
||||
repository: googleapis
|
||||
commit: 28151c0d0a1641bf938a7672c500e01d
|
||||
digest: shake256:49215edf8ef57f7863004539deff8834cfb2195113f0b890dd1f67815d9353e28e668019165b9d872395871eeafcbab3ccfdb2b5f11734d3cca95be9e8d139de
|
||||
- remote: buf.build
|
||||
owner: kratos
|
||||
repository: apis
|
||||
commit: c2de25f14fa445a79a054214f31d17a8
|
||||
digest: shake256:91c024935d46f7966667c29e4fc933435959f93c3f0e675e1227c99db09905d44f8ec275b770da7659df5a6b18f4710da157b6d8ad760a4a95f60365b231e637
|
||||
19
api/protos/buf.yaml
Normal file
19
api/protos/buf.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
version: v1
|
||||
|
||||
build:
|
||||
excludes: [third_party]
|
||||
|
||||
deps:
|
||||
- 'buf.build/googleapis/googleapis'
|
||||
- 'buf.build/envoyproxy/protoc-gen-validate'
|
||||
- 'buf.build/kratos/apis'
|
||||
- 'buf.build/gnostic/gnostic'
|
||||
- 'buf.build/gogo/protobuf'
|
||||
|
||||
breaking:
|
||||
use:
|
||||
- FILE
|
||||
|
||||
lint:
|
||||
use:
|
||||
- DEFAULT
|
||||
@@ -2,7 +2,7 @@ syntax = "proto3";
|
||||
|
||||
package conf;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1;conf";
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1;conf";
|
||||
|
||||
import "conf/v1/kratos_conf_tracer.proto";
|
||||
import "conf/v1/kratos_conf_data.proto";
|
||||
30
api/protos/conf/v1/kratos_conf_client.proto
Normal file
30
api/protos/conf/v1/kratos_conf_client.proto
Normal file
@@ -0,0 +1,30 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package conf;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1;conf";
|
||||
|
||||
import "google/protobuf/duration.proto";
|
||||
|
||||
import "conf/v1/kratos_conf_middleware.proto";
|
||||
import "conf/v1/kratos_conf_tls.proto";
|
||||
|
||||
// 客户端
|
||||
message Client {
|
||||
// REST
|
||||
message REST {
|
||||
google.protobuf.Duration timeout = 1; // 超时时间
|
||||
Middleware middleware = 2; // 中间件
|
||||
TLS tls = 3; // TLS配置
|
||||
}
|
||||
|
||||
// gPRC
|
||||
message GRPC {
|
||||
google.protobuf.Duration timeout = 1; // 超时时间
|
||||
Middleware middleware = 2; // 中间件
|
||||
TLS tls = 3; // TLS配置
|
||||
}
|
||||
|
||||
optional REST rest = 1; // REST服务
|
||||
optional GRPC grpc = 2; // gRPC服务
|
||||
}
|
||||
53
api/protos/conf/v1/kratos_conf_config.proto
Normal file
53
api/protos/conf/v1/kratos_conf_config.proto
Normal file
@@ -0,0 +1,53 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package conf;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1;conf";
|
||||
|
||||
import "google/protobuf/duration.proto";
|
||||
|
||||
// 配置服务
|
||||
message RemoteConfig {
|
||||
message Nacos {
|
||||
string address = 1; // 服务端地址
|
||||
uint64 port = 2; // 服务端端口
|
||||
string key = 3; // 配置键
|
||||
}
|
||||
|
||||
message Etcd {
|
||||
repeated string endpoints = 1; // 服务端地址
|
||||
google.protobuf.Duration timeout = 2; // 超时时间
|
||||
string key = 3; // 配置键
|
||||
}
|
||||
|
||||
message Consul {
|
||||
string scheme = 1; // 网络样式
|
||||
string address = 2; // 服务端地址
|
||||
string key = 3; // 配置键
|
||||
}
|
||||
|
||||
message Apollo {
|
||||
string endpoint = 1; // 服务端地址
|
||||
string app_id = 2; // 应用ID
|
||||
string cluster = 3; // 集群
|
||||
string namespace = 4; // 命名空间
|
||||
string secret = 5; // 密钥
|
||||
}
|
||||
|
||||
message Kubernetes {
|
||||
string namespace = 1; // 命名空间
|
||||
}
|
||||
|
||||
message Polaris {
|
||||
|
||||
}
|
||||
|
||||
string type = 1; // 配置类型
|
||||
|
||||
optional Etcd etcd = 2;
|
||||
optional Consul consul = 3;
|
||||
optional Nacos nacos = 4;
|
||||
optional Apollo apollo = 6;
|
||||
optional Kubernetes kubernetes = 7;
|
||||
optional Polaris polaris = 8;
|
||||
}
|
||||
193
api/protos/conf/v1/kratos_conf_data.proto
Normal file
193
api/protos/conf/v1/kratos_conf_data.proto
Normal file
@@ -0,0 +1,193 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package conf;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1;conf";
|
||||
|
||||
import "google/protobuf/duration.proto";
|
||||
|
||||
// 数据
|
||||
message Data {
|
||||
// 数据库
|
||||
message Database {
|
||||
string driver = 1; // 驱动名:mysql、postgresql、mongodb、sqlite……
|
||||
string source = 2; // 数据源(DSN字符串)
|
||||
|
||||
bool migrate = 10; // 数据迁移开关
|
||||
bool debug = 11; // 调试开关
|
||||
bool enable_trace = 12; // 链路追踪开关
|
||||
bool enable_metrics = 13; // 性能分析开关
|
||||
|
||||
int32 max_idle_connections = 20; // 连接池最大空闲连接数
|
||||
int32 max_open_connections = 21; // 连接池最大打开连接数
|
||||
google.protobuf.Duration connection_max_lifetime = 22; // 连接可重用的最大时间长度
|
||||
}
|
||||
|
||||
// redis
|
||||
message Redis {
|
||||
string network = 1; // 网络
|
||||
string addr = 2; // 服务端地址
|
||||
string password = 3; // 密码
|
||||
int32 db = 4; // 数据库索引
|
||||
|
||||
google.protobuf.Duration dial_timeout = 5; // 连接超时时间
|
||||
google.protobuf.Duration read_timeout = 6; // 读取超时时间
|
||||
google.protobuf.Duration write_timeout = 7; // 写入超时时间
|
||||
|
||||
bool enable_tracing = 8; // 打开链路追踪
|
||||
bool enable_metrics = 9; // 打开性能度量
|
||||
}
|
||||
|
||||
// MongoDB
|
||||
message MongoDB {
|
||||
string address = 1;
|
||||
string username = 2;
|
||||
string password = 3;
|
||||
}
|
||||
|
||||
// ClickHouse
|
||||
message ClickHouse {
|
||||
string address = 1;
|
||||
string database = 2;
|
||||
string username = 3;
|
||||
string password = 4;
|
||||
bool debug = 5;
|
||||
string compression_method = 6;
|
||||
google.protobuf.Duration dial_timeout = 7;
|
||||
int32 max_execution_time = 8;
|
||||
int32 max_open_conns = 9;
|
||||
int32 max_idle_conns = 10;
|
||||
google.protobuf.Duration conn_max_life_time = 11;
|
||||
int32 block_buffer_size = 12;
|
||||
int32 max_compression_buffer = 13;
|
||||
string conn_open_strategy = 14;
|
||||
int32 max_idle_connections = 15; // 连接池最大空闲连接数
|
||||
int32 max_open_connections = 16; // 连接池最大打开连接数
|
||||
google.protobuf.Duration connection_max_lifetime = 17; // 连接可重用的最大时间长度
|
||||
string protocol = 18;
|
||||
}
|
||||
|
||||
// InfluxDB
|
||||
message InfluxDB {
|
||||
string address = 1;
|
||||
string token = 2;
|
||||
string organization = 3;
|
||||
string bucket = 4;
|
||||
}
|
||||
|
||||
message Doris {
|
||||
string address = 1;
|
||||
}
|
||||
|
||||
message ElasticSearch {
|
||||
repeated string addresses = 1;
|
||||
string username = 2;
|
||||
string password = 3;
|
||||
bool enable_sniffer = 4;
|
||||
bool enable_gzip = 5;
|
||||
google.protobuf.Duration health_check_interval = 6;
|
||||
}
|
||||
|
||||
message Cassandra {
|
||||
string address = 1;
|
||||
string username = 2;
|
||||
string password = 3;
|
||||
string keyspace = 5;
|
||||
google.protobuf.Duration connect_timeout = 6;
|
||||
google.protobuf.Duration timeout = 7;
|
||||
uint32 consistency = 8;
|
||||
bool disable_initial_host_lookup = 9;
|
||||
bool ignore_peer_addr = 10;
|
||||
}
|
||||
|
||||
message Snowflake {
|
||||
|
||||
}
|
||||
|
||||
// Kafka
|
||||
message Kafka {
|
||||
repeated string endpoints = 1; // 对端网络地址
|
||||
|
||||
string codec = 2; // 编解码器
|
||||
|
||||
bool async = 3; // 异步发送
|
||||
bool allow_auto_topic_creation = 4; // 允许发送的时候自动创建主题
|
||||
|
||||
int32 batch_size = 5; // 批量发送量
|
||||
int64 batch_bytes = 6;// 批量发送字节数
|
||||
|
||||
google.protobuf.Duration batch_timeout = 7; // 批量发送超时时间
|
||||
google.protobuf.Duration read_timeout = 8; // 读取超时时间
|
||||
google.protobuf.Duration write_timeout = 9; // 发送超时时间
|
||||
}
|
||||
|
||||
// RabbitMQ
|
||||
message RabbitMQ {
|
||||
repeated string endpoints = 1; // 对端网络地址
|
||||
}
|
||||
|
||||
// MQTT
|
||||
message Mqtt {
|
||||
string endpoint = 1; // 对端网络地址
|
||||
string codec = 2; // 编解码器: json,xml,yaml...
|
||||
}
|
||||
|
||||
message ActiveMQ {
|
||||
string endpoint = 1; // 对端网络地址
|
||||
string codec = 2; // 编解码器: json,xml,yaml...
|
||||
}
|
||||
|
||||
message NATS {
|
||||
string endpoint = 1; // 对端网络地址
|
||||
string codec = 2; // 编解码器: json,xml,yaml...
|
||||
}
|
||||
|
||||
message NSQ {
|
||||
string endpoint = 1; // 对端网络地址
|
||||
string codec = 2; // 编解码器: json,xml,yaml...
|
||||
}
|
||||
|
||||
message Pulsar {
|
||||
string endpoint = 1; // 对端网络地址
|
||||
string codec = 2; // 编解码器: json,xml,yaml...
|
||||
}
|
||||
|
||||
message RocketMQ {
|
||||
string version = 1; // 驱动版本:aliyun、v2、v5
|
||||
string codec = 2; // 编解码器: json,xml,yaml...
|
||||
bool enable_trace = 3;
|
||||
|
||||
repeated string name_servers = 4;
|
||||
string name_server_domain = 5;
|
||||
|
||||
string access_key = 6;
|
||||
string secret_key = 7;
|
||||
string security_token = 8;
|
||||
|
||||
string namespace = 9;
|
||||
string instance_name = 10;
|
||||
string group_name = 11;
|
||||
}
|
||||
|
||||
optional Database database = 1; // 数据库DSN
|
||||
|
||||
optional Redis redis = 10; // Redis
|
||||
optional MongoDB mongodb = 11; // MongoDB数据库
|
||||
optional ElasticSearch elastic_search = 12; // ElasticSearch数据库
|
||||
optional Cassandra cassandra = 13; // Cassandra数据库
|
||||
|
||||
optional ClickHouse clickhouse = 20; // ClickHouse数据库
|
||||
optional InfluxDB influxdb = 21; // InfluxDB数据库
|
||||
optional Doris doris = 22; // Doris数据库
|
||||
|
||||
// Message Queue
|
||||
|
||||
optional Kafka kafka = 30; // Kafka服务
|
||||
optional RabbitMQ rabbitmq = 31; // RabbitMQ服务
|
||||
optional Mqtt mqtt = 32; // MQTT服务
|
||||
optional ActiveMQ activemq = 33; // ActiveMQ
|
||||
optional NATS nats = 34; // NATS
|
||||
optional NSQ nsq = 35; // NATS
|
||||
optional Pulsar pulsar = 36; // Pulsar
|
||||
optional RocketMQ rocketmq = 38; // RocketMQ
|
||||
}
|
||||
@@ -2,7 +2,7 @@ syntax = "proto3";
|
||||
|
||||
package conf;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1;conf";
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1;conf";
|
||||
|
||||
// 日志
|
||||
message Logger {
|
||||
@@ -47,9 +47,9 @@ message Logger {
|
||||
|
||||
string type = 1;
|
||||
|
||||
Zap zap = 2;
|
||||
Logrus logrus = 3;
|
||||
Fluent fluent = 4;
|
||||
Aliyun aliyun = 5;
|
||||
Tencent tencent = 6;
|
||||
optional Zap zap = 2;
|
||||
optional Logrus logrus = 3;
|
||||
optional Fluent fluent = 4;
|
||||
optional Aliyun aliyun = 5;
|
||||
optional Tencent tencent = 6;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ syntax = "proto3";
|
||||
|
||||
package conf;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1;conf";
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1;conf";
|
||||
|
||||
import "google/protobuf/duration.proto";
|
||||
|
||||
@@ -2,7 +2,7 @@ syntax = "proto3";
|
||||
|
||||
package conf;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1;conf";
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1;conf";
|
||||
|
||||
// 通知消息
|
||||
message Notification {
|
||||
25
api/protos/conf/v1/kratos_conf_oss.proto
Normal file
25
api/protos/conf/v1/kratos_conf_oss.proto
Normal file
@@ -0,0 +1,25 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package conf;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1;conf";
|
||||
|
||||
import "conf/v1/kratos_conf_tls.proto";
|
||||
|
||||
message OSS {
|
||||
// MinIO
|
||||
message MinIO {
|
||||
string endpoint = 1; // 对端端口
|
||||
string access_key = 2; // 访问密钥
|
||||
string secret_key = 3; // 密钥
|
||||
string token = 4; // 令牌
|
||||
|
||||
bool use_ssl = 10; // 使用SSL
|
||||
TLS tls = 11; // TLS配置
|
||||
|
||||
string upload_host = 20; // 上传链接的主机名
|
||||
string download_host = 21; // 下载链接的主机名
|
||||
}
|
||||
|
||||
MinIO minio = 1;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ syntax = "proto3";
|
||||
|
||||
package conf;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1;conf";
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1;conf";
|
||||
|
||||
import "google/protobuf/duration.proto";
|
||||
|
||||
@@ -30,13 +30,18 @@ message Registry {
|
||||
message Nacos {
|
||||
string address = 1; // 服务端地址
|
||||
uint64 port = 2; // 服务端端口
|
||||
|
||||
string namespace_id = 3; //
|
||||
|
||||
string log_level = 4; // 日志等级
|
||||
string cache_dir = 5; // 缓存目录
|
||||
string log_dir = 6; // 日志目录
|
||||
|
||||
int32 update_thread_num = 7; // 更新服务的线程数
|
||||
|
||||
google.protobuf.Duration timeout = 8; // http请求超时时间,单位: 毫秒
|
||||
google.protobuf.Duration beat_interval = 9; // 心跳间隔时间,单位: 毫秒
|
||||
|
||||
bool not_load_cache_at_start = 10; // 在启动时不读取本地缓存数据,true: 不读取,false: 读取
|
||||
bool update_cache_when_empty = 11; // 当服务列表为空时是否更新本地缓存,true: 更新,false: 不更新
|
||||
}
|
||||
235
api/protos/conf/v1/kratos_conf_server.proto
Normal file
235
api/protos/conf/v1/kratos_conf_server.proto
Normal file
@@ -0,0 +1,235 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package conf;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1;conf";
|
||||
|
||||
import "google/protobuf/duration.proto";
|
||||
|
||||
import "conf/v1/kratos_conf_middleware.proto";
|
||||
import "conf/v1/kratos_conf_tls.proto";
|
||||
|
||||
// 服务器
|
||||
message Server {
|
||||
// REST
|
||||
message REST {
|
||||
message CORS {
|
||||
repeated string headers = 1; //
|
||||
repeated string methods = 2; //
|
||||
repeated string origins = 3; //
|
||||
}
|
||||
|
||||
string network = 1; // 网络
|
||||
string addr = 2; // 服务监听地址
|
||||
google.protobuf.Duration timeout = 3; // 超时时间
|
||||
|
||||
CORS cors = 10; // 服务监听地址
|
||||
Middleware middleware = 11; // 中间件
|
||||
TLS tls = 12; // TLS配置
|
||||
|
||||
bool enable_swagger = 20; // 启用SwaggerUI
|
||||
bool enable_pprof = 21; // 启用pprof
|
||||
}
|
||||
|
||||
// gPRC
|
||||
message GRPC {
|
||||
string network = 1; // 网络
|
||||
string addr = 2; // 服务监听地址
|
||||
|
||||
google.protobuf.Duration timeout = 3; // 超时时间
|
||||
|
||||
Middleware middleware = 4;
|
||||
|
||||
TLS tls = 5; // TLS配置
|
||||
}
|
||||
|
||||
// Websocket
|
||||
message Websocket {
|
||||
string network = 1; // 网络样式:http、https
|
||||
string addr = 2; // 服务监听地址
|
||||
string path = 3; // 路径
|
||||
string codec = 4; // 编解码器: json,xml,yaml...
|
||||
google.protobuf.Duration timeout = 5; // 超时时间
|
||||
TLS tls = 6; // TLS配置
|
||||
}
|
||||
|
||||
// MQTT
|
||||
message Mqtt {
|
||||
string endpoint = 1; // 对端网络地址
|
||||
string codec = 2; // 编解码器: json,xml,yaml...
|
||||
TLS tls = 3; // TLS配置
|
||||
}
|
||||
|
||||
// Kafka
|
||||
message Kafka {
|
||||
repeated string endpoints = 1; // 对端网络地址
|
||||
string codec = 2; // 编解码器: json,xml,yaml...
|
||||
TLS tls = 3; // TLS配置
|
||||
}
|
||||
|
||||
// RabbitMQ
|
||||
message RabbitMQ {
|
||||
repeated string endpoints = 1; // 对端网络地址
|
||||
string codec = 2; // 编解码器: json,xml,yaml...
|
||||
TLS tls = 3; // TLS配置
|
||||
}
|
||||
|
||||
message ActiveMQ {
|
||||
string endpoint = 1; // 对端网络地址
|
||||
string codec = 2; // 编解码器: json,xml,yaml...
|
||||
TLS tls = 3; // TLS配置
|
||||
}
|
||||
|
||||
message NATS {
|
||||
string endpoint = 1; // 对端网络地址
|
||||
string codec = 2; // 编解码器: json,xml,yaml...
|
||||
TLS tls = 3; // TLS配置
|
||||
}
|
||||
|
||||
message NSQ {
|
||||
string endpoint = 1; // 对端网络地址
|
||||
string codec = 2; // 编解码器: json,xml,yaml...
|
||||
TLS tls = 3; // TLS配置
|
||||
}
|
||||
|
||||
message Pulsar {
|
||||
string endpoint = 1; // 对端网络地址
|
||||
string codec = 2; // 编解码器: json,xml,yaml...
|
||||
TLS tls = 3; // TLS配置
|
||||
}
|
||||
|
||||
message Redis {
|
||||
string endpoint = 1; // 对端网络地址
|
||||
string codec = 2; // 编解码器: json,xml,yaml...
|
||||
TLS tls = 3; // TLS配置
|
||||
}
|
||||
|
||||
message RocketMQ {
|
||||
string version = 1; // 驱动版本:aliyun、v2、v5
|
||||
string codec = 2; // 编解码器: json,xml,yaml...
|
||||
|
||||
bool enable_trace = 3;
|
||||
|
||||
repeated string name_servers = 4;
|
||||
string name_server_domain = 5;
|
||||
|
||||
string access_key = 6;
|
||||
string secret_key = 7;
|
||||
string security_token = 8;
|
||||
|
||||
string namespace = 9;
|
||||
string instance_name = 10;
|
||||
string group_name = 11;
|
||||
|
||||
TLS tls = 12; // TLS配置
|
||||
}
|
||||
|
||||
// Asynq
|
||||
message Asynq {
|
||||
string endpoint = 1; // 对端网络地址
|
||||
string password = 2; // redis登录密码
|
||||
int32 db = 3; // 数据库索引
|
||||
string location = 4; // 时区
|
||||
TLS tls = 5; // TLS配置
|
||||
}
|
||||
|
||||
// Machinery
|
||||
message Machinery {
|
||||
repeated string brokers = 1; // broker的地址,可以根据实际使用的存储介质,分别指定Redis、AMQP或AWS SQS;
|
||||
repeated string backends = 2; // backend配置,用来指定存放结果的介质的配置。可以根据需求,分别指定为:Redis、memcached或mongodb等;
|
||||
TLS tls = 3; // TLS配置
|
||||
}
|
||||
|
||||
// SSE
|
||||
message SSE {
|
||||
string network = 1; // 网络
|
||||
string addr = 2; // 服务监听地址
|
||||
string path = 3; // 路径
|
||||
string codec = 4; // 编解码器
|
||||
TLS tls = 5; // TLS配置
|
||||
|
||||
google.protobuf.Duration timeout = 10; // 超时时间
|
||||
google.protobuf.Duration event_ttl = 11; //
|
||||
|
||||
bool auto_stream = 20; //
|
||||
bool auto_reply = 21; //
|
||||
bool split_data = 22; //
|
||||
bool encode_base64 = 23; // 进行BASE64编码
|
||||
}
|
||||
|
||||
// SocketIO
|
||||
message SocketIO {
|
||||
string network = 1; // 网络
|
||||
string addr = 2; // 服务监听地址
|
||||
string path = 3; // 路径
|
||||
string codec = 4; // 编解码器
|
||||
TLS tls = 5; // TLS配置
|
||||
}
|
||||
|
||||
// SignalR
|
||||
message SignalR {
|
||||
string network = 1; // 网络
|
||||
string addr = 2; // 服务监听地址
|
||||
string codec = 3; // 编解码器
|
||||
TLS tls = 4; // TLS配置
|
||||
|
||||
google.protobuf.Duration keep_alive_interval = 10; // 超时时间
|
||||
google.protobuf.Duration chan_receive_timeout = 11; // 超时时间
|
||||
|
||||
bool debug = 6; // 调试开关
|
||||
uint32 stream_buffer_capacity = 7; //
|
||||
}
|
||||
|
||||
// GraphQL
|
||||
message GraphQL {
|
||||
string network = 1; // 网络
|
||||
string addr = 2; // 服务监听地址
|
||||
string path = 3; // 路径
|
||||
string codec = 4; // 编解码器
|
||||
google.protobuf.Duration timeout = 5; // 超时时间
|
||||
bool strict_slash = 6;
|
||||
TLS tls = 7; // TLS配置
|
||||
}
|
||||
|
||||
// Thrift
|
||||
message Thrift {
|
||||
string network = 1; // 网络
|
||||
string addr = 2; // 服务监听地址
|
||||
string protocol = 3;
|
||||
bool buffered = 4;
|
||||
bool framed = 5;
|
||||
bool buffer_size = 6;
|
||||
TLS tls = 7; // TLS配置
|
||||
}
|
||||
|
||||
// RPC
|
||||
|
||||
optional REST rest = 1; // REST服务
|
||||
optional GRPC grpc = 2; // gRPC服务
|
||||
optional GraphQL graphql = 3; // GraphQL服务
|
||||
optional Thrift thrift = 4; // Thrift服务
|
||||
|
||||
// Message Queue
|
||||
|
||||
optional Mqtt mqtt = 10; // MQTT服务
|
||||
optional Kafka kafka = 11; // Kafka服务
|
||||
optional RabbitMQ rabbitmq = 12; // RabbitMQ服务
|
||||
optional ActiveMQ activemq = 13; // ActiveMQ
|
||||
optional NATS nats = 14; // NATS
|
||||
optional NSQ nsq = 15; // NATS
|
||||
optional Pulsar pulsar = 16; // Pulsar
|
||||
optional Redis redis = 17; // Redis
|
||||
optional RocketMQ rocketmq = 18; // RocketMQ
|
||||
|
||||
// RealTime
|
||||
|
||||
optional Websocket websocket = 20; // Websocket服务
|
||||
optional SSE sse = 21; // SSE服务
|
||||
optional SocketIO socketio = 22; // SocketIO服务
|
||||
optional SignalR signalr = 23; // SignalR服务
|
||||
|
||||
// Task Queue
|
||||
|
||||
optional Asynq asynq = 30; // Asynq服务
|
||||
optional Machinery machinery = 31; // Machinery服务
|
||||
}
|
||||
23
api/protos/conf/v1/kratos_conf_tls.proto
Normal file
23
api/protos/conf/v1/kratos_conf_tls.proto
Normal file
@@ -0,0 +1,23 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package conf;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1;conf";
|
||||
|
||||
message TLS {
|
||||
message File {
|
||||
optional string cert_path = 1;
|
||||
optional string key_path = 2;
|
||||
optional string ca_path = 3;
|
||||
}
|
||||
message Config {
|
||||
optional bytes cert_pem = 1;
|
||||
optional bytes key_pem = 2;
|
||||
optional bytes ca_pem = 3;
|
||||
}
|
||||
|
||||
optional File file = 1;
|
||||
optional Config config = 2;
|
||||
|
||||
bool insecure_skip_verify = 3;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ syntax = "proto3";
|
||||
|
||||
package conf;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1;conf";
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1;conf";
|
||||
|
||||
// 链路追踪
|
||||
message Tracer {
|
||||
@@ -10,4 +10,5 @@ message Tracer {
|
||||
string endpoint = 2; // 端口
|
||||
double sampler = 3; // 采样率,默认:1.0
|
||||
string env = 4; // 运行环境:dev、debug、product
|
||||
bool insecure = 5;
|
||||
}
|
||||
81
api/protos/pagination/v1/pagination.proto
Normal file
81
api/protos/pagination/v1/pagination.proto
Normal file
@@ -0,0 +1,81 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pagination;
|
||||
|
||||
option go_package = "github.com/tx7do/kratos-bootstrap/gen/api/go/pagination/v1;pagination";
|
||||
|
||||
import "google/protobuf/any.proto";
|
||||
import "google/protobuf/field_mask.proto";
|
||||
import "gnostic/openapi/v3/annotations.proto";
|
||||
|
||||
// 分页通用请求
|
||||
message PagingRequest {
|
||||
// 当前页码
|
||||
optional int32 page = 1 [
|
||||
json_name = "page",
|
||||
(gnostic.openapi.v3.property) = {
|
||||
description: "当前页码",
|
||||
default: {number: 1}
|
||||
}
|
||||
];
|
||||
|
||||
// 每页的行数
|
||||
optional int32 page_size = 2 [
|
||||
json_name = "pageSize",
|
||||
(gnostic.openapi.v3.property) = {
|
||||
description: "每一页的行数",
|
||||
default: {number: 10}
|
||||
}
|
||||
];
|
||||
|
||||
// 与过滤参数
|
||||
optional string query = 3 [
|
||||
json_name = "query",
|
||||
(gnostic.openapi.v3.property) = {
|
||||
description: "与过滤参数",
|
||||
example: {yaml: "{\"key1\":\"val1\",\"key2\":\"val2\"}"}
|
||||
}
|
||||
];
|
||||
|
||||
// 或过滤参数
|
||||
optional string or_query = 4 [
|
||||
json_name = "or",
|
||||
(gnostic.openapi.v3.property) = {
|
||||
description: "或过滤参数",
|
||||
example: {yaml: "{\"key1\":\"val1\",\"key2\":\"val2\"}"}
|
||||
}
|
||||
];
|
||||
|
||||
// 排序条件
|
||||
repeated string order_by = 5 [
|
||||
json_name = "orderBy",
|
||||
(gnostic.openapi.v3.property) = {
|
||||
description: "排序条件,字段名前加'-'为降序,否则为升序。"
|
||||
example: {yaml: "{\"val1\", \"-val2\"}"}
|
||||
}
|
||||
];
|
||||
|
||||
// 是否不分页
|
||||
optional bool no_paging = 6 [
|
||||
json_name = "nopaging",
|
||||
(gnostic.openapi.v3.property) = {description: "是否不分页"}
|
||||
];
|
||||
|
||||
// 字段掩码
|
||||
google.protobuf.FieldMask field_mask = 7 [
|
||||
json_name = "fieldMask",
|
||||
(gnostic.openapi.v3.property) = {
|
||||
description: "字段掩码,如果为空则选中所有字段。",
|
||||
example: {yaml : "id,realName,userName"}
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
// 分页通用结果
|
||||
message PagingResponse {
|
||||
// 总数
|
||||
int32 total = 1;
|
||||
|
||||
// 分页数据
|
||||
repeated google.protobuf.Any items = 2;
|
||||
}
|
||||
35
bootstrap.go
35
bootstrap.go
@@ -1,35 +0,0 @@
|
||||
package bootstrap
|
||||
|
||||
import (
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"github.com/go-kratos/kratos/v2/registry"
|
||||
|
||||
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
|
||||
)
|
||||
|
||||
// Bootstrap 应用引导启动
|
||||
func Bootstrap(serviceInfo *ServiceInfo) (*conf.Bootstrap, log.Logger, registry.Registrar) {
|
||||
// inject command flags
|
||||
Flags := NewCommandFlags()
|
||||
Flags.Init()
|
||||
|
||||
var err error
|
||||
|
||||
// load configs
|
||||
if err = LoadBootstrapConfig(Flags.Conf); err == nil {
|
||||
panic("load config failed")
|
||||
}
|
||||
|
||||
// init logger
|
||||
ll := NewLoggerProvider(commonConfig.Logger, serviceInfo)
|
||||
|
||||
// init registrar
|
||||
reg := NewRegistry(commonConfig.Registry)
|
||||
|
||||
// init tracer
|
||||
if err = NewTracerProvider(commonConfig.Trace, serviceInfo); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return commonConfig, ll, reg
|
||||
}
|
||||
94
bootstrap/bootstrap.go
Normal file
94
bootstrap/bootstrap.go
Normal file
@@ -0,0 +1,94 @@
|
||||
package bootstrap
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-kratos/kratos/v2"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
kratosRegistry "github.com/go-kratos/kratos/v2/registry"
|
||||
"github.com/go-kratos/kratos/v2/transport"
|
||||
|
||||
"github.com/tx7do/kratos-bootstrap/config"
|
||||
"github.com/tx7do/kratos-bootstrap/logger"
|
||||
"github.com/tx7do/kratos-bootstrap/registry"
|
||||
"github.com/tx7do/kratos-bootstrap/tracer"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
var (
|
||||
Service = config.NewServiceInfo(
|
||||
"",
|
||||
"1.0.0",
|
||||
"",
|
||||
)
|
||||
)
|
||||
|
||||
// NewApp 创建应用程序
|
||||
func NewApp(ll log.Logger, rr kratosRegistry.Registrar, srv ...transport.Server) *kratos.App {
|
||||
return kratos.New(
|
||||
kratos.ID(Service.GetInstanceId()),
|
||||
kratos.Name(Service.Name),
|
||||
kratos.Version(Service.Version),
|
||||
kratos.Metadata(Service.Metadata),
|
||||
kratos.Logger(ll),
|
||||
kratos.Server(
|
||||
srv...,
|
||||
),
|
||||
kratos.Registrar(rr),
|
||||
)
|
||||
}
|
||||
|
||||
// DoBootstrap 执行引导
|
||||
func DoBootstrap(serviceInfo *config.ServiceInfo) (*conf.Bootstrap, log.Logger, kratosRegistry.Registrar) {
|
||||
// inject command flags
|
||||
Flags := config.NewCommandFlags()
|
||||
Flags.Init()
|
||||
|
||||
var err error
|
||||
|
||||
// load configs
|
||||
if err = config.LoadBootstrapConfig(Flags.Conf); err != nil {
|
||||
panic(fmt.Sprintf("load config failed: %v", err))
|
||||
}
|
||||
|
||||
// init logger
|
||||
ll := logger.NewLoggerProvider(config.GetBootstrapConfig().Logger, serviceInfo)
|
||||
|
||||
// init registrar
|
||||
reg := registry.NewRegistry(config.GetBootstrapConfig().Registry)
|
||||
|
||||
// init tracer
|
||||
if err = tracer.NewTracerProvider(config.GetBootstrapConfig().Trace, serviceInfo); err != nil {
|
||||
panic(fmt.Sprintf("init tracer failed: %v", err))
|
||||
}
|
||||
|
||||
return config.GetBootstrapConfig(), ll, reg
|
||||
}
|
||||
|
||||
type InitApp func(logger log.Logger, registrar kratosRegistry.Registrar, bootstrap *conf.Bootstrap) (*kratos.App, func(), error)
|
||||
|
||||
// Bootstrap 应用引导启动
|
||||
func Bootstrap(initApp InitApp, serviceName, version *string) {
|
||||
if serviceName != nil && len(*serviceName) != 0 {
|
||||
Service.Name = *serviceName
|
||||
}
|
||||
if version != nil && len(*version) != 0 {
|
||||
Service.Version = *version
|
||||
}
|
||||
|
||||
// bootstrap
|
||||
cfg, ll, reg := DoBootstrap(Service)
|
||||
|
||||
// init app
|
||||
app, cleanup, err := initApp(ll, reg, cfg)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer cleanup()
|
||||
|
||||
// run the app.
|
||||
if err = app.Run(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
57
bootstrap/bootstrap_test.go
Normal file
57
bootstrap/bootstrap_test.go
Normal file
@@ -0,0 +1,57 @@
|
||||
package bootstrap
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-kratos/kratos/v2"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"github.com/go-kratos/kratos/v2/registry"
|
||||
|
||||
v1 "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
"github.com/tx7do/kratos-bootstrap/config"
|
||||
)
|
||||
|
||||
func initApp(logger log.Logger, registrar registry.Registrar, _ *v1.Bootstrap) (*kratos.App, func(), error) {
|
||||
app := NewApp(logger, registrar)
|
||||
return app, func() {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func TestBootstrap(t *testing.T) {
|
||||
serviceName := "test"
|
||||
version := "v0.0.1"
|
||||
Bootstrap(initApp, &serviceName, &version)
|
||||
}
|
||||
|
||||
type CustomConfig struct {
|
||||
Cfg string `protobuf:"bytes,1,opt,name=cfg,proto3" json:"cfg,omitempty"`
|
||||
}
|
||||
|
||||
func initAppEx(logger log.Logger, registrar registry.Registrar, _ *v1.Bootstrap, _ *CustomConfig) (*kratos.App, func(), error) {
|
||||
app := NewApp(logger, registrar)
|
||||
return app, func() {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func TestCustomBootstrap(t *testing.T) {
|
||||
customCfg := &CustomConfig{}
|
||||
config.RegisterConfig(customCfg)
|
||||
|
||||
Service.SetName("test")
|
||||
Service.SetVersion("v0.0.1")
|
||||
|
||||
// bootstrap
|
||||
cfg, ll, reg := DoBootstrap(Service)
|
||||
|
||||
// init app
|
||||
app, cleanup, err := initAppEx(ll, reg, cfg, customCfg)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer cleanup()
|
||||
|
||||
// run the app.
|
||||
if err = app.Run(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
195
bootstrap/go.mod
Normal file
195
bootstrap/go.mod
Normal file
@@ -0,0 +1,195 @@
|
||||
module github.com/tx7do/kratos-bootstrap/bootstrap
|
||||
|
||||
go 1.23
|
||||
|
||||
toolchain go1.23.3
|
||||
|
||||
replace (
|
||||
github.com/armon/go-metrics => github.com/hashicorp/go-metrics v0.4.1
|
||||
github.com/imdario/mergo => dario.cat/mergo v0.3.16
|
||||
|
||||
github.com/tx7do/kratos-bootstrap/api => ../api
|
||||
|
||||
github.com/tx7do/kratos-bootstrap/cache/redis => ../cache/redis
|
||||
|
||||
github.com/tx7do/kratos-bootstrap/config => ../config
|
||||
|
||||
github.com/tx7do/kratos-bootstrap/logger => ../logger
|
||||
|
||||
github.com/tx7do/kratos-bootstrap/oss/minio => ../oss/minio
|
||||
|
||||
github.com/tx7do/kratos-bootstrap/registry => ../registry
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/google/subcommands v1.2.0
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/spf13/cobra v1.8.1
|
||||
github.com/tx7do/kratos-bootstrap v0.3.14
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
golang.org/x/tools v0.27.0
|
||||
)
|
||||
|
||||
require (
|
||||
dario.cat/mergo v1.0.1 // indirect
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v1.63.51 // indirect
|
||||
github.com/apolloconfig/agollo/v4 v4.4.0 // indirect
|
||||
github.com/armon/go-metrics v0.5.3 // indirect
|
||||
github.com/buger/jsonparser v1.1.1 // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
||||
github.com/coreos/go-semver v0.3.1 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/deckarep/golang-set v1.8.0 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
|
||||
github.com/fatih/color v1.18.0 // indirect
|
||||
github.com/fluent/fluent-logger-golang v1.9.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.8.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
|
||||
github.com/go-chassis/cari v0.9.0 // indirect
|
||||
github.com/go-chassis/foundation v0.4.0 // indirect
|
||||
github.com/go-chassis/openlog v1.1.3 // indirect
|
||||
github.com/go-chassis/sc-client v0.7.0 // indirect
|
||||
github.com/go-errors/errors v1.5.1 // indirect
|
||||
github.com/go-kratos/aegis v0.2.0 // indirect
|
||||
github.com/go-kratos/kratos/contrib/config/apollo/v2 v2.0.0-20241105072421-f8b97f675b32 // indirect
|
||||
github.com/go-kratos/kratos/contrib/config/etcd/v2 v2.0.0-20241105072421-f8b97f675b32 // indirect
|
||||
github.com/go-kratos/kratos/contrib/config/kubernetes/v2 v2.0.0-20241105072421-f8b97f675b32 // indirect
|
||||
github.com/go-kratos/kratos/contrib/config/nacos/v2 v2.0.0-20241105072421-f8b97f675b32 // indirect
|
||||
github.com/go-kratos/kratos/contrib/log/fluent/v2 v2.0.0-20241105072421-f8b97f675b32 // indirect
|
||||
github.com/go-kratos/kratos/contrib/log/logrus/v2 v2.0.0-20241105072421-f8b97f675b32 // indirect
|
||||
github.com/go-kratos/kratos/contrib/log/tencent/v2 v2.0.0-20241105072421-f8b97f675b32 // indirect
|
||||
github.com/go-kratos/kratos/contrib/log/zap/v2 v2.0.0-20241105072421-f8b97f675b32 // indirect
|
||||
github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20241105072421-f8b97f675b32 // indirect
|
||||
github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20241105072421-f8b97f675b32 // indirect
|
||||
github.com/go-kratos/kratos/contrib/registry/eureka/v2 v2.0.0-20241105072421-f8b97f675b32 // indirect
|
||||
github.com/go-kratos/kratos/contrib/registry/kubernetes/v2 v2.0.0-20241105072421-f8b97f675b32 // indirect
|
||||
github.com/go-kratos/kratos/contrib/registry/nacos/v2 v2.0.0-20241105072421-f8b97f675b32 // indirect
|
||||
github.com/go-kratos/kratos/contrib/registry/servicecomb/v2 v2.0.0-20241105072421-f8b97f675b32 // indirect
|
||||
github.com/go-kratos/kratos/contrib/registry/zookeeper/v2 v2.0.0-20241105072421-f8b97f675b32 // indirect
|
||||
github.com/go-logr/logr v1.4.2 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/go-playground/form/v4 v4.2.1 // indirect
|
||||
github.com/go-zookeeper/zk v1.0.4 // indirect
|
||||
github.com/gofrs/uuid v4.4.0+incompatible // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/gorilla/mux v1.8.1 // indirect
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 // indirect
|
||||
github.com/hashicorp/consul/api v1.30.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-hclog v1.6.3 // indirect
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
|
||||
github.com/hashicorp/golang-lru v1.0.2 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hashicorp/serf v0.10.1 // indirect
|
||||
github.com/imdario/mergo v1.0.1 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/karlseguin/ccache/v2 v2.0.8 // indirect
|
||||
github.com/klauspost/compress v1.17.11 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/nacos-group/nacos-sdk-go v1.1.5 // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b // indirect
|
||||
github.com/openzipkin/zipkin-go v0.4.3 // indirect
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
|
||||
github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c // indirect
|
||||
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/sagikazarmark/locafero v0.6.0 // indirect
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/spf13/afero v1.11.0 // indirect
|
||||
github.com/spf13/cast v1.7.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/viper v1.19.0 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/tencentcloud/tencentcloud-cls-sdk-go v1.0.11 // indirect
|
||||
github.com/tinylib/msgp v1.2.4 // indirect
|
||||
github.com/tx7do/kratos-bootstrap/config/apollo v0.0.5 // indirect
|
||||
github.com/tx7do/kratos-bootstrap/config/consul v0.0.5 // indirect
|
||||
github.com/tx7do/kratos-bootstrap/config/etcd v0.0.5 // indirect
|
||||
github.com/tx7do/kratos-bootstrap/config/kubernetes v0.0.5 // indirect
|
||||
github.com/tx7do/kratos-bootstrap/config/nacos v0.0.5 // indirect
|
||||
github.com/tx7do/kratos-bootstrap/config/polaris v0.0.1 // indirect
|
||||
github.com/tx7do/kratos-bootstrap/logger/fluent v0.0.5 // indirect
|
||||
github.com/tx7do/kratos-bootstrap/logger/logrus v0.0.5 // indirect
|
||||
github.com/tx7do/kratos-bootstrap/logger/tencent v0.0.5 // indirect
|
||||
github.com/tx7do/kratos-bootstrap/logger/zap v0.0.5 // indirect
|
||||
github.com/tx7do/kratos-bootstrap/registry/consul v0.0.5 // indirect
|
||||
github.com/tx7do/kratos-bootstrap/registry/etcd v0.0.5 // indirect
|
||||
github.com/tx7do/kratos-bootstrap/registry/eureka v0.0.5 // indirect
|
||||
github.com/tx7do/kratos-bootstrap/registry/kubernetes v0.0.5 // indirect
|
||||
github.com/tx7do/kratos-bootstrap/registry/nacos v0.0.5 // indirect
|
||||
github.com/tx7do/kratos-bootstrap/registry/servicecomb v0.0.5 // indirect
|
||||
github.com/tx7do/kratos-bootstrap/registry/zookeeper v0.0.5 // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.17 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.17 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.5.17 // indirect
|
||||
go.opentelemetry.io/otel v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/zipkin v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.32.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
|
||||
go.uber.org/atomic v1.11.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.27.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
|
||||
golang.org/x/mod v0.22.0 // indirect
|
||||
golang.org/x/net v0.31.0 // indirect
|
||||
golang.org/x/oauth2 v0.24.0 // indirect
|
||||
golang.org/x/sync v0.9.0 // indirect
|
||||
golang.org/x/sys v0.27.0 // indirect
|
||||
golang.org/x/term v0.26.0 // indirect
|
||||
golang.org/x/text v0.20.0 // indirect
|
||||
golang.org/x/time v0.8.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20241104194629-dd2ea8efbc28 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect
|
||||
google.golang.org/grpc v1.68.0 // indirect
|
||||
google.golang.org/protobuf v1.35.1 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/api v0.31.2 // indirect
|
||||
k8s.io/apimachinery v0.31.2 // indirect
|
||||
k8s.io/client-go v0.31.2 // indirect
|
||||
k8s.io/klog/v2 v2.130.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect
|
||||
k8s.io/utils v0.0.0-20241104163129-6fe5fd82f078 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
1103
bootstrap/go.sum
Normal file
1103
bootstrap/go.sum
Normal file
File diff suppressed because it is too large
Load Diff
10
buf.gen.yaml
10
buf.gen.yaml
@@ -1,10 +0,0 @@
|
||||
# 配置protoc生成规则
|
||||
version: v1
|
||||
managed:
|
||||
enabled: false
|
||||
plugins:
|
||||
# generate go struct code
|
||||
#- plugin: buf.build/protocolbuffers/go
|
||||
- name: go
|
||||
out: gen/api/go
|
||||
opt: paths=source_relative
|
||||
26
cache/redis/go.mod
vendored
Normal file
26
cache/redis/go.mod
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
module github.com/tx7do/kratos-bootstrap/cache/redis
|
||||
|
||||
go 1.22.0
|
||||
|
||||
toolchain go1.22.1
|
||||
|
||||
replace github.com/tx7do/kratos-bootstrap/api => ../../api
|
||||
|
||||
require (
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/redis/go-redis/extra/redisotel/v9 v9.7.0
|
||||
github.com/redis/go-redis/v9 v9.7.0
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/go-logr/logr v1.4.2 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/redis/go-redis/extra/rediscmd/v9 v9.7.0 // indirect
|
||||
go.opentelemetry.io/otel v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.32.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.32.0 // indirect
|
||||
google.golang.org/protobuf v1.35.1 // indirect
|
||||
)
|
||||
45
cache/redis/go.sum
vendored
Normal file
45
cache/redis/go.sum
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
||||
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
||||
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
||||
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
|
||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||
github.com/go-kratos/kratos/v2 v2.8.2 h1:EsEA7AmPQ2YQQ0FZrDWO2HgBNqeWM8z/mWKzS5UkQaQ=
|
||||
github.com/go-kratos/kratos/v2 v2.8.2/go.mod h1:+Vfe3FzF0d+BfMdajA11jT0rAyJWublRE/seZQNZVxE=
|
||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
||||
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/redis/go-redis/extra/rediscmd/v9 v9.7.0 h1:BIx9TNZH/Jsr4l1i7VVxnV0JPiwYj8qyrHyuL0fGZrk=
|
||||
github.com/redis/go-redis/extra/rediscmd/v9 v9.7.0/go.mod h1:eTg/YQtGYAZD5r3DlGlJptJ45AHA+/G+2NPn30PKzik=
|
||||
github.com/redis/go-redis/extra/redisotel/v9 v9.7.0 h1:bQk8xiVFw+3ln4pfELVktpWgYdFpgLLU+quwSoeIof0=
|
||||
github.com/redis/go-redis/extra/redisotel/v9 v9.7.0/go.mod h1:0LyN+GHLIJmKtjYRPF7nHyTTMV6E91YngoOopNifQRo=
|
||||
github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E=
|
||||
github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U=
|
||||
go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg=
|
||||
go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M=
|
||||
go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8=
|
||||
go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw=
|
||||
go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg=
|
||||
go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM=
|
||||
go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8=
|
||||
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
|
||||
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
|
||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
|
||||
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
43
cache/redis/redis.go
vendored
Normal file
43
cache/redis/redis.go
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
package redis
|
||||
|
||||
import (
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
"github.com/redis/go-redis/extra/redisotel/v9"
|
||||
"github.com/redis/go-redis/v9"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewClient create go-redis client
|
||||
func NewClient(conf *conf.Data) (rdb *redis.Client) {
|
||||
if rdb = redis.NewClient(&redis.Options{
|
||||
Addr: conf.GetRedis().GetAddr(),
|
||||
Password: conf.GetRedis().GetPassword(),
|
||||
DB: int(conf.GetRedis().GetDb()),
|
||||
DialTimeout: conf.GetRedis().GetDialTimeout().AsDuration(),
|
||||
WriteTimeout: conf.GetRedis().GetWriteTimeout().AsDuration(),
|
||||
ReadTimeout: conf.GetRedis().GetReadTimeout().AsDuration(),
|
||||
}); rdb == nil {
|
||||
log.Fatalf("failed opening connection to redis")
|
||||
return nil
|
||||
}
|
||||
|
||||
// open tracing instrumentation.
|
||||
if conf.GetRedis().GetEnableTracing() {
|
||||
if err := redisotel.InstrumentTracing(rdb); err != nil {
|
||||
log.Fatalf("failed open tracing: %s", err.Error())
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// open metrics instrumentation.
|
||||
if conf.GetRedis().GetEnableMetrics() {
|
||||
if err := redisotel.InstrumentMetrics(rdb); err != nil {
|
||||
log.Fatalf("failed open metrics: %s", err.Error())
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
return rdb
|
||||
}
|
||||
355
config.go
355
config.go
@@ -1,355 +0,0 @@
|
||||
package bootstrap
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/config"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
// file
|
||||
fileKratos "github.com/go-kratos/kratos/v2/config/file"
|
||||
|
||||
// etcd
|
||||
etcdKratos "github.com/go-kratos/kratos/contrib/config/etcd/v2"
|
||||
etcdClient "go.etcd.io/etcd/client/v3"
|
||||
|
||||
// consul
|
||||
consulKratos "github.com/go-kratos/kratos/contrib/config/consul/v2"
|
||||
consulApi "github.com/hashicorp/consul/api"
|
||||
|
||||
// nacos
|
||||
nacosKratos "github.com/go-kratos/kratos/contrib/config/nacos/v2"
|
||||
nacosClients "github.com/nacos-group/nacos-sdk-go/clients"
|
||||
nacosConstant "github.com/nacos-group/nacos-sdk-go/common/constant"
|
||||
nacosVo "github.com/nacos-group/nacos-sdk-go/vo"
|
||||
|
||||
// polaris
|
||||
polarisKratos "github.com/go-kratos/kratos/contrib/config/polaris/v2"
|
||||
polarisApi "github.com/polarismesh/polaris-go"
|
||||
|
||||
// apollo
|
||||
apolloKratos "github.com/go-kratos/kratos/contrib/config/apollo/v2"
|
||||
|
||||
// kubernetes
|
||||
k8sKratos "github.com/go-kratos/kratos/contrib/config/kubernetes/v2"
|
||||
k8sUtil "k8s.io/client-go/util/homedir"
|
||||
|
||||
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
|
||||
)
|
||||
|
||||
var commonConfig = &conf.Bootstrap{}
|
||||
var configList []interface{}
|
||||
|
||||
const remoteConfigSourceConfigFile = "remote.yaml"
|
||||
|
||||
// RegisterConfig 注册配置
|
||||
func RegisterConfig(c interface{}) {
|
||||
initBootstrapConfig()
|
||||
configList = append(configList, c)
|
||||
}
|
||||
|
||||
func initBootstrapConfig() {
|
||||
if len(configList) > 0 {
|
||||
return
|
||||
}
|
||||
|
||||
configList = append(configList, commonConfig)
|
||||
|
||||
if commonConfig.Server == nil {
|
||||
commonConfig.Server = &conf.Server{}
|
||||
configList = append(configList, commonConfig.Server)
|
||||
}
|
||||
|
||||
if commonConfig.Client == nil {
|
||||
commonConfig.Client = &conf.Client{}
|
||||
configList = append(configList, commonConfig.Client)
|
||||
}
|
||||
|
||||
if commonConfig.Data == nil {
|
||||
commonConfig.Data = &conf.Data{}
|
||||
configList = append(configList, commonConfig.Data)
|
||||
}
|
||||
|
||||
if commonConfig.Trace == nil {
|
||||
commonConfig.Trace = &conf.Tracer{}
|
||||
configList = append(configList, commonConfig.Trace)
|
||||
}
|
||||
|
||||
if commonConfig.Logger == nil {
|
||||
commonConfig.Logger = &conf.Logger{}
|
||||
configList = append(configList, commonConfig.Logger)
|
||||
}
|
||||
|
||||
if commonConfig.Registry == nil {
|
||||
commonConfig.Registry = &conf.Registry{}
|
||||
configList = append(configList, commonConfig.Registry)
|
||||
}
|
||||
|
||||
if commonConfig.Oss == nil {
|
||||
commonConfig.Oss = &conf.OSS{}
|
||||
configList = append(configList, commonConfig.Oss)
|
||||
}
|
||||
|
||||
if commonConfig.Notify == nil {
|
||||
commonConfig.Notify = &conf.Notification{}
|
||||
configList = append(configList, commonConfig.Notify)
|
||||
}
|
||||
}
|
||||
|
||||
// NewConfigProvider 创建一个配置
|
||||
func NewConfigProvider(configPath string) config.Config {
|
||||
err, rc := LoadRemoteConfigSourceConfigs(configPath)
|
||||
if err != nil {
|
||||
log.Error("LoadRemoteConfigSourceConfigs: ", err.Error())
|
||||
}
|
||||
if rc != nil {
|
||||
return config.New(
|
||||
config.WithSource(
|
||||
NewFileConfigSource(configPath),
|
||||
NewRemoteConfigSource(rc),
|
||||
),
|
||||
)
|
||||
} else {
|
||||
return config.New(
|
||||
config.WithSource(
|
||||
NewFileConfigSource(configPath),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// LoadBootstrapConfig 加载程序引导配置
|
||||
func LoadBootstrapConfig(configPath string) error {
|
||||
cfg := NewConfigProvider(configPath)
|
||||
|
||||
if err := cfg.Load(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
initBootstrapConfig()
|
||||
|
||||
for c := range configList {
|
||||
if err := cfg.Scan(c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func pathExists(path string) bool {
|
||||
_, err := os.Stat(path)
|
||||
if err == nil {
|
||||
return true
|
||||
}
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// LoadRemoteConfigSourceConfigs 加载远程配置源的本地配置
|
||||
func LoadRemoteConfigSourceConfigs(configPath string) (error, *conf.RemoteConfig) {
|
||||
configPath = configPath + "/" + remoteConfigSourceConfigFile
|
||||
if !pathExists(configPath) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
cfg := config.New(
|
||||
config.WithSource(
|
||||
NewFileConfigSource(configPath),
|
||||
),
|
||||
)
|
||||
defer func(cfg config.Config) {
|
||||
err := cfg.Close()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}(cfg)
|
||||
|
||||
var err error
|
||||
|
||||
if err = cfg.Load(); err != nil {
|
||||
return err, nil
|
||||
}
|
||||
|
||||
initBootstrapConfig()
|
||||
|
||||
for c := range configList {
|
||||
if err = cfg.Scan(c); err != nil {
|
||||
return err, nil
|
||||
}
|
||||
}
|
||||
|
||||
return nil, commonConfig.Config
|
||||
}
|
||||
|
||||
type ConfigType string
|
||||
|
||||
const (
|
||||
ConfigTypeLocalFile ConfigType = "file"
|
||||
ConfigTypeNacos ConfigType = "nacos"
|
||||
ConfigTypeConsul ConfigType = "consul"
|
||||
ConfigTypeEtcd ConfigType = "etcd"
|
||||
ConfigTypeApollo ConfigType = "apollo"
|
||||
ConfigTypeKubernetes ConfigType = "kubernetes"
|
||||
ConfigTypePolaris ConfigType = "polaris"
|
||||
)
|
||||
|
||||
// NewRemoteConfigSource 创建一个远程配置源
|
||||
func NewRemoteConfigSource(c *conf.RemoteConfig) config.Source {
|
||||
switch ConfigType(c.Type) {
|
||||
default:
|
||||
fallthrough
|
||||
case ConfigTypeLocalFile:
|
||||
return nil
|
||||
case ConfigTypeNacos:
|
||||
return NewNacosConfigSource(c)
|
||||
case ConfigTypeConsul:
|
||||
return NewConsulConfigSource(c)
|
||||
case ConfigTypeEtcd:
|
||||
return NewEtcdConfigSource(c)
|
||||
case ConfigTypeApollo:
|
||||
return NewApolloConfigSource(c)
|
||||
case ConfigTypeKubernetes:
|
||||
return NewKubernetesConfigSource(c)
|
||||
case ConfigTypePolaris:
|
||||
return NewPolarisConfigSource(c)
|
||||
}
|
||||
}
|
||||
|
||||
// getConfigKey 获取合法的配置名
|
||||
func getConfigKey(configKey string, useBackslash bool) string {
|
||||
if useBackslash {
|
||||
return strings.Replace(configKey, `.`, `/`, -1)
|
||||
} else {
|
||||
return configKey
|
||||
}
|
||||
}
|
||||
|
||||
// NewFileConfigSource 创建一个本地文件配置源
|
||||
func NewFileConfigSource(filePath string) config.Source {
|
||||
return fileKratos.NewSource(filePath)
|
||||
}
|
||||
|
||||
// NewNacosConfigSource 创建一个远程配置源 - Nacos
|
||||
func NewNacosConfigSource(c *conf.RemoteConfig) config.Source {
|
||||
srvConf := []nacosConstant.ServerConfig{
|
||||
*nacosConstant.NewServerConfig(c.Nacos.Address, c.Nacos.Port),
|
||||
}
|
||||
|
||||
cliConf := nacosConstant.ClientConfig{
|
||||
TimeoutMs: 10 * 1000, // http请求超时时间,单位毫秒
|
||||
BeatInterval: 5 * 1000, // 心跳间隔时间,单位毫秒
|
||||
UpdateThreadNum: 20, // 更新服务的线程数
|
||||
LogLevel: "debug",
|
||||
CacheDir: "../../configs/cache", // 缓存目录
|
||||
LogDir: "../../configs/log", // 日志目录
|
||||
NotLoadCacheAtStart: true, // 在启动时不读取本地缓存数据,true--不读取,false--读取
|
||||
UpdateCacheWhenEmpty: true, // 当服务列表为空时是否更新本地缓存,true--更新,false--不更新
|
||||
}
|
||||
|
||||
nacosClient, err := nacosClients.NewConfigClient(
|
||||
nacosVo.NacosClientParam{
|
||||
ClientConfig: &cliConf,
|
||||
ServerConfigs: srvConf,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return nacosKratos.NewConfigSource(nacosClient,
|
||||
nacosKratos.WithGroup(getConfigKey(c.Nacos.Key, false)),
|
||||
nacosKratos.WithDataID("bootstrap.yaml"),
|
||||
)
|
||||
}
|
||||
|
||||
// NewEtcdConfigSource 创建一个远程配置源 - Etcd
|
||||
func NewEtcdConfigSource(c *conf.RemoteConfig) config.Source {
|
||||
cfg := etcdClient.Config{
|
||||
Endpoints: c.Etcd.Endpoints,
|
||||
DialTimeout: c.Etcd.Timeout.AsDuration(),
|
||||
DialOptions: []grpc.DialOption{grpc.WithBlock()},
|
||||
}
|
||||
|
||||
cli, err := etcdClient.New(cfg)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
source, err := etcdKratos.New(cli, etcdKratos.WithPath(getConfigKey(c.Etcd.Key, true)))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return source
|
||||
}
|
||||
|
||||
// NewConsulConfigSource 创建一个远程配置源 - Consul
|
||||
func NewConsulConfigSource(c *conf.RemoteConfig) config.Source {
|
||||
cfg := consulApi.DefaultConfig()
|
||||
cfg.Address = c.Consul.Address
|
||||
cfg.Scheme = c.Consul.Scheme
|
||||
|
||||
cli, err := consulApi.NewClient(cfg)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
source, err := consulKratos.New(cli,
|
||||
consulKratos.WithPath(getConfigKey(c.Consul.Key, true)),
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return source
|
||||
}
|
||||
|
||||
// NewApolloConfigSource 创建一个远程配置源 - Apollo
|
||||
func NewApolloConfigSource(c *conf.RemoteConfig) config.Source {
|
||||
source := apolloKratos.NewSource(
|
||||
apolloKratos.WithAppID(c.Apollo.AppId),
|
||||
apolloKratos.WithCluster(c.Apollo.Cluster),
|
||||
apolloKratos.WithEndpoint(c.Apollo.Endpoint),
|
||||
apolloKratos.WithNamespace(c.Apollo.Namespace),
|
||||
apolloKratos.WithSecret(c.Apollo.Secret),
|
||||
apolloKratos.WithEnableBackup(),
|
||||
)
|
||||
return source
|
||||
}
|
||||
|
||||
// NewKubernetesConfigSource 创建一个远程配置源 - Kubernetes
|
||||
func NewKubernetesConfigSource(c *conf.RemoteConfig) config.Source {
|
||||
source := k8sKratos.NewSource(
|
||||
k8sKratos.Namespace(c.Kubernetes.Namespace),
|
||||
k8sKratos.LabelSelector(""),
|
||||
k8sKratos.KubeConfig(filepath.Join(k8sUtil.HomeDir(), ".kube", "config")),
|
||||
)
|
||||
return source
|
||||
}
|
||||
|
||||
// NewPolarisConfigSource 创建一个远程配置源 - Polaris
|
||||
func NewPolarisConfigSource(_ *conf.RemoteConfig) config.Source {
|
||||
configApi, err := polarisApi.NewConfigAPI()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
var opts []polarisKratos.Option
|
||||
opts = append(opts, polarisKratos.WithNamespace("default"))
|
||||
opts = append(opts, polarisKratos.WithFileGroup("default"))
|
||||
opts = append(opts, polarisKratos.WithFileName("default.yaml"))
|
||||
|
||||
source, err := polarisKratos.New(configApi, opts...)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return source
|
||||
}
|
||||
23
config/apollo/client.go
Normal file
23
config/apollo/client.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package apollo
|
||||
|
||||
import (
|
||||
"github.com/go-kratos/kratos/v2/config"
|
||||
|
||||
// apollo
|
||||
apolloKratos "github.com/go-kratos/kratos/contrib/config/apollo/v2"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewConfigSource 创建一个远程配置源 - Apollo
|
||||
func NewConfigSource(c *conf.RemoteConfig) config.Source {
|
||||
source := apolloKratos.NewSource(
|
||||
apolloKratos.WithAppID(c.Apollo.AppId),
|
||||
apolloKratos.WithCluster(c.Apollo.Cluster),
|
||||
apolloKratos.WithEndpoint(c.Apollo.Endpoint),
|
||||
apolloKratos.WithNamespace(c.Apollo.Namespace),
|
||||
apolloKratos.WithSecret(c.Apollo.Secret),
|
||||
apolloKratos.WithEnableBackup(),
|
||||
)
|
||||
return source
|
||||
}
|
||||
65
config/bootstrap_config.go
Normal file
65
config/bootstrap_config.go
Normal file
@@ -0,0 +1,65 @@
|
||||
package config
|
||||
|
||||
import conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
|
||||
var configList []interface{}
|
||||
|
||||
var commonConfig = &conf.Bootstrap{}
|
||||
|
||||
func GetBootstrapConfig() *conf.Bootstrap {
|
||||
return commonConfig
|
||||
}
|
||||
|
||||
// RegisterConfig 注册配置
|
||||
func RegisterConfig(c interface{}) {
|
||||
initBootstrapConfig()
|
||||
configList = append(configList, c)
|
||||
}
|
||||
|
||||
func initBootstrapConfig() {
|
||||
if len(configList) > 0 {
|
||||
return
|
||||
}
|
||||
|
||||
configList = append(configList, commonConfig)
|
||||
|
||||
if commonConfig.Server == nil {
|
||||
commonConfig.Server = &conf.Server{}
|
||||
configList = append(configList, commonConfig.Server)
|
||||
}
|
||||
|
||||
if commonConfig.Client == nil {
|
||||
commonConfig.Client = &conf.Client{}
|
||||
configList = append(configList, commonConfig.Client)
|
||||
}
|
||||
|
||||
if commonConfig.Data == nil {
|
||||
commonConfig.Data = &conf.Data{}
|
||||
configList = append(configList, commonConfig.Data)
|
||||
}
|
||||
|
||||
if commonConfig.Trace == nil {
|
||||
commonConfig.Trace = &conf.Tracer{}
|
||||
configList = append(configList, commonConfig.Trace)
|
||||
}
|
||||
|
||||
if commonConfig.Logger == nil {
|
||||
commonConfig.Logger = &conf.Logger{}
|
||||
configList = append(configList, commonConfig.Logger)
|
||||
}
|
||||
|
||||
if commonConfig.Registry == nil {
|
||||
commonConfig.Registry = &conf.Registry{}
|
||||
configList = append(configList, commonConfig.Registry)
|
||||
}
|
||||
|
||||
if commonConfig.Oss == nil {
|
||||
commonConfig.Oss = &conf.OSS{}
|
||||
configList = append(configList, commonConfig.Oss)
|
||||
}
|
||||
|
||||
if commonConfig.Notify == nil {
|
||||
commonConfig.Notify = &conf.Notification{}
|
||||
configList = append(configList, commonConfig.Notify)
|
||||
}
|
||||
}
|
||||
127
config/config.go
Normal file
127
config/config.go
Normal file
@@ -0,0 +1,127 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/go-kratos/kratos/v2/config"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
fileKratos "github.com/go-kratos/kratos/v2/config/file"
|
||||
|
||||
"github.com/tx7do/kratos-bootstrap/config/apollo"
|
||||
"github.com/tx7do/kratos-bootstrap/config/consul"
|
||||
"github.com/tx7do/kratos-bootstrap/config/etcd"
|
||||
"github.com/tx7do/kratos-bootstrap/config/kubernetes"
|
||||
"github.com/tx7do/kratos-bootstrap/config/nacos"
|
||||
"github.com/tx7do/kratos-bootstrap/config/polaris"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewRemoteConfigSource 创建一个远程配置源
|
||||
func NewRemoteConfigSource(c *conf.RemoteConfig) config.Source {
|
||||
switch Type(c.Type) {
|
||||
default:
|
||||
fallthrough
|
||||
case LocalFile:
|
||||
return nil
|
||||
case Nacos:
|
||||
return nacos.NewConfigSource(c)
|
||||
case Consul:
|
||||
return consul.NewConfigSource(c)
|
||||
case Etcd:
|
||||
return etcd.NewConfigSource(c)
|
||||
case Apollo:
|
||||
return apollo.NewConfigSource(c)
|
||||
case Kubernetes:
|
||||
return kubernetes.NewConfigSource(c)
|
||||
case Polaris:
|
||||
return polaris.NewConfigSource(c)
|
||||
}
|
||||
}
|
||||
|
||||
// NewFileConfigSource 创建一个本地文件配置源
|
||||
func NewFileConfigSource(filePath string) config.Source {
|
||||
return fileKratos.NewSource(filePath)
|
||||
}
|
||||
|
||||
// NewConfigProvider 创建一个配置
|
||||
func NewConfigProvider(configPath string) config.Config {
|
||||
err, rc := LoadRemoteConfigSourceConfigs(configPath)
|
||||
if err != nil {
|
||||
log.Error("LoadRemoteConfigSourceConfigs: ", err.Error())
|
||||
}
|
||||
if rc != nil {
|
||||
return config.New(
|
||||
config.WithSource(
|
||||
NewFileConfigSource(configPath),
|
||||
NewRemoteConfigSource(rc),
|
||||
),
|
||||
)
|
||||
} else {
|
||||
return config.New(
|
||||
config.WithSource(
|
||||
NewFileConfigSource(configPath),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// LoadBootstrapConfig 加载程序引导配置
|
||||
func LoadBootstrapConfig(configPath string) error {
|
||||
cfg := NewConfigProvider(configPath)
|
||||
|
||||
var err error
|
||||
|
||||
if err = cfg.Load(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
initBootstrapConfig()
|
||||
|
||||
if err = scanConfigs(cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func scanConfigs(cfg config.Config) error {
|
||||
initBootstrapConfig()
|
||||
|
||||
for _, c := range configList {
|
||||
if err := cfg.Scan(c); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// LoadRemoteConfigSourceConfigs 加载远程配置源的本地配置
|
||||
func LoadRemoteConfigSourceConfigs(configPath string) (error, *conf.RemoteConfig) {
|
||||
configPath = configPath + "/" + remoteConfigSourceConfigFile
|
||||
if !pathExists(configPath) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
cfg := config.New(
|
||||
config.WithSource(
|
||||
NewFileConfigSource(configPath),
|
||||
),
|
||||
)
|
||||
defer func(cfg config.Config) {
|
||||
if err := cfg.Close(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}(cfg)
|
||||
|
||||
var err error
|
||||
|
||||
if err = cfg.Load(); err != nil {
|
||||
return err, nil
|
||||
}
|
||||
|
||||
if err = scanConfigs(cfg); err != nil {
|
||||
return err, nil
|
||||
}
|
||||
|
||||
return nil, GetBootstrapConfig().Config
|
||||
}
|
||||
10
config/config_test.go
Normal file
10
config/config_test.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package config
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestRegisterConfig(t *testing.T) {
|
||||
var cfg struct {
|
||||
Test string
|
||||
}
|
||||
RegisterConfig(&cfg)
|
||||
}
|
||||
42
config/consul/client.go
Normal file
42
config/consul/client.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package consul
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/config"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
consulApi "github.com/hashicorp/consul/api"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// getConfigKey 获取合法的配置名
|
||||
func getConfigKey(configKey string, useBackslash bool) string {
|
||||
if useBackslash {
|
||||
return strings.Replace(configKey, `.`, `/`, -1)
|
||||
} else {
|
||||
return configKey
|
||||
}
|
||||
}
|
||||
|
||||
// NewConfigSource 创建一个远程配置源 - Consul
|
||||
func NewConfigSource(c *conf.RemoteConfig) config.Source {
|
||||
cfg := consulApi.DefaultConfig()
|
||||
cfg.Address = c.Consul.Address
|
||||
cfg.Scheme = c.Consul.Scheme
|
||||
|
||||
cli, err := consulApi.NewClient(cfg)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
src, err := New(cli,
|
||||
WithPath(getConfigKey(c.Consul.Key, true)),
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return src
|
||||
}
|
||||
89
config/consul/config.go
Normal file
89
config/consul/config.go
Normal file
@@ -0,0 +1,89 @@
|
||||
package consul
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/config"
|
||||
"github.com/hashicorp/consul/api"
|
||||
)
|
||||
|
||||
// Option is consul config option.
|
||||
type Option func(o *options)
|
||||
|
||||
type options struct {
|
||||
ctx context.Context
|
||||
path string
|
||||
}
|
||||
|
||||
// WithContext with registry context.
|
||||
func WithContext(ctx context.Context) Option {
|
||||
return func(o *options) {
|
||||
o.ctx = ctx
|
||||
}
|
||||
}
|
||||
|
||||
// WithPath is config path
|
||||
func WithPath(p string) Option {
|
||||
return func(o *options) {
|
||||
o.path = p
|
||||
}
|
||||
}
|
||||
|
||||
type source struct {
|
||||
client *api.Client
|
||||
options *options
|
||||
}
|
||||
|
||||
func New(client *api.Client, opts ...Option) (config.Source, error) {
|
||||
o := &options{
|
||||
ctx: context.Background(),
|
||||
path: "",
|
||||
}
|
||||
|
||||
for _, opt := range opts {
|
||||
opt(o)
|
||||
}
|
||||
|
||||
if o.path == "" {
|
||||
return nil, errors.New("path invalid")
|
||||
}
|
||||
|
||||
return &source{
|
||||
client: client,
|
||||
options: o,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Load return the config values
|
||||
func (s *source) Load() ([]*config.KeyValue, error) {
|
||||
kv, _, err := s.client.KV().List(s.options.path, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pathPrefix := s.options.path
|
||||
if !strings.HasSuffix(s.options.path, "/") {
|
||||
pathPrefix = pathPrefix + "/"
|
||||
}
|
||||
kvs := make([]*config.KeyValue, 0)
|
||||
for _, item := range kv {
|
||||
k := strings.TrimPrefix(item.Key, pathPrefix)
|
||||
if k == "" {
|
||||
continue
|
||||
}
|
||||
kvs = append(kvs, &config.KeyValue{
|
||||
Key: k,
|
||||
Value: item.Value,
|
||||
Format: strings.TrimPrefix(filepath.Ext(k), "."),
|
||||
})
|
||||
}
|
||||
return kvs, nil
|
||||
}
|
||||
|
||||
// Watch return the watcher
|
||||
func (s *source) Watch() (config.Watcher, error) {
|
||||
return newWatcher(s)
|
||||
}
|
||||
103
config/consul/watcher.go
Normal file
103
config/consul/watcher.go
Normal file
@@ -0,0 +1,103 @@
|
||||
package consul
|
||||
|
||||
import (
|
||||
"context"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/consul/api"
|
||||
"github.com/hashicorp/consul/api/watch"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/config"
|
||||
)
|
||||
|
||||
type watcher struct {
|
||||
source *source
|
||||
ch chan []*config.KeyValue
|
||||
wp *watch.Plan
|
||||
fileModifyIndex map[string]uint64
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
}
|
||||
|
||||
func (w *watcher) handle(_ uint64, data interface{}) {
|
||||
if data == nil {
|
||||
return
|
||||
}
|
||||
|
||||
kv, ok := data.(api.KVPairs)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
pathPrefix := w.source.options.path
|
||||
if !strings.HasSuffix(w.source.options.path, "/") {
|
||||
pathPrefix = pathPrefix + "/"
|
||||
}
|
||||
kvs := make([]*config.KeyValue, 0, len(kv))
|
||||
for _, item := range kv {
|
||||
if index, ok := w.fileModifyIndex[item.Key]; ok && item.ModifyIndex == index {
|
||||
continue
|
||||
}
|
||||
k := strings.TrimPrefix(item.Key, pathPrefix)
|
||||
if k == "" {
|
||||
continue
|
||||
}
|
||||
kvs = append(kvs, &config.KeyValue{
|
||||
Key: k,
|
||||
Value: item.Value,
|
||||
Format: strings.TrimPrefix(filepath.Ext(k), "."),
|
||||
})
|
||||
w.fileModifyIndex[item.Key] = item.ModifyIndex
|
||||
}
|
||||
|
||||
if len(kvs) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
w.ch <- kvs
|
||||
}
|
||||
|
||||
func newWatcher(s *source) (*watcher, error) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
w := &watcher{
|
||||
source: s,
|
||||
ch: make(chan []*config.KeyValue),
|
||||
fileModifyIndex: make(map[string]uint64),
|
||||
ctx: ctx,
|
||||
cancel: cancel,
|
||||
}
|
||||
|
||||
wp, err := watch.Parse(map[string]interface{}{"type": "keyprefix", "prefix": s.options.path})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
wp.Handler = w.handle
|
||||
w.wp = wp
|
||||
|
||||
// wp.Run is a blocking call and will prevent newWatcher from returning
|
||||
go func() {
|
||||
err := wp.RunWithClientAndHclog(s.client, nil)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}()
|
||||
|
||||
return w, nil
|
||||
}
|
||||
|
||||
func (w *watcher) Next() ([]*config.KeyValue, error) {
|
||||
select {
|
||||
case kv := <-w.ch:
|
||||
return kv, nil
|
||||
case <-w.ctx.Done():
|
||||
return nil, w.ctx.Err()
|
||||
}
|
||||
}
|
||||
|
||||
func (w *watcher) Stop() error {
|
||||
w.wp.Stop()
|
||||
w.cancel()
|
||||
return nil
|
||||
}
|
||||
45
config/etcd/client.go
Normal file
45
config/etcd/client.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package etcd
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/config"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
etcdKratos "github.com/go-kratos/kratos/contrib/config/etcd/v2"
|
||||
etcdClient "go.etcd.io/etcd/client/v3"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// getConfigKey 获取合法的配置名
|
||||
func getConfigKey(configKey string, useBackslash bool) string {
|
||||
if useBackslash {
|
||||
return strings.Replace(configKey, `.`, `/`, -1)
|
||||
} else {
|
||||
return configKey
|
||||
}
|
||||
}
|
||||
|
||||
// NewConfigSource 创建一个远程配置源 - Etcd
|
||||
func NewConfigSource(c *conf.RemoteConfig) config.Source {
|
||||
cfg := etcdClient.Config{
|
||||
Endpoints: c.Etcd.Endpoints,
|
||||
DialTimeout: c.Etcd.Timeout.AsDuration(),
|
||||
DialOptions: []grpc.DialOption{grpc.WithBlock()},
|
||||
}
|
||||
|
||||
cli, err := etcdClient.New(cfg)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
source, err := etcdKratos.New(cli, etcdKratos.WithPath(getConfigKey(c.Etcd.Key, true)))
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return source
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
package bootstrap
|
||||
package config
|
||||
|
||||
import "flag"
|
||||
import (
|
||||
"flag"
|
||||
|
||||
"github.com/tx7do/kratos-bootstrap/utils"
|
||||
)
|
||||
|
||||
// CommandFlags 命令传参
|
||||
type CommandFlags struct {
|
||||
Conf string // 引导配置文件路径,默认为:../../configs
|
||||
Env string // 开发环境:dev、debug……
|
||||
@@ -11,25 +16,31 @@ type CommandFlags struct {
|
||||
}
|
||||
|
||||
func NewCommandFlags() *CommandFlags {
|
||||
return &CommandFlags{
|
||||
f := &CommandFlags{
|
||||
Conf: "",
|
||||
Env: "",
|
||||
ConfigHost: "",
|
||||
ConfigType: "",
|
||||
Daemon: false,
|
||||
}
|
||||
|
||||
f.defineFlag()
|
||||
|
||||
return f
|
||||
}
|
||||
|
||||
func (f *CommandFlags) Init() {
|
||||
func (f *CommandFlags) defineFlag() {
|
||||
flag.StringVar(&f.Conf, "conf", "../../configs", "config path, eg: -conf ../../configs")
|
||||
flag.StringVar(&f.Env, "env", "dev", "runtime environment, eg: -env dev")
|
||||
flag.StringVar(&f.ConfigHost, "chost", "127.0.0.1:8500", "config server host, eg: -chost 127.0.0.1:8500")
|
||||
flag.StringVar(&f.ConfigType, "ctype", "consul", "config server host, eg: -ctype consul")
|
||||
flag.BoolVar(&f.Daemon, "d", false, "run app as a daemon with -d=true.")
|
||||
}
|
||||
|
||||
func (f *CommandFlags) Init() {
|
||||
flag.Parse()
|
||||
|
||||
if f.Daemon {
|
||||
BeDaemon("-d")
|
||||
utils.BeDaemon("-d")
|
||||
}
|
||||
|
||||
flag.Parse()
|
||||
}
|
||||
12
config/go.mod
Normal file
12
config/go.mod
Normal file
@@ -0,0 +1,12 @@
|
||||
module github.com/tx7do/kratos-bootstrap/config
|
||||
|
||||
go 1.23
|
||||
|
||||
toolchain go1.23.2
|
||||
|
||||
replace (
|
||||
github.com/armon/go-metrics => github.com/hashicorp/go-metrics v0.4.1
|
||||
github.com/imdario/mergo => dario.cat/mergo v0.3.16
|
||||
|
||||
github.com/tx7do/kratos-bootstrap/api => ../api
|
||||
)
|
||||
22
config/kubernetes/client.go
Normal file
22
config/kubernetes/client.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package kubernetes
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
k8sKratos "github.com/go-kratos/kratos/contrib/config/kubernetes/v2"
|
||||
k8sUtil "k8s.io/client-go/util/homedir"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/config"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewConfigSource 创建一个远程配置源 - Kubernetes
|
||||
func NewConfigSource(c *conf.RemoteConfig) config.Source {
|
||||
source := k8sKratos.NewSource(
|
||||
k8sKratos.Namespace(c.Kubernetes.Namespace),
|
||||
k8sKratos.LabelSelector(""),
|
||||
k8sKratos.KubeConfig(filepath.Join(k8sUtil.HomeDir(), ".kube", "config")),
|
||||
)
|
||||
return source
|
||||
}
|
||||
57
config/nacos/client.go
Normal file
57
config/nacos/client.go
Normal file
@@ -0,0 +1,57 @@
|
||||
package nacos
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/config"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
nacosKratos "github.com/go-kratos/kratos/contrib/config/nacos/v2"
|
||||
nacosClients "github.com/nacos-group/nacos-sdk-go/clients"
|
||||
nacosConstant "github.com/nacos-group/nacos-sdk-go/common/constant"
|
||||
nacosVo "github.com/nacos-group/nacos-sdk-go/vo"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// getConfigKey 获取合法的配置名
|
||||
func getConfigKey(configKey string, useBackslash bool) string {
|
||||
if useBackslash {
|
||||
return strings.Replace(configKey, `.`, `/`, -1)
|
||||
} else {
|
||||
return configKey
|
||||
}
|
||||
}
|
||||
|
||||
// NewConfigSource 创建一个远程配置源 - Nacos
|
||||
func NewConfigSource(c *conf.RemoteConfig) config.Source {
|
||||
srvConf := []nacosConstant.ServerConfig{
|
||||
*nacosConstant.NewServerConfig(c.Nacos.Address, c.Nacos.Port),
|
||||
}
|
||||
|
||||
cliConf := nacosConstant.ClientConfig{
|
||||
TimeoutMs: 10 * 1000, // http请求超时时间,单位毫秒
|
||||
BeatInterval: 5 * 1000, // 心跳间隔时间,单位毫秒
|
||||
UpdateThreadNum: 20, // 更新服务的线程数
|
||||
LogLevel: "debug",
|
||||
CacheDir: "../../configs/cache", // 缓存目录
|
||||
LogDir: "../../configs/log", // 日志目录
|
||||
NotLoadCacheAtStart: true, // 在启动时不读取本地缓存数据,true--不读取,false--读取
|
||||
UpdateCacheWhenEmpty: true, // 当服务列表为空时是否更新本地缓存,true--更新,false--不更新
|
||||
}
|
||||
|
||||
nacosClient, err := nacosClients.NewConfigClient(
|
||||
nacosVo.NacosClientParam{
|
||||
ClientConfig: &cliConf,
|
||||
ServerConfigs: srvConf,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return nacosKratos.NewConfigSource(nacosClient,
|
||||
nacosKratos.WithGroup(getConfigKey(c.Nacos.Key, false)),
|
||||
nacosKratos.WithDataID("bootstrap.yaml"),
|
||||
)
|
||||
}
|
||||
15
config/options.go
Normal file
15
config/options.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package config
|
||||
|
||||
const remoteConfigSourceConfigFile = "remote.yaml"
|
||||
|
||||
type Type string
|
||||
|
||||
const (
|
||||
LocalFile Type = "file"
|
||||
Nacos Type = "nacos"
|
||||
Consul Type = "consul"
|
||||
Etcd Type = "etcd"
|
||||
Apollo Type = "apollo"
|
||||
Kubernetes Type = "kubernetes"
|
||||
Polaris Type = "polaris"
|
||||
)
|
||||
28
config/polaris/client.go
Normal file
28
config/polaris/client.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package polaris
|
||||
|
||||
import (
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/config"
|
||||
)
|
||||
|
||||
// NewConfigSource 创建一个远程配置源 - Polaris
|
||||
func NewConfigSource(_ *conf.RemoteConfig) config.Source {
|
||||
//configApi, err := polarisApi.NewConfigAPI()
|
||||
//if err != nil {
|
||||
// log.Fatal(err)
|
||||
//}
|
||||
//
|
||||
//var opts []polarisKratos.Option
|
||||
//opts = append(opts, polarisKratos.WithNamespace("default"))
|
||||
//opts = append(opts, polarisKratos.WithFileGroup("default"))
|
||||
//opts = append(opts, polarisKratos.WithFileName("default.yaml"))
|
||||
//
|
||||
//source, err := polarisKratos.New(configApi, opts...)
|
||||
//if err != nil {
|
||||
// log.Fatal(err)
|
||||
//}
|
||||
//
|
||||
//return source
|
||||
return nil
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package bootstrap
|
||||
package config
|
||||
|
||||
import "os"
|
||||
|
||||
@@ -21,6 +21,14 @@ func NewServiceInfo(name, version, id string) *ServiceInfo {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ServiceInfo) SetName(name string) {
|
||||
s.Name = name
|
||||
}
|
||||
|
||||
func (s *ServiceInfo) SetVersion(version string) {
|
||||
s.Version = version
|
||||
}
|
||||
|
||||
func (s *ServiceInfo) GetInstanceId() string {
|
||||
return s.Id + "." + s.Name
|
||||
}
|
||||
14
config/utils.go
Normal file
14
config/utils.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package config
|
||||
|
||||
import "os"
|
||||
|
||||
func pathExists(path string) bool {
|
||||
_, err := os.Stat(path)
|
||||
if err == nil {
|
||||
return true
|
||||
}
|
||||
if os.IsNotExist(err) {
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -1,423 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_data.proto
|
||||
|
||||
package conf
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
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 Data struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Database *Data_Database `protobuf:"bytes,1,opt,name=database,proto3" json:"database,omitempty"` // 数据库
|
||||
Redis *Data_Redis `protobuf:"bytes,2,opt,name=redis,proto3" json:"redis,omitempty"` // Redis
|
||||
}
|
||||
|
||||
func (x *Data) Reset() {
|
||||
*x = Data{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_conf_v1_kratos_conf_data_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Data) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Data) ProtoMessage() {}
|
||||
|
||||
func (x *Data) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_data_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 Data.ProtoReflect.Descriptor instead.
|
||||
func (*Data) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_data_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Data) GetDatabase() *Data_Database {
|
||||
if x != nil {
|
||||
return x.Database
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Data) GetRedis() *Data_Redis {
|
||||
if x != nil {
|
||||
return x.Redis
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 数据库
|
||||
type Data_Database struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Driver string `protobuf:"bytes,1,opt,name=driver,proto3" json:"driver,omitempty"` // 驱动名:mysql、postgresql、mongodb、sqlite……
|
||||
Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"` // 数据源(DSN字符串)
|
||||
Migrate bool `protobuf:"varint,3,opt,name=migrate,proto3" json:"migrate,omitempty"` // 数据迁移开关
|
||||
Debug bool `protobuf:"varint,4,opt,name=debug,proto3" json:"debug,omitempty"` // 调试开关
|
||||
MaxIdleConnections int32 `protobuf:"varint,5,opt,name=max_idle_connections,json=maxIdleConnections,proto3" json:"max_idle_connections,omitempty"` // 连接池最大空闲连接数
|
||||
MaxOpenConnections int32 `protobuf:"varint,6,opt,name=max_open_connections,json=maxOpenConnections,proto3" json:"max_open_connections,omitempty"` // 连接池最大打开连接数
|
||||
ConnectionMaxLifetime *durationpb.Duration `protobuf:"bytes,7,opt,name=connection_max_lifetime,json=connectionMaxLifetime,proto3" json:"connection_max_lifetime,omitempty"` // 连接可重用的最大时间长度
|
||||
}
|
||||
|
||||
func (x *Data_Database) Reset() {
|
||||
*x = Data_Database{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_conf_v1_kratos_conf_data_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Data_Database) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Data_Database) ProtoMessage() {}
|
||||
|
||||
func (x *Data_Database) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_data_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 Data_Database.ProtoReflect.Descriptor instead.
|
||||
func (*Data_Database) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_data_proto_rawDescGZIP(), []int{0, 0}
|
||||
}
|
||||
|
||||
func (x *Data_Database) GetDriver() string {
|
||||
if x != nil {
|
||||
return x.Driver
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Data_Database) GetSource() string {
|
||||
if x != nil {
|
||||
return x.Source
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Data_Database) GetMigrate() bool {
|
||||
if x != nil {
|
||||
return x.Migrate
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *Data_Database) GetDebug() bool {
|
||||
if x != nil {
|
||||
return x.Debug
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *Data_Database) GetMaxIdleConnections() int32 {
|
||||
if x != nil {
|
||||
return x.MaxIdleConnections
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Data_Database) GetMaxOpenConnections() int32 {
|
||||
if x != nil {
|
||||
return x.MaxOpenConnections
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Data_Database) GetConnectionMaxLifetime() *durationpb.Duration {
|
||||
if x != nil {
|
||||
return x.ConnectionMaxLifetime
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// redis
|
||||
type Data_Redis struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Network string `protobuf:"bytes,1,opt,name=network,proto3" json:"network,omitempty"` // 网络
|
||||
Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` // 服务端地址
|
||||
Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"` // 密码
|
||||
Db int32 `protobuf:"varint,4,opt,name=db,proto3" json:"db,omitempty"` // 数据库索引
|
||||
DialTimeout *durationpb.Duration `protobuf:"bytes,5,opt,name=dial_timeout,json=dialTimeout,proto3" json:"dial_timeout,omitempty"` // 连接超时时间
|
||||
ReadTimeout *durationpb.Duration `protobuf:"bytes,6,opt,name=read_timeout,json=readTimeout,proto3" json:"read_timeout,omitempty"` // 读取超时时间
|
||||
WriteTimeout *durationpb.Duration `protobuf:"bytes,7,opt,name=write_timeout,json=writeTimeout,proto3" json:"write_timeout,omitempty"` // 写入超时时间
|
||||
}
|
||||
|
||||
func (x *Data_Redis) Reset() {
|
||||
*x = Data_Redis{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_conf_v1_kratos_conf_data_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Data_Redis) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Data_Redis) ProtoMessage() {}
|
||||
|
||||
func (x *Data_Redis) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_data_proto_msgTypes[2]
|
||||
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 Data_Redis.ProtoReflect.Descriptor instead.
|
||||
func (*Data_Redis) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_data_proto_rawDescGZIP(), []int{0, 1}
|
||||
}
|
||||
|
||||
func (x *Data_Redis) GetNetwork() string {
|
||||
if x != nil {
|
||||
return x.Network
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Data_Redis) GetAddr() string {
|
||||
if x != nil {
|
||||
return x.Addr
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Data_Redis) GetPassword() string {
|
||||
if x != nil {
|
||||
return x.Password
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Data_Redis) GetDb() int32 {
|
||||
if x != nil {
|
||||
return x.Db
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *Data_Redis) GetDialTimeout() *durationpb.Duration {
|
||||
if x != nil {
|
||||
return x.DialTimeout
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Data_Redis) GetReadTimeout() *durationpb.Duration {
|
||||
if x != nil {
|
||||
return x.ReadTimeout
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Data_Redis) GetWriteTimeout() *durationpb.Duration {
|
||||
if x != nil {
|
||||
return x.WriteTimeout
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_conf_v1_kratos_conf_data_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_data_proto_rawDesc = []byte{
|
||||
0x0a, 0x1e, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x64, 0x61, 0x74, 0x61, 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, 0xa3, 0x05, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12,
|
||||
0x2f, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x44, 0x61,
|
||||
0x74, 0x61, 0x62, 0x61, 0x73, 0x65, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65,
|
||||
0x12, 0x26, 0x0a, 0x05, 0x72, 0x65, 0x64, 0x69, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x10, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x52, 0x65, 0x64, 0x69,
|
||||
0x73, 0x52, 0x05, 0x72, 0x65, 0x64, 0x69, 0x73, 0x1a, 0xa1, 0x02, 0x0a, 0x08, 0x44, 0x61, 0x74,
|
||||
0x61, 0x62, 0x61, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x72, 0x69, 0x76, 0x65, 0x72, 0x12, 0x16, 0x0a,
|
||||
0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73,
|
||||
0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05,
|
||||
0x64, 0x65, 0x62, 0x75, 0x67, 0x12, 0x30, 0x0a, 0x14, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x64, 0x6c,
|
||||
0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x05, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x12, 0x6d, 0x61, 0x78, 0x49, 0x64, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x6e,
|
||||
0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x30, 0x0a, 0x14, 0x6d, 0x61, 0x78, 0x5f, 0x6f,
|
||||
0x70, 0x65, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18,
|
||||
0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x12, 0x6d, 0x61, 0x78, 0x4f, 0x70, 0x65, 0x6e, 0x43, 0x6f,
|
||||
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x51, 0x0a, 0x17, 0x63, 0x6f, 0x6e,
|
||||
0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x69, 0x66, 0x65,
|
||||
0x74, 0x69, 0x6d, 0x65, 0x18, 0x07, 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, 0x52, 0x15, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x4d, 0x61, 0x78, 0x4c, 0x69, 0x66, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x1a, 0x9d, 0x02, 0x0a,
|
||||
0x05, 0x52, 0x65, 0x64, 0x69, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72,
|
||||
0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||
0x61, 0x64, 0x64, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
|
||||
0x12, 0x0e, 0x0a, 0x02, 0x64, 0x62, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x64, 0x62,
|
||||
0x12, 0x3c, 0x0a, 0x0c, 0x64, 0x69, 0x61, 0x6c, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74,
|
||||
0x18, 0x05, 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, 0x52, 0x0b, 0x64, 0x69, 0x61, 0x6c, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x3c,
|
||||
0x0a, 0x0c, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x06,
|
||||
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, 0x52,
|
||||
0x0b, 0x72, 0x65, 0x61, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x3e, 0x0a, 0x0d,
|
||||
0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x07, 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, 0x52, 0x0c,
|
||||
0x77, 0x72, 0x69, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x42, 0x3b, 0x5a, 0x39,
|
||||
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, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_conf_v1_kratos_conf_data_proto_rawDescOnce sync.Once
|
||||
file_conf_v1_kratos_conf_data_proto_rawDescData = file_conf_v1_kratos_conf_data_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_conf_v1_kratos_conf_data_proto_rawDescGZIP() []byte {
|
||||
file_conf_v1_kratos_conf_data_proto_rawDescOnce.Do(func() {
|
||||
file_conf_v1_kratos_conf_data_proto_rawDescData = protoimpl.X.CompressGZIP(file_conf_v1_kratos_conf_data_proto_rawDescData)
|
||||
})
|
||||
return file_conf_v1_kratos_conf_data_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_conf_v1_kratos_conf_data_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_conf_v1_kratos_conf_data_proto_goTypes = []interface{}{
|
||||
(*Data)(nil), // 0: conf.Data
|
||||
(*Data_Database)(nil), // 1: conf.Data.Database
|
||||
(*Data_Redis)(nil), // 2: conf.Data.Redis
|
||||
(*durationpb.Duration)(nil), // 3: google.protobuf.Duration
|
||||
}
|
||||
var file_conf_v1_kratos_conf_data_proto_depIdxs = []int32{
|
||||
1, // 0: conf.Data.database:type_name -> conf.Data.Database
|
||||
2, // 1: conf.Data.redis:type_name -> conf.Data.Redis
|
||||
3, // 2: conf.Data.Database.connection_max_lifetime:type_name -> google.protobuf.Duration
|
||||
3, // 3: conf.Data.Redis.dial_timeout:type_name -> google.protobuf.Duration
|
||||
3, // 4: conf.Data.Redis.read_timeout:type_name -> google.protobuf.Duration
|
||||
3, // 5: conf.Data.Redis.write_timeout:type_name -> google.protobuf.Duration
|
||||
6, // [6:6] is the sub-list for method output_type
|
||||
6, // [6:6] is the sub-list for method input_type
|
||||
6, // [6:6] is the sub-list for extension type_name
|
||||
6, // [6:6] is the sub-list for extension extendee
|
||||
0, // [0:6] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_conf_v1_kratos_conf_data_proto_init() }
|
||||
func file_conf_v1_kratos_conf_data_proto_init() {
|
||||
if File_conf_v1_kratos_conf_data_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_conf_v1_kratos_conf_data_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Data); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_conf_v1_kratos_conf_data_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Data_Database); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_conf_v1_kratos_conf_data_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Data_Redis); 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_conf_v1_kratos_conf_data_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_conf_v1_kratos_conf_data_proto_goTypes,
|
||||
DependencyIndexes: file_conf_v1_kratos_conf_data_proto_depIdxs,
|
||||
MessageInfos: file_conf_v1_kratos_conf_data_proto_msgTypes,
|
||||
}.Build()
|
||||
File_conf_v1_kratos_conf_data_proto = out.File
|
||||
file_conf_v1_kratos_conf_data_proto_rawDesc = nil
|
||||
file_conf_v1_kratos_conf_data_proto_goTypes = nil
|
||||
file_conf_v1_kratos_conf_data_proto_depIdxs = nil
|
||||
}
|
||||
@@ -1,965 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.31.0
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_server.proto
|
||||
|
||||
package conf
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
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 Server struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Rest *Server_REST `protobuf:"bytes,1,opt,name=rest,proto3" json:"rest,omitempty"` // REST服务
|
||||
Grpc *Server_GRPC `protobuf:"bytes,2,opt,name=grpc,proto3" json:"grpc,omitempty"` // gRPC服务
|
||||
Websocket *Server_Websocket `protobuf:"bytes,3,opt,name=websocket,proto3" json:"websocket,omitempty"` // Websocket服务
|
||||
Mqtt *Server_Mqtt `protobuf:"bytes,4,opt,name=mqtt,proto3" json:"mqtt,omitempty"` // MQTT服务
|
||||
Kafka *Server_Kafka `protobuf:"bytes,5,opt,name=kafka,proto3" json:"kafka,omitempty"` // Kafka服务
|
||||
Rabbitmq *Server_RabbitMQ `protobuf:"bytes,6,opt,name=rabbitmq,proto3" json:"rabbitmq,omitempty"` // RabbitMQ服务
|
||||
Asynq *Server_Asynq `protobuf:"bytes,7,opt,name=asynq,proto3" json:"asynq,omitempty"` // Asynq服务
|
||||
Machinery *Server_Machinery `protobuf:"bytes,8,opt,name=machinery,proto3" json:"machinery,omitempty"` // Machinery服务
|
||||
}
|
||||
|
||||
func (x *Server) Reset() {
|
||||
*x = Server{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Server) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Server) ProtoMessage() {}
|
||||
|
||||
func (x *Server) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_server_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 Server.ProtoReflect.Descriptor instead.
|
||||
func (*Server) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_server_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Server) GetRest() *Server_REST {
|
||||
if x != nil {
|
||||
return x.Rest
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Server) GetGrpc() *Server_GRPC {
|
||||
if x != nil {
|
||||
return x.Grpc
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Server) GetWebsocket() *Server_Websocket {
|
||||
if x != nil {
|
||||
return x.Websocket
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Server) GetMqtt() *Server_Mqtt {
|
||||
if x != nil {
|
||||
return x.Mqtt
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Server) GetKafka() *Server_Kafka {
|
||||
if x != nil {
|
||||
return x.Kafka
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Server) GetRabbitmq() *Server_RabbitMQ {
|
||||
if x != nil {
|
||||
return x.Rabbitmq
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Server) GetAsynq() *Server_Asynq {
|
||||
if x != nil {
|
||||
return x.Asynq
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Server) GetMachinery() *Server_Machinery {
|
||||
if x != nil {
|
||||
return x.Machinery
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// REST
|
||||
type Server_REST struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Network string `protobuf:"bytes,1,opt,name=network,proto3" json:"network,omitempty"` // 网络
|
||||
Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` // 服务监听地址
|
||||
Timeout *durationpb.Duration `protobuf:"bytes,3,opt,name=timeout,proto3" json:"timeout,omitempty"` // 超时时间
|
||||
Cors *Server_REST_CORS `protobuf:"bytes,4,opt,name=cors,proto3" json:"cors,omitempty"` // 服务监听地址
|
||||
Middleware *Middleware `protobuf:"bytes,5,opt,name=middleware,proto3" json:"middleware,omitempty"` // 中间件
|
||||
}
|
||||
|
||||
func (x *Server_REST) Reset() {
|
||||
*x = Server_REST{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Server_REST) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Server_REST) ProtoMessage() {}
|
||||
|
||||
func (x *Server_REST) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_server_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 Server_REST.ProtoReflect.Descriptor instead.
|
||||
func (*Server_REST) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_server_proto_rawDescGZIP(), []int{0, 0}
|
||||
}
|
||||
|
||||
func (x *Server_REST) GetNetwork() string {
|
||||
if x != nil {
|
||||
return x.Network
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Server_REST) GetAddr() string {
|
||||
if x != nil {
|
||||
return x.Addr
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Server_REST) GetTimeout() *durationpb.Duration {
|
||||
if x != nil {
|
||||
return x.Timeout
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Server_REST) GetCors() *Server_REST_CORS {
|
||||
if x != nil {
|
||||
return x.Cors
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Server_REST) GetMiddleware() *Middleware {
|
||||
if x != nil {
|
||||
return x.Middleware
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// gPRC
|
||||
type Server_GRPC struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Network string `protobuf:"bytes,1,opt,name=network,proto3" json:"network,omitempty"` // 网络
|
||||
Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` // 服务监听地址
|
||||
Timeout *durationpb.Duration `protobuf:"bytes,3,opt,name=timeout,proto3" json:"timeout,omitempty"` // 超时时间
|
||||
Middleware *Middleware `protobuf:"bytes,4,opt,name=middleware,proto3" json:"middleware,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Server_GRPC) Reset() {
|
||||
*x = Server_GRPC{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Server_GRPC) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Server_GRPC) ProtoMessage() {}
|
||||
|
||||
func (x *Server_GRPC) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[2]
|
||||
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 Server_GRPC.ProtoReflect.Descriptor instead.
|
||||
func (*Server_GRPC) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_server_proto_rawDescGZIP(), []int{0, 1}
|
||||
}
|
||||
|
||||
func (x *Server_GRPC) GetNetwork() string {
|
||||
if x != nil {
|
||||
return x.Network
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Server_GRPC) GetAddr() string {
|
||||
if x != nil {
|
||||
return x.Addr
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Server_GRPC) GetTimeout() *durationpb.Duration {
|
||||
if x != nil {
|
||||
return x.Timeout
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Server_GRPC) GetMiddleware() *Middleware {
|
||||
if x != nil {
|
||||
return x.Middleware
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Websocket
|
||||
type Server_Websocket struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Network string `protobuf:"bytes,1,opt,name=network,proto3" json:"network,omitempty"` // 网络样式:http、https
|
||||
Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` // 服务监听地址
|
||||
Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"` // 路径
|
||||
Timeout *durationpb.Duration `protobuf:"bytes,4,opt,name=timeout,proto3" json:"timeout,omitempty"` // 超时时间
|
||||
}
|
||||
|
||||
func (x *Server_Websocket) Reset() {
|
||||
*x = Server_Websocket{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Server_Websocket) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Server_Websocket) ProtoMessage() {}
|
||||
|
||||
func (x *Server_Websocket) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[3]
|
||||
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 Server_Websocket.ProtoReflect.Descriptor instead.
|
||||
func (*Server_Websocket) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_server_proto_rawDescGZIP(), []int{0, 2}
|
||||
}
|
||||
|
||||
func (x *Server_Websocket) GetNetwork() string {
|
||||
if x != nil {
|
||||
return x.Network
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Server_Websocket) GetAddr() string {
|
||||
if x != nil {
|
||||
return x.Addr
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Server_Websocket) GetPath() string {
|
||||
if x != nil {
|
||||
return x.Path
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Server_Websocket) GetTimeout() *durationpb.Duration {
|
||||
if x != nil {
|
||||
return x.Timeout
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MQTT
|
||||
type Server_Mqtt struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` // 对端网络地址
|
||||
}
|
||||
|
||||
func (x *Server_Mqtt) Reset() {
|
||||
*x = Server_Mqtt{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Server_Mqtt) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Server_Mqtt) ProtoMessage() {}
|
||||
|
||||
func (x *Server_Mqtt) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[4]
|
||||
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 Server_Mqtt.ProtoReflect.Descriptor instead.
|
||||
func (*Server_Mqtt) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_server_proto_rawDescGZIP(), []int{0, 3}
|
||||
}
|
||||
|
||||
func (x *Server_Mqtt) GetAddr() string {
|
||||
if x != nil {
|
||||
return x.Addr
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Kafka
|
||||
type Server_Kafka struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Addrs []string `protobuf:"bytes,1,rep,name=addrs,proto3" json:"addrs,omitempty"` // 对端网络地址
|
||||
}
|
||||
|
||||
func (x *Server_Kafka) Reset() {
|
||||
*x = Server_Kafka{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Server_Kafka) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Server_Kafka) ProtoMessage() {}
|
||||
|
||||
func (x *Server_Kafka) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[5]
|
||||
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 Server_Kafka.ProtoReflect.Descriptor instead.
|
||||
func (*Server_Kafka) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_server_proto_rawDescGZIP(), []int{0, 4}
|
||||
}
|
||||
|
||||
func (x *Server_Kafka) GetAddrs() []string {
|
||||
if x != nil {
|
||||
return x.Addrs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RabbitMQ
|
||||
type Server_RabbitMQ struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Addrs []string `protobuf:"bytes,1,rep,name=addrs,proto3" json:"addrs,omitempty"` // 对端网络地址
|
||||
}
|
||||
|
||||
func (x *Server_RabbitMQ) Reset() {
|
||||
*x = Server_RabbitMQ{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Server_RabbitMQ) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Server_RabbitMQ) ProtoMessage() {}
|
||||
|
||||
func (x *Server_RabbitMQ) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[6]
|
||||
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 Server_RabbitMQ.ProtoReflect.Descriptor instead.
|
||||
func (*Server_RabbitMQ) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_server_proto_rawDescGZIP(), []int{0, 5}
|
||||
}
|
||||
|
||||
func (x *Server_RabbitMQ) GetAddrs() []string {
|
||||
if x != nil {
|
||||
return x.Addrs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Asynq
|
||||
type Server_Asynq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Endpoint string `protobuf:"bytes,1,opt,name=endpoint,proto3" json:"endpoint,omitempty"` // 对端网络地址
|
||||
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` // redis登录密码
|
||||
Db int32 `protobuf:"varint,3,opt,name=db,proto3" json:"db,omitempty"` // 数据库索引
|
||||
}
|
||||
|
||||
func (x *Server_Asynq) Reset() {
|
||||
*x = Server_Asynq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Server_Asynq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Server_Asynq) ProtoMessage() {}
|
||||
|
||||
func (x *Server_Asynq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[7]
|
||||
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 Server_Asynq.ProtoReflect.Descriptor instead.
|
||||
func (*Server_Asynq) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_server_proto_rawDescGZIP(), []int{0, 6}
|
||||
}
|
||||
|
||||
func (x *Server_Asynq) GetEndpoint() string {
|
||||
if x != nil {
|
||||
return x.Endpoint
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Server_Asynq) GetPassword() string {
|
||||
if x != nil {
|
||||
return x.Password
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Server_Asynq) GetDb() int32 {
|
||||
if x != nil {
|
||||
return x.Db
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// Machinery
|
||||
type Server_Machinery struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Brokers []string `protobuf:"bytes,1,rep,name=brokers,proto3" json:"brokers,omitempty"` // broker的地址,可以根据实际使用的存储介质,分别指定Redis、AMQP或AWS SQS;
|
||||
Backends []string `protobuf:"bytes,2,rep,name=backends,proto3" json:"backends,omitempty"` // backend配置,用来指定存放结果的介质的配置。可以根据需求,分别指定为:Redis、memcached或mongodb等;
|
||||
}
|
||||
|
||||
func (x *Server_Machinery) Reset() {
|
||||
*x = Server_Machinery{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Server_Machinery) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Server_Machinery) ProtoMessage() {}
|
||||
|
||||
func (x *Server_Machinery) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[8]
|
||||
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 Server_Machinery.ProtoReflect.Descriptor instead.
|
||||
func (*Server_Machinery) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_server_proto_rawDescGZIP(), []int{0, 7}
|
||||
}
|
||||
|
||||
func (x *Server_Machinery) GetBrokers() []string {
|
||||
if x != nil {
|
||||
return x.Brokers
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Server_Machinery) GetBackends() []string {
|
||||
if x != nil {
|
||||
return x.Backends
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Server_REST_CORS struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Headers []string `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty"` //
|
||||
Methods []string `protobuf:"bytes,2,rep,name=methods,proto3" json:"methods,omitempty"` //
|
||||
Origins []string `protobuf:"bytes,3,rep,name=origins,proto3" json:"origins,omitempty"` //
|
||||
}
|
||||
|
||||
func (x *Server_REST_CORS) Reset() {
|
||||
*x = Server_REST_CORS{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Server_REST_CORS) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Server_REST_CORS) ProtoMessage() {}
|
||||
|
||||
func (x *Server_REST_CORS) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_server_proto_msgTypes[9]
|
||||
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 Server_REST_CORS.ProtoReflect.Descriptor instead.
|
||||
func (*Server_REST_CORS) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_server_proto_rawDescGZIP(), []int{0, 0, 0}
|
||||
}
|
||||
|
||||
func (x *Server_REST_CORS) GetHeaders() []string {
|
||||
if x != nil {
|
||||
return x.Headers
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Server_REST_CORS) GetMethods() []string {
|
||||
if x != nil {
|
||||
return x.Methods
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Server_REST_CORS) GetOrigins() []string {
|
||||
if x != nil {
|
||||
return x.Origins
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_conf_v1_kratos_conf_server_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_server_proto_rawDesc = []byte{
|
||||
0x0a, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 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, 0x1a, 0x24, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76,
|
||||
0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x6d, 0x69,
|
||||
0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa4,
|
||||
0x09, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x25, 0x0a, 0x04, 0x72, 0x65, 0x73,
|
||||
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53,
|
||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x52, 0x45, 0x53, 0x54, 0x52, 0x04, 0x72, 0x65, 0x73, 0x74,
|
||||
0x12, 0x25, 0x0a, 0x04, 0x67, 0x72, 0x70, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11,
|
||||
0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x47, 0x52, 0x50,
|
||||
0x43, 0x52, 0x04, 0x67, 0x72, 0x70, 0x63, 0x12, 0x34, 0x0a, 0x09, 0x77, 0x65, 0x62, 0x73, 0x6f,
|
||||
0x63, 0x6b, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b,
|
||||
0x65, 0x74, 0x52, 0x09, 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x25, 0x0a,
|
||||
0x04, 0x6d, 0x71, 0x74, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4d, 0x71, 0x74, 0x74, 0x52, 0x04,
|
||||
0x6d, 0x71, 0x74, 0x74, 0x12, 0x28, 0x0a, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x18, 0x05, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65,
|
||||
0x72, 0x2e, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x52, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x12, 0x31,
|
||||
0x0a, 0x08, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x6d, 0x71, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x15, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x52,
|
||||
0x61, 0x62, 0x62, 0x69, 0x74, 0x4d, 0x51, 0x52, 0x08, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x6d,
|
||||
0x71, 0x12, 0x28, 0x0a, 0x05, 0x61, 0x73, 0x79, 0x6e, 0x71, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x41,
|
||||
0x73, 0x79, 0x6e, 0x71, 0x52, 0x05, 0x61, 0x73, 0x79, 0x6e, 0x71, 0x12, 0x34, 0x0a, 0x09, 0x6d,
|
||||
0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16,
|
||||
0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x63,
|
||||
0x68, 0x69, 0x6e, 0x65, 0x72, 0x79, 0x52, 0x09, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x72,
|
||||
0x79, 0x1a, 0x9d, 0x02, 0x0a, 0x04, 0x52, 0x45, 0x53, 0x54, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65,
|
||||
0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74,
|
||||
0x77, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65,
|
||||
0x6f, 0x75, 0x74, 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, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x2a, 0x0a,
|
||||
0x04, 0x63, 0x6f, 0x72, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x52, 0x45, 0x53, 0x54, 0x2e, 0x43,
|
||||
0x4f, 0x52, 0x53, 0x52, 0x04, 0x63, 0x6f, 0x72, 0x73, 0x12, 0x30, 0x0a, 0x0a, 0x6d, 0x69, 0x64,
|
||||
0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e,
|
||||
0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x52,
|
||||
0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x1a, 0x54, 0x0a, 0x04, 0x43,
|
||||
0x4f, 0x52, 0x53, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01,
|
||||
0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07,
|
||||
0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x72, 0x69, 0x67, 0x69,
|
||||
0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e,
|
||||
0x73, 0x1a, 0x9b, 0x01, 0x0a, 0x04, 0x47, 0x52, 0x50, 0x43, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65,
|
||||
0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74,
|
||||
0x77, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65,
|
||||
0x6f, 0x75, 0x74, 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, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x30, 0x0a,
|
||||
0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77,
|
||||
0x61, 0x72, 0x65, 0x52, 0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x1a,
|
||||
0x82, 0x01, 0x0a, 0x09, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
|
||||
0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70,
|
||||
0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12,
|
||||
0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 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, 0x52, 0x07, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x6f, 0x75, 0x74, 0x1a, 0x1a, 0x0a, 0x04, 0x4d, 0x71, 0x74, 0x74, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72,
|
||||
0x1a, 0x1d, 0x0a, 0x05, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x64,
|
||||
0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x64, 0x72, 0x73, 0x1a,
|
||||
0x20, 0x0a, 0x08, 0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x4d, 0x51, 0x12, 0x14, 0x0a, 0x05, 0x61,
|
||||
0x64, 0x64, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x64, 0x72,
|
||||
0x73, 0x1a, 0x4f, 0x0a, 0x05, 0x41, 0x73, 0x79, 0x6e, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e,
|
||||
0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e,
|
||||
0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f,
|
||||
0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f,
|
||||
0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x64, 0x62, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02,
|
||||
0x64, 0x62, 0x1a, 0x41, 0x0a, 0x09, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x72, 0x79, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09,
|
||||
0x52, 0x07, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x61, 0x63,
|
||||
0x6b, 0x65, 0x6e, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x62, 0x61, 0x63,
|
||||
0x6b, 0x65, 0x6e, 0x64, 0x73, 0x42, 0x3b, 0x5a, 0x39, 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, 0x67, 0x65, 0x6e, 0x2f, 0x61,
|
||||
0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_conf_v1_kratos_conf_server_proto_rawDescOnce sync.Once
|
||||
file_conf_v1_kratos_conf_server_proto_rawDescData = file_conf_v1_kratos_conf_server_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_conf_v1_kratos_conf_server_proto_rawDescGZIP() []byte {
|
||||
file_conf_v1_kratos_conf_server_proto_rawDescOnce.Do(func() {
|
||||
file_conf_v1_kratos_conf_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_conf_v1_kratos_conf_server_proto_rawDescData)
|
||||
})
|
||||
return file_conf_v1_kratos_conf_server_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_conf_v1_kratos_conf_server_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
||||
var file_conf_v1_kratos_conf_server_proto_goTypes = []interface{}{
|
||||
(*Server)(nil), // 0: conf.Server
|
||||
(*Server_REST)(nil), // 1: conf.Server.REST
|
||||
(*Server_GRPC)(nil), // 2: conf.Server.GRPC
|
||||
(*Server_Websocket)(nil), // 3: conf.Server.Websocket
|
||||
(*Server_Mqtt)(nil), // 4: conf.Server.Mqtt
|
||||
(*Server_Kafka)(nil), // 5: conf.Server.Kafka
|
||||
(*Server_RabbitMQ)(nil), // 6: conf.Server.RabbitMQ
|
||||
(*Server_Asynq)(nil), // 7: conf.Server.Asynq
|
||||
(*Server_Machinery)(nil), // 8: conf.Server.Machinery
|
||||
(*Server_REST_CORS)(nil), // 9: conf.Server.REST.CORS
|
||||
(*durationpb.Duration)(nil), // 10: google.protobuf.Duration
|
||||
(*Middleware)(nil), // 11: conf.Middleware
|
||||
}
|
||||
var file_conf_v1_kratos_conf_server_proto_depIdxs = []int32{
|
||||
1, // 0: conf.Server.rest:type_name -> conf.Server.REST
|
||||
2, // 1: conf.Server.grpc:type_name -> conf.Server.GRPC
|
||||
3, // 2: conf.Server.websocket:type_name -> conf.Server.Websocket
|
||||
4, // 3: conf.Server.mqtt:type_name -> conf.Server.Mqtt
|
||||
5, // 4: conf.Server.kafka:type_name -> conf.Server.Kafka
|
||||
6, // 5: conf.Server.rabbitmq:type_name -> conf.Server.RabbitMQ
|
||||
7, // 6: conf.Server.asynq:type_name -> conf.Server.Asynq
|
||||
8, // 7: conf.Server.machinery:type_name -> conf.Server.Machinery
|
||||
10, // 8: conf.Server.REST.timeout:type_name -> google.protobuf.Duration
|
||||
9, // 9: conf.Server.REST.cors:type_name -> conf.Server.REST.CORS
|
||||
11, // 10: conf.Server.REST.middleware:type_name -> conf.Middleware
|
||||
10, // 11: conf.Server.GRPC.timeout:type_name -> google.protobuf.Duration
|
||||
11, // 12: conf.Server.GRPC.middleware:type_name -> conf.Middleware
|
||||
10, // 13: conf.Server.Websocket.timeout:type_name -> google.protobuf.Duration
|
||||
14, // [14:14] is the sub-list for method output_type
|
||||
14, // [14:14] is the sub-list for method input_type
|
||||
14, // [14:14] is the sub-list for extension type_name
|
||||
14, // [14:14] is the sub-list for extension extendee
|
||||
0, // [0:14] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_conf_v1_kratos_conf_server_proto_init() }
|
||||
func file_conf_v1_kratos_conf_server_proto_init() {
|
||||
if File_conf_v1_kratos_conf_server_proto != nil {
|
||||
return
|
||||
}
|
||||
file_conf_v1_kratos_conf_middleware_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_conf_v1_kratos_conf_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Server); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_conf_v1_kratos_conf_server_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Server_REST); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_conf_v1_kratos_conf_server_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Server_GRPC); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_conf_v1_kratos_conf_server_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Server_Websocket); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_conf_v1_kratos_conf_server_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Server_Mqtt); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_conf_v1_kratos_conf_server_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Server_Kafka); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_conf_v1_kratos_conf_server_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Server_RabbitMQ); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_conf_v1_kratos_conf_server_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Server_Asynq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_conf_v1_kratos_conf_server_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Server_Machinery); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_conf_v1_kratos_conf_server_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Server_REST_CORS); 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_conf_v1_kratos_conf_server_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 10,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_conf_v1_kratos_conf_server_proto_goTypes,
|
||||
DependencyIndexes: file_conf_v1_kratos_conf_server_proto_depIdxs,
|
||||
MessageInfos: file_conf_v1_kratos_conf_server_proto_msgTypes,
|
||||
}.Build()
|
||||
File_conf_v1_kratos_conf_server_proto = out.File
|
||||
file_conf_v1_kratos_conf_server_proto_rawDesc = nil
|
||||
file_conf_v1_kratos_conf_server_proto_goTypes = nil
|
||||
file_conf_v1_kratos_conf_server_proto_depIdxs = nil
|
||||
}
|
||||
200
go.mod
200
go.mod
@@ -1,201 +1,5 @@
|
||||
module github.com/tx7do/kratos-bootstrap
|
||||
|
||||
go 1.20
|
||||
go 1.23
|
||||
|
||||
require (
|
||||
github.com/go-chassis/sc-client v0.7.0
|
||||
github.com/go-kratos/aegis v0.2.0
|
||||
github.com/go-kratos/kratos/contrib/config/apollo/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/config/consul/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/config/etcd/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/config/kubernetes/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/config/nacos/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/config/polaris/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/log/aliyun/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/log/fluent/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/log/logrus/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/log/tencent/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/log/zap/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/registry/eureka/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/registry/kubernetes/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/registry/nacos/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/registry/polaris/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/registry/servicecomb/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/contrib/registry/zookeeper/v2 v2.0.0-20231023125239-6cdd81811e10
|
||||
github.com/go-kratos/kratos/v2 v2.7.1
|
||||
github.com/go-redis/redis/extra/redisotel/v8 v8.11.5
|
||||
github.com/go-redis/redis/v8 v8.11.5
|
||||
github.com/go-zookeeper/zk v1.0.3
|
||||
github.com/google/subcommands v1.2.0
|
||||
github.com/gorilla/handlers v1.5.1
|
||||
github.com/hashicorp/consul/api v1.25.1
|
||||
github.com/minio/minio-go/v7 v7.0.63
|
||||
github.com/nacos-group/nacos-sdk-go v1.1.4
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/polarismesh/polaris-go v1.5.5
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/spf13/cobra v1.7.0
|
||||
github.com/stretchr/testify v1.8.4
|
||||
go.etcd.io/etcd/client/v3 v3.5.9
|
||||
go.opentelemetry.io/otel v1.19.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0
|
||||
go.opentelemetry.io/otel/exporters/zipkin v1.19.0
|
||||
go.opentelemetry.io/otel/sdk v1.19.0
|
||||
go.uber.org/zap v1.26.0
|
||||
golang.org/x/tools v0.14.0
|
||||
google.golang.org/grpc v1.59.0
|
||||
google.golang.org/protobuf v1.31.0
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1
|
||||
k8s.io/client-go v0.28.3
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v1.62.589 // indirect
|
||||
github.com/aliyun/aliyun-log-go-sdk v0.1.64 // indirect
|
||||
github.com/apolloconfig/agollo/v4 v4.3.1 // indirect
|
||||
github.com/armon/go-metrics v0.4.1 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/buger/jsonparser v1.1.1 // indirect
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/coreos/go-semver v0.3.1 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/deckarep/golang-set v1.8.0 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/dlclark/regexp2 v1.10.0 // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
|
||||
github.com/fatih/color v1.15.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.3 // indirect
|
||||
github.com/fluent/fluent-logger-golang v1.9.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
github.com/go-chassis/cari v0.9.0 // indirect
|
||||
github.com/go-chassis/foundation v0.4.0 // indirect
|
||||
github.com/go-chassis/openlog v1.1.3 // indirect
|
||||
github.com/go-errors/errors v1.5.1 // indirect
|
||||
github.com/go-kit/kit v0.13.0 // indirect
|
||||
github.com/go-kit/log v0.2.1 // indirect
|
||||
github.com/go-logfmt/logfmt v0.6.0 // indirect
|
||||
github.com/go-logr/logr v1.2.4 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.20.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.2 // indirect
|
||||
github.com/go-openapi/swag v0.22.4 // indirect
|
||||
github.com/go-playground/form/v4 v4.2.1 // indirect
|
||||
github.com/go-redis/redis/extra/rediscmd/v8 v8.11.5 // indirect
|
||||
github.com/gofrs/uuid v4.4.0+incompatible // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/uuid v1.3.1 // indirect
|
||||
github.com/gorilla/mux v1.8.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-hclog v1.5.0 // indirect
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
|
||||
github.com/hashicorp/golang-lru v1.0.2 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hashicorp/serf v0.10.1 // indirect
|
||||
github.com/imdario/mergo v0.3.16 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/karlseguin/ccache/v2 v2.0.8 // indirect
|
||||
github.com/klauspost/compress v1.17.2 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
|
||||
github.com/minio/md5-simd v1.1.2 // indirect
|
||||
github.com/minio/sha256-simd v1.0.1 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b // indirect
|
||||
github.com/openzipkin/zipkin-go v0.4.2 // indirect
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
|
||||
github.com/philhofer/fwd v1.1.2 // indirect
|
||||
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/polarismesh/specification v1.4.1 // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect
|
||||
github.com/prometheus/client_golang v1.17.0 // indirect
|
||||
github.com/prometheus/client_model v0.5.0 // indirect
|
||||
github.com/prometheus/common v0.45.0 // indirect
|
||||
github.com/prometheus/procfs v0.12.0 // indirect
|
||||
github.com/rivo/uniseg v0.4.4 // indirect
|
||||
github.com/rs/xid v1.5.0 // indirect
|
||||
github.com/sagikazarmark/locafero v0.3.0 // indirect
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.23.6 // indirect
|
||||
github.com/shoenig/go-m1cpu v0.1.6 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/spf13/afero v1.10.0 // indirect
|
||||
github.com/spf13/cast v1.5.1 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/viper v1.17.0 // indirect
|
||||
github.com/stretchr/objx v0.5.1 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/tencentcloud/tencentcloud-cls-sdk-go v1.0.6 // indirect
|
||||
github.com/tinylib/msgp v1.1.8 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.11 // indirect
|
||||
github.com/tklauser/numcpus v0.6.1 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.3 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.9 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.19.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.19.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
|
||||
go.uber.org/atomic v1.11.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
golang.org/x/crypto v0.14.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
|
||||
golang.org/x/mod v0.13.0 // indirect
|
||||
golang.org/x/net v0.17.0 // indirect
|
||||
golang.org/x/oauth2 v0.13.0 // indirect
|
||||
golang.org/x/sync v0.4.0 // indirect
|
||||
golang.org/x/sys v0.13.0 // indirect
|
||||
golang.org/x/term v0.13.0 // indirect
|
||||
golang.org/x/text v0.13.0 // indirect
|
||||
golang.org/x/time v0.3.0 // indirect
|
||||
google.golang.org/appengine v1.6.8 // indirect
|
||||
google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/api v0.28.3 // indirect
|
||||
k8s.io/apimachinery v0.28.3 // indirect
|
||||
k8s.io/klog/v2 v2.100.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.3.0 // indirect
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
toolchain go1.23.2
|
||||
|
||||
104
grpc.go
104
grpc.go
@@ -1,104 +0,0 @@
|
||||
package bootstrap
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/go-kratos/aegis/ratelimit"
|
||||
"github.com/go-kratos/aegis/ratelimit/bbr"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"github.com/go-kratos/kratos/v2/middleware"
|
||||
midRateLimit "github.com/go-kratos/kratos/v2/middleware/ratelimit"
|
||||
"github.com/go-kratos/kratos/v2/middleware/recovery"
|
||||
"github.com/go-kratos/kratos/v2/middleware/tracing"
|
||||
"github.com/go-kratos/kratos/v2/middleware/validate"
|
||||
"github.com/go-kratos/kratos/v2/registry"
|
||||
kratosGrpc "github.com/go-kratos/kratos/v2/transport/grpc"
|
||||
|
||||
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
|
||||
)
|
||||
|
||||
const defaultTimeout = 5 * time.Second
|
||||
|
||||
// CreateGrpcClient 创建GRPC客户端
|
||||
func CreateGrpcClient(ctx context.Context, r registry.Discovery, serviceName string, cfg *conf.Bootstrap, m ...middleware.Middleware) grpc.ClientConnInterface {
|
||||
endpoint := "discovery:///" + serviceName
|
||||
|
||||
var ms []middleware.Middleware
|
||||
timeout := defaultTimeout
|
||||
if cfg.Client != nil && cfg.Client.Grpc != nil {
|
||||
if cfg.Client.Grpc.Timeout != nil {
|
||||
timeout = cfg.Client.Grpc.Timeout.AsDuration()
|
||||
}
|
||||
|
||||
if cfg.Client.Grpc.Middleware != nil {
|
||||
if cfg.Client.Grpc.Middleware.GetEnableRecovery() {
|
||||
ms = append(ms, recovery.Recovery())
|
||||
}
|
||||
if cfg.Client.Grpc.Middleware.GetEnableTracing() {
|
||||
ms = append(ms, tracing.Client())
|
||||
}
|
||||
if cfg.Client.Grpc.Middleware.GetEnableValidate() {
|
||||
ms = append(ms, validate.Validator())
|
||||
}
|
||||
}
|
||||
}
|
||||
ms = append(ms, m...)
|
||||
|
||||
conn, err := kratosGrpc.DialInsecure(
|
||||
ctx,
|
||||
kratosGrpc.WithEndpoint(endpoint),
|
||||
kratosGrpc.WithDiscovery(r),
|
||||
kratosGrpc.WithTimeout(timeout),
|
||||
kratosGrpc.WithMiddleware(ms...),
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatalf("dial grpc client [%s] failed: %s", serviceName, err.Error())
|
||||
}
|
||||
|
||||
return conn
|
||||
}
|
||||
|
||||
// CreateGrpcServer 创建GRPC服务端
|
||||
func CreateGrpcServer(cfg *conf.Bootstrap, m ...middleware.Middleware) *kratosGrpc.Server {
|
||||
var opts []kratosGrpc.ServerOption
|
||||
|
||||
var ms []middleware.Middleware
|
||||
if cfg.Server != nil && cfg.Server.Grpc != nil && cfg.Server.Grpc.Middleware != nil {
|
||||
if cfg.Server.Grpc.Middleware.GetEnableRecovery() {
|
||||
ms = append(ms, recovery.Recovery())
|
||||
}
|
||||
if cfg.Server.Grpc.Middleware.GetEnableTracing() {
|
||||
ms = append(ms, tracing.Server())
|
||||
}
|
||||
if cfg.Server.Grpc.Middleware.GetEnableValidate() {
|
||||
ms = append(ms, validate.Validator())
|
||||
}
|
||||
if cfg.Server.Grpc.Middleware.GetEnableCircuitBreaker() {
|
||||
}
|
||||
if cfg.Server.Grpc.Middleware.Limiter != nil {
|
||||
var limiter ratelimit.Limiter
|
||||
switch cfg.Server.Grpc.Middleware.Limiter.GetName() {
|
||||
case "bbr":
|
||||
limiter = bbr.NewLimiter()
|
||||
}
|
||||
ms = append(ms, midRateLimit.Server(midRateLimit.WithLimiter(limiter)))
|
||||
}
|
||||
}
|
||||
ms = append(ms, m...)
|
||||
opts = append(opts, kratosGrpc.Middleware(ms...))
|
||||
|
||||
if cfg.Server.Grpc.Network != "" {
|
||||
opts = append(opts, kratosGrpc.Network(cfg.Server.Grpc.Network))
|
||||
}
|
||||
if cfg.Server.Grpc.Addr != "" {
|
||||
opts = append(opts, kratosGrpc.Address(cfg.Server.Grpc.Addr))
|
||||
}
|
||||
if cfg.Server.Grpc.Timeout != nil {
|
||||
opts = append(opts, kratosGrpc.Timeout(cfg.Server.Grpc.Timeout.AsDuration()))
|
||||
}
|
||||
|
||||
return kratosGrpc.NewServer(opts...)
|
||||
}
|
||||
179
logger.go
179
logger.go
@@ -1,179 +0,0 @@
|
||||
package bootstrap
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
"gopkg.in/natefinch/lumberjack.v2"
|
||||
|
||||
aliyunLogger "github.com/go-kratos/kratos/contrib/log/aliyun/v2"
|
||||
fluentLogger "github.com/go-kratos/kratos/contrib/log/fluent/v2"
|
||||
logrusLogger "github.com/go-kratos/kratos/contrib/log/logrus/v2"
|
||||
tencentLogger "github.com/go-kratos/kratos/contrib/log/tencent/v2"
|
||||
zapLogger "github.com/go-kratos/kratos/contrib/log/zap/v2"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"github.com/go-kratos/kratos/v2/middleware/tracing"
|
||||
|
||||
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
|
||||
)
|
||||
|
||||
type LoggerType string
|
||||
|
||||
const (
|
||||
LoggerTypeStd LoggerType = "std"
|
||||
LoggerTypeFluent LoggerType = "fluent"
|
||||
LoggerTypeLogrus LoggerType = "logrus"
|
||||
LoggerTypeZap LoggerType = "zap"
|
||||
LoggerTypeAliyun LoggerType = "aliyun"
|
||||
LoggerTypeTencent LoggerType = "tencent"
|
||||
)
|
||||
|
||||
// NewLoggerProvider 创建一个新的日志记录器提供者
|
||||
func NewLoggerProvider(cfg *conf.Logger, serviceInfo *ServiceInfo) log.Logger {
|
||||
l := NewLogger(cfg)
|
||||
|
||||
return log.With(
|
||||
l,
|
||||
"service.id", serviceInfo.Id,
|
||||
"service.name", serviceInfo.Name,
|
||||
"service.version", serviceInfo.Version,
|
||||
"ts", log.DefaultTimestamp,
|
||||
"caller", log.DefaultCaller,
|
||||
"trace_id", tracing.TraceID(),
|
||||
"span_id", tracing.SpanID(),
|
||||
)
|
||||
}
|
||||
|
||||
// NewLogger 创建一个新的日志记录器
|
||||
func NewLogger(cfg *conf.Logger) log.Logger {
|
||||
if cfg == nil {
|
||||
return NewStdLogger()
|
||||
}
|
||||
|
||||
switch LoggerType(cfg.Type) {
|
||||
default:
|
||||
fallthrough
|
||||
case LoggerTypeStd:
|
||||
return NewStdLogger()
|
||||
case LoggerTypeFluent:
|
||||
return NewFluentLogger(cfg)
|
||||
case LoggerTypeZap:
|
||||
return NewZapLogger(cfg)
|
||||
case LoggerTypeLogrus:
|
||||
return NewLogrusLogger(cfg)
|
||||
case LoggerTypeAliyun:
|
||||
return NewAliyunLogger(cfg)
|
||||
case LoggerTypeTencent:
|
||||
return NewTencentLogger(cfg)
|
||||
}
|
||||
}
|
||||
|
||||
// NewStdLogger 创建一个新的日志记录器 - Kratos内置,控制台输出
|
||||
func NewStdLogger() log.Logger {
|
||||
l := log.NewStdLogger(os.Stdout)
|
||||
return l
|
||||
}
|
||||
|
||||
// NewZapLogger 创建一个新的日志记录器 - Zap
|
||||
func NewZapLogger(cfg *conf.Logger) log.Logger {
|
||||
encoderConfig := zap.NewProductionEncoderConfig()
|
||||
encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
|
||||
encoderConfig.TimeKey = "time"
|
||||
encoderConfig.EncodeLevel = zapcore.CapitalLevelEncoder
|
||||
encoderConfig.EncodeDuration = zapcore.SecondsDurationEncoder
|
||||
encoderConfig.EncodeCaller = zapcore.ShortCallerEncoder
|
||||
jsonEncoder := zapcore.NewJSONEncoder(encoderConfig)
|
||||
|
||||
lumberJackLogger := &lumberjack.Logger{
|
||||
Filename: cfg.Zap.Filename,
|
||||
MaxSize: int(cfg.Zap.MaxSize),
|
||||
MaxBackups: int(cfg.Zap.MaxBackups),
|
||||
MaxAge: int(cfg.Zap.MaxAge),
|
||||
}
|
||||
writeSyncer := zapcore.AddSync(lumberJackLogger)
|
||||
|
||||
var lvl = new(zapcore.Level)
|
||||
if err := lvl.UnmarshalText([]byte(cfg.Zap.Level)); err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
core := zapcore.NewCore(jsonEncoder, writeSyncer, lvl)
|
||||
logger := zap.New(core).WithOptions()
|
||||
|
||||
wrapped := zapLogger.NewLogger(logger)
|
||||
|
||||
return wrapped
|
||||
}
|
||||
|
||||
// NewLogrusLogger 创建一个新的日志记录器 - Logrus
|
||||
func NewLogrusLogger(cfg *conf.Logger) log.Logger {
|
||||
loggerLevel, err := logrus.ParseLevel(cfg.Logrus.Level)
|
||||
if err != nil {
|
||||
loggerLevel = logrus.InfoLevel
|
||||
}
|
||||
|
||||
var loggerFormatter logrus.Formatter
|
||||
switch cfg.Logrus.Formatter {
|
||||
default:
|
||||
fallthrough
|
||||
case "text":
|
||||
loggerFormatter = &logrus.TextFormatter{
|
||||
DisableColors: cfg.Logrus.DisableColors,
|
||||
DisableTimestamp: cfg.Logrus.DisableTimestamp,
|
||||
TimestampFormat: cfg.Logrus.TimestampFormat,
|
||||
}
|
||||
break
|
||||
case "json":
|
||||
loggerFormatter = &logrus.JSONFormatter{
|
||||
DisableTimestamp: cfg.Logrus.DisableTimestamp,
|
||||
TimestampFormat: cfg.Logrus.TimestampFormat,
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
logger := logrus.New()
|
||||
logger.Level = loggerLevel
|
||||
logger.Formatter = loggerFormatter
|
||||
|
||||
wrapped := logrusLogger.NewLogger(logger)
|
||||
return wrapped
|
||||
}
|
||||
|
||||
// NewFluentLogger 创建一个新的日志记录器 - Fluent
|
||||
func NewFluentLogger(cfg *conf.Logger) log.Logger {
|
||||
wrapped, err := fluentLogger.NewLogger(cfg.Fluent.Endpoint)
|
||||
if err != nil {
|
||||
panic("create fluent logger failed")
|
||||
return nil
|
||||
}
|
||||
return wrapped
|
||||
}
|
||||
|
||||
// NewAliyunLogger 创建一个新的日志记录器 - Aliyun
|
||||
func NewAliyunLogger(cfg *conf.Logger) log.Logger {
|
||||
wrapped := aliyunLogger.NewAliyunLog(
|
||||
aliyunLogger.WithProject(cfg.Aliyun.Project),
|
||||
aliyunLogger.WithEndpoint(cfg.Aliyun.Endpoint),
|
||||
aliyunLogger.WithAccessKey(cfg.Aliyun.AccessKey),
|
||||
aliyunLogger.WithAccessSecret(cfg.Aliyun.AccessSecret),
|
||||
)
|
||||
return wrapped
|
||||
}
|
||||
|
||||
// NewTencentLogger 创建一个新的日志记录器 - Tencent
|
||||
func NewTencentLogger(cfg *conf.Logger) log.Logger {
|
||||
wrapped, err := tencentLogger.NewLogger(
|
||||
tencentLogger.WithTopicID(cfg.Tencent.TopicId),
|
||||
tencentLogger.WithEndpoint(cfg.Tencent.Endpoint),
|
||||
tencentLogger.WithAccessKey(cfg.Tencent.AccessKey),
|
||||
tencentLogger.WithAccessSecret(cfg.Tencent.AccessSecret),
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return nil
|
||||
}
|
||||
return wrapped
|
||||
}
|
||||
18
logger/aliyun/client.go
Normal file
18
logger/aliyun/client.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package aliyun
|
||||
|
||||
import (
|
||||
aliyunLogger "github.com/go-kratos/kratos/contrib/log/aliyun/v2"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewLogger 创建一个新的日志记录器 - Aliyun
|
||||
func NewLogger(cfg *conf.Logger) log.Logger {
|
||||
wrapped := aliyunLogger.NewAliyunLog(
|
||||
aliyunLogger.WithProject(cfg.Aliyun.Project),
|
||||
aliyunLogger.WithEndpoint(cfg.Aliyun.Endpoint),
|
||||
aliyunLogger.WithAccessKey(cfg.Aliyun.AccessKey),
|
||||
aliyunLogger.WithAccessSecret(cfg.Aliyun.AccessSecret),
|
||||
)
|
||||
return wrapped
|
||||
}
|
||||
17
logger/fluent/client.go
Normal file
17
logger/fluent/client.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package fluent
|
||||
|
||||
import (
|
||||
fluentLogger "github.com/go-kratos/kratos/contrib/log/fluent/v2"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewLogger 创建一个新的日志记录器 - Fluent
|
||||
func NewLogger(cfg *conf.Logger) log.Logger {
|
||||
wrapped, err := fluentLogger.NewLogger(cfg.Fluent.Endpoint)
|
||||
if err != nil {
|
||||
panic("create fluent logger failed")
|
||||
return nil
|
||||
}
|
||||
return wrapped
|
||||
}
|
||||
12
logger/go.mod
Normal file
12
logger/go.mod
Normal file
@@ -0,0 +1,12 @@
|
||||
module github.com/tx7do/kratos-bootstrap/logger
|
||||
|
||||
go 1.23
|
||||
|
||||
toolchain go1.23.2
|
||||
|
||||
replace (
|
||||
github.com/armon/go-metrics => github.com/hashicorp/go-metrics v0.4.1
|
||||
github.com/imdario/mergo => dario.cat/mergo v0.3.16
|
||||
|
||||
github.com/tx7do/kratos-bootstrap/api => ../api
|
||||
)
|
||||
63
logger/logger.go
Normal file
63
logger/logger.go
Normal file
@@ -0,0 +1,63 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"github.com/go-kratos/kratos/v2/middleware/tracing"
|
||||
|
||||
"github.com/tx7do/kratos-bootstrap/logger/fluent"
|
||||
"github.com/tx7do/kratos-bootstrap/logger/logrus"
|
||||
"github.com/tx7do/kratos-bootstrap/logger/tencent"
|
||||
"github.com/tx7do/kratos-bootstrap/logger/zap"
|
||||
|
||||
"github.com/tx7do/kratos-bootstrap/config"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewLogger 创建一个新的日志记录器
|
||||
func NewLogger(cfg *conf.Logger) log.Logger {
|
||||
if cfg == nil {
|
||||
return NewStdLogger()
|
||||
}
|
||||
|
||||
switch Type(cfg.Type) {
|
||||
default:
|
||||
fallthrough
|
||||
case Std:
|
||||
return NewStdLogger()
|
||||
case Fluent:
|
||||
return fluent.NewLogger(cfg)
|
||||
case Zap:
|
||||
return zap.NewLogger(cfg)
|
||||
case Logrus:
|
||||
return logrus.NewLogger(cfg)
|
||||
case Aliyun:
|
||||
return nil
|
||||
case Tencent:
|
||||
return tencent.NewLogger(cfg)
|
||||
}
|
||||
}
|
||||
|
||||
// NewLoggerProvider 创建一个新的日志记录器提供者
|
||||
func NewLoggerProvider(cfg *conf.Logger, serviceInfo *config.ServiceInfo) log.Logger {
|
||||
l := NewLogger(cfg)
|
||||
|
||||
return log.With(
|
||||
l,
|
||||
"service.id", serviceInfo.Id,
|
||||
"service.name", serviceInfo.Name,
|
||||
"service.version", serviceInfo.Version,
|
||||
"ts", log.DefaultTimestamp,
|
||||
"caller", log.DefaultCaller,
|
||||
"trace_id", tracing.TraceID(),
|
||||
"span_id", tracing.SpanID(),
|
||||
)
|
||||
}
|
||||
|
||||
// NewStdLogger 创建一个新的日志记录器 - Kratos内置,控制台输出
|
||||
func NewStdLogger() log.Logger {
|
||||
l := log.NewStdLogger(os.Stdout)
|
||||
return l
|
||||
}
|
||||
42
logger/logrus/client.go
Normal file
42
logger/logrus/client.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package logrus
|
||||
|
||||
import (
|
||||
logrusLogger "github.com/go-kratos/kratos/contrib/log/logrus/v2"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"github.com/sirupsen/logrus"
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewLogger 创建一个新的日志记录器 - Logrus
|
||||
func NewLogger(cfg *conf.Logger) log.Logger {
|
||||
loggerLevel, err := logrus.ParseLevel(cfg.Logrus.Level)
|
||||
if err != nil {
|
||||
loggerLevel = logrus.InfoLevel
|
||||
}
|
||||
|
||||
var loggerFormatter logrus.Formatter
|
||||
switch cfg.Logrus.Formatter {
|
||||
default:
|
||||
fallthrough
|
||||
case "text":
|
||||
loggerFormatter = &logrus.TextFormatter{
|
||||
DisableColors: cfg.Logrus.DisableColors,
|
||||
DisableTimestamp: cfg.Logrus.DisableTimestamp,
|
||||
TimestampFormat: cfg.Logrus.TimestampFormat,
|
||||
}
|
||||
break
|
||||
case "json":
|
||||
loggerFormatter = &logrus.JSONFormatter{
|
||||
DisableTimestamp: cfg.Logrus.DisableTimestamp,
|
||||
TimestampFormat: cfg.Logrus.TimestampFormat,
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
logger := logrus.New()
|
||||
logger.Level = loggerLevel
|
||||
logger.Formatter = loggerFormatter
|
||||
|
||||
wrapped := logrusLogger.NewLogger(logger)
|
||||
return wrapped
|
||||
}
|
||||
12
logger/options.go
Normal file
12
logger/options.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package logger
|
||||
|
||||
type Type string
|
||||
|
||||
const (
|
||||
Std Type = "std"
|
||||
Fluent Type = "fluent"
|
||||
Logrus Type = "logrus"
|
||||
Zap Type = "zap"
|
||||
Aliyun Type = "aliyun"
|
||||
Tencent Type = "tencent"
|
||||
)
|
||||
22
logger/tencent/client.go
Normal file
22
logger/tencent/client.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package tencent
|
||||
|
||||
import (
|
||||
tencentLogger "github.com/go-kratos/kratos/contrib/log/tencent/v2"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewLogger 创建一个新的日志记录器 - Tencent
|
||||
func NewLogger(cfg *conf.Logger) log.Logger {
|
||||
wrapped, err := tencentLogger.NewLogger(
|
||||
tencentLogger.WithTopicID(cfg.Tencent.TopicId),
|
||||
tencentLogger.WithEndpoint(cfg.Tencent.Endpoint),
|
||||
tencentLogger.WithAccessKey(cfg.Tencent.AccessKey),
|
||||
tencentLogger.WithAccessSecret(cfg.Tencent.AccessSecret),
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
return nil
|
||||
}
|
||||
return wrapped
|
||||
}
|
||||
44
logger/zap/client.go
Normal file
44
logger/zap/client.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package zap
|
||||
|
||||
import (
|
||||
zapLogger "github.com/go-kratos/kratos/contrib/log/zap/v2"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
"gopkg.in/natefinch/lumberjack.v2"
|
||||
)
|
||||
|
||||
// NewLogger 创建一个新的日志记录器 - Zap
|
||||
func NewLogger(cfg *conf.Logger) log.Logger {
|
||||
encoderConfig := zap.NewProductionEncoderConfig()
|
||||
encoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
|
||||
encoderConfig.TimeKey = "time"
|
||||
encoderConfig.EncodeLevel = zapcore.CapitalLevelEncoder
|
||||
encoderConfig.EncodeDuration = zapcore.SecondsDurationEncoder
|
||||
encoderConfig.EncodeCaller = zapcore.ShortCallerEncoder
|
||||
jsonEncoder := zapcore.NewJSONEncoder(encoderConfig)
|
||||
|
||||
lumberJackLogger := &lumberjack.Logger{
|
||||
Filename: cfg.Zap.Filename,
|
||||
MaxSize: int(cfg.Zap.MaxSize),
|
||||
MaxBackups: int(cfg.Zap.MaxBackups),
|
||||
MaxAge: int(cfg.Zap.MaxAge),
|
||||
}
|
||||
writeSyncer := zapcore.AddSync(lumberJackLogger)
|
||||
|
||||
var lvl = new(zapcore.Level)
|
||||
if err := lvl.UnmarshalText([]byte(cfg.Zap.Level)); err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
core := zapcore.NewCore(jsonEncoder, writeSyncer, lvl)
|
||||
logger := zap.New(core).WithOptions()
|
||||
|
||||
wrapped := zapLogger.NewLogger(logger)
|
||||
|
||||
return wrapped
|
||||
}
|
||||
31
oss/minio/go.mod
Normal file
31
oss/minio/go.mod
Normal file
@@ -0,0 +1,31 @@
|
||||
module github.com/tx7do/kratos-bootstrap/oss/minio
|
||||
|
||||
go 1.22.0
|
||||
|
||||
toolchain go1.22.1
|
||||
|
||||
replace github.com/tx7do/kratos-bootstrap/api => ../../api
|
||||
|
||||
require (
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/minio/minio-go/v7 v7.0.80
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/go-ini/ini v1.67.0 // indirect
|
||||
github.com/goccy/go-json v0.10.3 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/klauspost/compress v1.17.11 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
|
||||
github.com/minio/md5-simd v1.1.2 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rs/xid v1.6.0 // indirect
|
||||
golang.org/x/crypto v0.29.0 // indirect
|
||||
golang.org/x/net v0.31.0 // indirect
|
||||
golang.org/x/sys v0.27.0 // indirect
|
||||
golang.org/x/text v0.20.0 // indirect
|
||||
google.golang.org/protobuf v1.35.1 // indirect
|
||||
)
|
||||
43
oss/minio/go.sum
Normal file
43
oss/minio/go.sum
Normal file
@@ -0,0 +1,43 @@
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||
github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
|
||||
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
|
||||
github.com/go-kratos/kratos/v2 v2.8.2 h1:EsEA7AmPQ2YQQ0FZrDWO2HgBNqeWM8z/mWKzS5UkQaQ=
|
||||
github.com/go-kratos/kratos/v2 v2.8.2/go.mod h1:+Vfe3FzF0d+BfMdajA11jT0rAyJWublRE/seZQNZVxE=
|
||||
github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA=
|
||||
github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
||||
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY=
|
||||
github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8=
|
||||
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
|
||||
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
|
||||
github.com/minio/minio-go/v7 v7.0.80 h1:2mdUHXEykRdY/BigLt3Iuu1otL0JTogT0Nmltg0wujk=
|
||||
github.com/minio/minio-go/v7 v7.0.80/go.mod h1:84gmIilaX4zcvAWWzJ5Z1WI5axN+hAbM5w25xf8xvC0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU=
|
||||
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
|
||||
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
|
||||
golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
|
||||
golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
|
||||
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
|
||||
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
|
||||
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
|
||||
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
|
||||
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
|
||||
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
@@ -1,4 +1,4 @@
|
||||
package bootstrap
|
||||
package minio
|
||||
|
||||
import (
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
@@ -6,10 +6,10 @@ import (
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
|
||||
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
func NewMinIoClient(conf *conf.OSS) *minio.Client {
|
||||
func NewClient(conf *conf.OSS) *minio.Client {
|
||||
impl, err := minio.New(conf.Minio.Endpoint,
|
||||
&minio.Options{
|
||||
Creds: credentials.NewStaticV4(conf.Minio.AccessKey, conf.Minio.SecretKey, conf.Minio.Token),
|
||||
29
redis.go
29
redis.go
@@ -1,29 +0,0 @@
|
||||
package bootstrap
|
||||
|
||||
import (
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
"github.com/go-redis/redis/extra/redisotel/v8"
|
||||
"github.com/go-redis/redis/v8"
|
||||
|
||||
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewRedisClient 创建Redis客户端
|
||||
func NewRedisClient(conf *conf.Data) *redis.Client {
|
||||
rdb := redis.NewClient(&redis.Options{
|
||||
Addr: conf.Redis.Addr,
|
||||
Password: conf.Redis.Password,
|
||||
DB: int(conf.Redis.Db),
|
||||
DialTimeout: conf.Redis.DialTimeout.AsDuration(),
|
||||
WriteTimeout: conf.Redis.WriteTimeout.AsDuration(),
|
||||
ReadTimeout: conf.Redis.ReadTimeout.AsDuration(),
|
||||
})
|
||||
if rdb == nil {
|
||||
log.Fatalf("failed opening connection to redis")
|
||||
return nil
|
||||
}
|
||||
rdb.AddHook(redisotel.NewTracingHook())
|
||||
|
||||
return rdb
|
||||
}
|
||||
289
registry.go
289
registry.go
@@ -1,289 +0,0 @@
|
||||
package bootstrap
|
||||
|
||||
import (
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"github.com/go-kratos/kratos/v2/registry"
|
||||
"path/filepath"
|
||||
|
||||
// etcd
|
||||
etcdKratos "github.com/go-kratos/kratos/contrib/registry/etcd/v2"
|
||||
etcdClient "go.etcd.io/etcd/client/v3"
|
||||
|
||||
// consul
|
||||
consulKratos "github.com/go-kratos/kratos/contrib/registry/consul/v2"
|
||||
consulClient "github.com/hashicorp/consul/api"
|
||||
|
||||
// eureka
|
||||
eurekaKratos "github.com/go-kratos/kratos/contrib/registry/eureka/v2"
|
||||
|
||||
// nacos
|
||||
nacosKratos "github.com/go-kratos/kratos/contrib/registry/nacos/v2"
|
||||
nacosClients "github.com/nacos-group/nacos-sdk-go/clients"
|
||||
nacosConstant "github.com/nacos-group/nacos-sdk-go/common/constant"
|
||||
nacosVo "github.com/nacos-group/nacos-sdk-go/vo"
|
||||
|
||||
// zookeeper
|
||||
zookeeperKratos "github.com/go-kratos/kratos/contrib/registry/zookeeper/v2"
|
||||
"github.com/go-zookeeper/zk"
|
||||
|
||||
// kubernetes
|
||||
k8sRegistry "github.com/go-kratos/kratos/contrib/registry/kubernetes/v2"
|
||||
k8s "k8s.io/client-go/kubernetes"
|
||||
k8sRest "k8s.io/client-go/rest"
|
||||
k8sTools "k8s.io/client-go/tools/clientcmd"
|
||||
k8sUtil "k8s.io/client-go/util/homedir"
|
||||
|
||||
// polaris
|
||||
polarisKratos "github.com/go-kratos/kratos/contrib/registry/polaris/v2"
|
||||
polarisApi "github.com/polarismesh/polaris-go/api"
|
||||
polarisModel "github.com/polarismesh/polaris-go/pkg/model"
|
||||
|
||||
// servicecomb
|
||||
servicecombClient "github.com/go-chassis/sc-client"
|
||||
servicecombKratos "github.com/go-kratos/kratos/contrib/registry/servicecomb/v2"
|
||||
|
||||
"github.com/tx7do/kratos-bootstrap/gen/api/go/conf/v1"
|
||||
)
|
||||
|
||||
type RegistryType string
|
||||
|
||||
const (
|
||||
RegistryTypeConsul RegistryType = "consul"
|
||||
LoggerTypeEtcd RegistryType = "etcd"
|
||||
LoggerTypeZooKeeper RegistryType = "zookeeper"
|
||||
LoggerTypeNacos RegistryType = "nacos"
|
||||
LoggerTypeKubernetes RegistryType = "kubernetes"
|
||||
LoggerTypeEureka RegistryType = "eureka"
|
||||
LoggerTypePolaris RegistryType = "polaris"
|
||||
LoggerTypeServicecomb RegistryType = "servicecomb"
|
||||
)
|
||||
|
||||
// NewRegistry 创建一个注册客户端
|
||||
func NewRegistry(cfg *conf.Registry) registry.Registrar {
|
||||
if cfg == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
switch RegistryType(cfg.Type) {
|
||||
case RegistryTypeConsul:
|
||||
return NewConsulRegistry(cfg)
|
||||
case LoggerTypeEtcd:
|
||||
return NewEtcdRegistry(cfg)
|
||||
case LoggerTypeZooKeeper:
|
||||
return NewZooKeeperRegistry(cfg)
|
||||
case LoggerTypeNacos:
|
||||
return NewNacosRegistry(cfg)
|
||||
case LoggerTypeKubernetes:
|
||||
return NewKubernetesRegistry(cfg)
|
||||
case LoggerTypeEureka:
|
||||
return NewEurekaRegistry(cfg)
|
||||
case LoggerTypePolaris:
|
||||
return NewPolarisRegistry(cfg)
|
||||
case LoggerTypeServicecomb:
|
||||
return NewServicecombRegistry(cfg)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewDiscovery 创建一个发现客户端
|
||||
func NewDiscovery(cfg *conf.Registry) registry.Discovery {
|
||||
if cfg == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
switch RegistryType(cfg.Type) {
|
||||
case RegistryTypeConsul:
|
||||
return NewConsulRegistry(cfg)
|
||||
case LoggerTypeEtcd:
|
||||
return NewEtcdRegistry(cfg)
|
||||
case LoggerTypeZooKeeper:
|
||||
return NewZooKeeperRegistry(cfg)
|
||||
case LoggerTypeNacos:
|
||||
return NewNacosRegistry(cfg)
|
||||
case LoggerTypeKubernetes:
|
||||
return NewKubernetesRegistry(cfg)
|
||||
case LoggerTypeEureka:
|
||||
return NewEurekaRegistry(cfg)
|
||||
case LoggerTypePolaris:
|
||||
return NewPolarisRegistry(cfg)
|
||||
case LoggerTypeServicecomb:
|
||||
return NewServicecombRegistry(cfg)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewConsulRegistry 创建一个注册发现客户端 - Consul
|
||||
func NewConsulRegistry(c *conf.Registry) *consulKratos.Registry {
|
||||
cfg := consulClient.DefaultConfig()
|
||||
cfg.Address = c.Consul.Address
|
||||
cfg.Scheme = c.Consul.Scheme
|
||||
|
||||
var cli *consulClient.Client
|
||||
var err error
|
||||
if cli, err = consulClient.NewClient(cfg); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
reg := consulKratos.New(cli, consulKratos.WithHealthCheck(c.Consul.HealthCheck))
|
||||
|
||||
return reg
|
||||
}
|
||||
|
||||
// NewEtcdRegistry 创建一个注册发现客户端 - Etcd
|
||||
func NewEtcdRegistry(c *conf.Registry) *etcdKratos.Registry {
|
||||
cfg := etcdClient.Config{
|
||||
Endpoints: c.Etcd.Endpoints,
|
||||
}
|
||||
|
||||
var err error
|
||||
var cli *etcdClient.Client
|
||||
if cli, err = etcdClient.New(cfg); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
reg := etcdKratos.New(cli)
|
||||
|
||||
return reg
|
||||
}
|
||||
|
||||
// NewZooKeeperRegistry 创建一个注册发现客户端 - ZooKeeper
|
||||
func NewZooKeeperRegistry(c *conf.Registry) *zookeeperKratos.Registry {
|
||||
conn, _, err := zk.Connect(c.Zookeeper.Endpoints, c.Zookeeper.Timeout.AsDuration())
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
reg := zookeeperKratos.New(conn)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return reg
|
||||
}
|
||||
|
||||
// NewNacosRegistry 创建一个注册发现客户端 - Nacos
|
||||
func NewNacosRegistry(c *conf.Registry) *nacosKratos.Registry {
|
||||
srvConf := []nacosConstant.ServerConfig{
|
||||
*nacosConstant.NewServerConfig(c.Nacos.Address, c.Nacos.Port),
|
||||
}
|
||||
|
||||
cliConf := nacosConstant.ClientConfig{
|
||||
NamespaceId: c.Nacos.NamespaceId,
|
||||
TimeoutMs: uint64(c.Nacos.Timeout.AsDuration().Milliseconds()), // http请求超时时间,单位毫秒
|
||||
BeatInterval: c.Nacos.BeatInterval.AsDuration().Milliseconds(), // 心跳间隔时间,单位毫秒
|
||||
UpdateThreadNum: int(c.Nacos.UpdateThreadNum), // 更新服务的线程数
|
||||
LogLevel: c.Nacos.LogLevel,
|
||||
CacheDir: c.Nacos.CacheDir, // 缓存目录
|
||||
LogDir: c.Nacos.LogDir, // 日志目录
|
||||
NotLoadCacheAtStart: c.Nacos.NotLoadCacheAtStart, // 在启动时不读取本地缓存数据,true--不读取,false--读取
|
||||
UpdateCacheWhenEmpty: c.Nacos.UpdateCacheWhenEmpty, // 当服务列表为空时是否更新本地缓存,true--更新,false--不更新
|
||||
}
|
||||
|
||||
cli, err := nacosClients.NewNamingClient(
|
||||
nacosVo.NacosClientParam{
|
||||
ClientConfig: &cliConf,
|
||||
ServerConfigs: srvConf,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
reg := nacosKratos.New(cli)
|
||||
|
||||
return reg
|
||||
}
|
||||
|
||||
// NewKubernetesRegistry 创建一个注册发现客户端 - Kubernetes
|
||||
func NewKubernetesRegistry(_ *conf.Registry) *k8sRegistry.Registry {
|
||||
restConfig, err := k8sRest.InClusterConfig()
|
||||
if err != nil {
|
||||
home := k8sUtil.HomeDir()
|
||||
kubeConfig := filepath.Join(home, ".kube", "config")
|
||||
restConfig, err = k8sTools.BuildConfigFromFlags("", kubeConfig)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
clientSet, err := k8s.NewForConfig(restConfig)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
return nil
|
||||
}
|
||||
|
||||
reg := k8sRegistry.NewRegistry(clientSet)
|
||||
|
||||
return reg
|
||||
}
|
||||
|
||||
// NewEurekaRegistry 创建一个注册发现客户端 - Eureka
|
||||
func NewEurekaRegistry(c *conf.Registry) *eurekaKratos.Registry {
|
||||
var opts []eurekaKratos.Option
|
||||
opts = append(opts, eurekaKratos.WithHeartbeat(c.Eureka.HeartbeatInterval.AsDuration()))
|
||||
opts = append(opts, eurekaKratos.WithRefresh(c.Eureka.RefreshInterval.AsDuration()))
|
||||
opts = append(opts, eurekaKratos.WithEurekaPath(c.Eureka.Path))
|
||||
|
||||
var err error
|
||||
var reg *eurekaKratos.Registry
|
||||
if reg, err = eurekaKratos.New(c.Eureka.Endpoints, opts...); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return reg
|
||||
}
|
||||
|
||||
// NewPolarisRegistry 创建一个注册发现客户端 - Polaris
|
||||
func NewPolarisRegistry(c *conf.Registry) *polarisKratos.Registry {
|
||||
var err error
|
||||
|
||||
var consumer polarisApi.ConsumerAPI
|
||||
if consumer, err = polarisApi.NewConsumerAPI(); err != nil {
|
||||
log.Fatalf("fail to create consumerAPI, err is %v", err)
|
||||
}
|
||||
|
||||
var provider polarisApi.ProviderAPI
|
||||
provider = polarisApi.NewProviderAPIByContext(consumer.SDKContext())
|
||||
|
||||
log.Infof("start to register instances, count %d", c.Polaris.InstanceCount)
|
||||
|
||||
var resp *polarisModel.InstanceRegisterResponse
|
||||
for i := 0; i < (int)(c.Polaris.InstanceCount); i++ {
|
||||
registerRequest := &polarisApi.InstanceRegisterRequest{}
|
||||
registerRequest.Service = c.Polaris.Service
|
||||
registerRequest.Namespace = c.Polaris.Namespace
|
||||
registerRequest.Host = c.Polaris.Address
|
||||
registerRequest.Port = (int)(c.Polaris.Port) + i
|
||||
registerRequest.ServiceToken = c.Polaris.Token
|
||||
registerRequest.SetHealthy(true)
|
||||
if resp, err = provider.RegisterInstance(registerRequest); err != nil {
|
||||
log.Fatalf("fail to register instance %d, err is %v", i, err)
|
||||
} else {
|
||||
log.Infof("register instance %d response: instanceId %s", i, resp.InstanceID)
|
||||
}
|
||||
}
|
||||
|
||||
reg := polarisKratos.NewRegistry(provider, consumer)
|
||||
|
||||
return reg
|
||||
}
|
||||
|
||||
// NewServicecombRegistry 创建一个注册发现客户端 - Servicecomb
|
||||
func NewServicecombRegistry(c *conf.Registry) *servicecombKratos.Registry {
|
||||
cfg := servicecombClient.Options{
|
||||
Endpoints: c.Servicecomb.Endpoints,
|
||||
}
|
||||
|
||||
var cli *servicecombClient.Client
|
||||
var err error
|
||||
if cli, err = servicecombClient.NewClient(cfg); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
reg := servicecombKratos.NewRegistry(cli)
|
||||
|
||||
return reg
|
||||
}
|
||||
27
registry/consul/client.go
Normal file
27
registry/consul/client.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package consul
|
||||
|
||||
import (
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
consulKratos "github.com/go-kratos/kratos/contrib/registry/consul/v2"
|
||||
consulClient "github.com/hashicorp/consul/api"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewRegistry 创建一个注册发现客户端 - Consul
|
||||
func NewRegistry(c *conf.Registry) *consulKratos.Registry {
|
||||
cfg := consulClient.DefaultConfig()
|
||||
cfg.Address = c.Consul.GetAddress()
|
||||
cfg.Scheme = c.Consul.GetScheme()
|
||||
|
||||
var cli *consulClient.Client
|
||||
var err error
|
||||
if cli, err = consulClient.NewClient(cfg); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
reg := consulKratos.New(cli, consulKratos.WithHealthCheck(c.Consul.GetHealthCheck()))
|
||||
|
||||
return reg
|
||||
}
|
||||
17
registry/consul/client_test.go
Normal file
17
registry/consul/client_test.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package consul
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewConsulRegistry(t *testing.T) {
|
||||
var cfg conf.Registry
|
||||
cfg.Consul.Scheme = "http"
|
||||
cfg.Consul.Address = "localhost:8500"
|
||||
cfg.Consul.HealthCheck = false
|
||||
|
||||
reg := NewRegistry(&cfg)
|
||||
assert.Nil(t, reg)
|
||||
}
|
||||
27
registry/etcd/client.go
Normal file
27
registry/etcd/client.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package etcd
|
||||
|
||||
import (
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
etcdKratos "github.com/go-kratos/kratos/contrib/registry/etcd/v2"
|
||||
etcdClient "go.etcd.io/etcd/client/v3"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewRegistry 创建一个注册发现客户端 - Etcd
|
||||
func NewRegistry(c *conf.Registry) *etcdKratos.Registry {
|
||||
cfg := etcdClient.Config{
|
||||
Endpoints: c.Etcd.Endpoints,
|
||||
}
|
||||
|
||||
var err error
|
||||
var cli *etcdClient.Client
|
||||
if cli, err = etcdClient.New(cfg); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
reg := etcdKratos.New(cli)
|
||||
|
||||
return reg
|
||||
}
|
||||
15
registry/etcd/client_test.go
Normal file
15
registry/etcd/client_test.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package etcd
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewEtcdRegistry(t *testing.T) {
|
||||
var cfg conf.Registry
|
||||
cfg.Etcd.Endpoints = []string{"127.0.0.1:2379"}
|
||||
|
||||
reg := NewRegistry(&cfg)
|
||||
assert.Nil(t, reg)
|
||||
}
|
||||
25
registry/eureka/client.go
Normal file
25
registry/eureka/client.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package eureka
|
||||
|
||||
import (
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
eurekaKratos "github.com/go-kratos/kratos/contrib/registry/eureka/v2"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewRegistry 创建一个注册发现客户端 - Eureka
|
||||
func NewRegistry(c *conf.Registry) *eurekaKratos.Registry {
|
||||
var opts []eurekaKratos.Option
|
||||
opts = append(opts, eurekaKratos.WithHeartbeat(c.Eureka.HeartbeatInterval.AsDuration()))
|
||||
opts = append(opts, eurekaKratos.WithRefresh(c.Eureka.RefreshInterval.AsDuration()))
|
||||
opts = append(opts, eurekaKratos.WithEurekaPath(c.Eureka.Path))
|
||||
|
||||
var err error
|
||||
var reg *eurekaKratos.Registry
|
||||
if reg, err = eurekaKratos.New(c.Eureka.Endpoints, opts...); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return reg
|
||||
}
|
||||
15
registry/eureka/client_test.go
Normal file
15
registry/eureka/client_test.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package eureka
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewEurekaRegistry(t *testing.T) {
|
||||
var cfg conf.Registry
|
||||
cfg.Eureka.Endpoints = []string{"https://127.0.0.1:18761"}
|
||||
|
||||
reg := NewRegistry(&cfg)
|
||||
assert.Nil(t, reg)
|
||||
}
|
||||
129
registry/go.mod
Normal file
129
registry/go.mod
Normal file
@@ -0,0 +1,129 @@
|
||||
module github.com/tx7do/kratos-bootstrap/registry
|
||||
|
||||
go 1.23
|
||||
|
||||
toolchain go1.23.3
|
||||
|
||||
replace (
|
||||
github.com/armon/go-metrics => github.com/hashicorp/go-metrics v0.4.1
|
||||
github.com/imdario/mergo => dario.cat/mergo v0.3.16
|
||||
|
||||
github.com/tx7do/kratos-bootstrap/api => ../api
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/go-chassis/sc-client v0.7.0
|
||||
github.com/go-kratos/kratos/contrib/registry/consul/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/contrib/registry/etcd/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/contrib/registry/eureka/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/contrib/registry/kubernetes/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/contrib/registry/nacos/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/contrib/registry/polaris/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/contrib/registry/servicecomb/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/contrib/registry/zookeeper/v2 v2.0.0-20241105072421-f8b97f675b32
|
||||
github.com/go-kratos/kratos/v2 v2.8.2
|
||||
github.com/go-zookeeper/zk v1.0.4
|
||||
github.com/hashicorp/consul/api v1.30.0
|
||||
github.com/nacos-group/nacos-sdk-go v1.1.5
|
||||
github.com/polarismesh/polaris-go v1.5.8
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.5
|
||||
go.etcd.io/etcd/client/v3 v3.5.17
|
||||
k8s.io/client-go v0.31.2
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v1.61.18 // indirect
|
||||
github.com/armon/go-metrics v0.5.3 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/buger/jsonparser v1.1.1 // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/coreos/go-semver v0.3.1 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/deckarep/golang-set v1.8.0 // indirect
|
||||
github.com/dlclark/regexp2 v1.11.4 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
|
||||
github.com/fatih/color v1.18.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
|
||||
github.com/go-chassis/cari v0.9.0 // indirect
|
||||
github.com/go-chassis/foundation v0.4.0 // indirect
|
||||
github.com/go-chassis/openlog v1.1.3 // indirect
|
||||
github.com/go-errors/errors v1.0.1 // indirect
|
||||
github.com/go-logr/logr v1.4.2 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/gofrs/uuid v4.2.0+incompatible // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-hclog v1.6.3 // indirect
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
|
||||
github.com/hashicorp/golang-lru v1.0.2 // indirect
|
||||
github.com/hashicorp/serf v0.10.1 // indirect
|
||||
github.com/imdario/mergo v0.3.6 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/karlseguin/ccache/v2 v2.0.8 // indirect
|
||||
github.com/klauspost/compress v1.17.11 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/polarismesh/specification v1.5.3 // indirect
|
||||
github.com/prometheus/client_golang v1.20.5 // indirect
|
||||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/prometheus/common v0.60.1 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.17 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.17 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.27.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
|
||||
golang.org/x/net v0.31.0 // indirect
|
||||
golang.org/x/oauth2 v0.24.0 // indirect
|
||||
golang.org/x/sync v0.9.0 // indirect
|
||||
golang.org/x/sys v0.27.0 // indirect
|
||||
golang.org/x/term v0.26.0 // indirect
|
||||
golang.org/x/text v0.20.0 // indirect
|
||||
golang.org/x/time v0.8.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20241113202542-65e8d215514f // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f // indirect
|
||||
google.golang.org/grpc v1.68.0 // indirect
|
||||
google.golang.org/protobuf v1.35.1 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.42.0 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/api v0.31.2 // indirect
|
||||
k8s.io/apimachinery v0.31.2 // indirect
|
||||
k8s.io/klog/v2 v2.130.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect
|
||||
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
1271
registry/go.sum
Normal file
1271
registry/go.sum
Normal file
File diff suppressed because it is too large
Load Diff
39
registry/kubernetes/client.go
Normal file
39
registry/kubernetes/client.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package kubernetes
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
k8sRegistry "github.com/go-kratos/kratos/contrib/registry/kubernetes/v2"
|
||||
k8s "k8s.io/client-go/kubernetes"
|
||||
k8sRest "k8s.io/client-go/rest"
|
||||
k8sTools "k8s.io/client-go/tools/clientcmd"
|
||||
k8sUtil "k8s.io/client-go/util/homedir"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewRegistry 创建一个注册发现客户端 - Kubernetes
|
||||
func NewRegistry(_ *conf.Registry) *k8sRegistry.Registry {
|
||||
restConfig, err := k8sRest.InClusterConfig()
|
||||
if err != nil {
|
||||
home := k8sUtil.HomeDir()
|
||||
kubeConfig := filepath.Join(home, ".kube", "config")
|
||||
restConfig, err = k8sTools.BuildConfigFromFlags("", kubeConfig)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
clientSet, err := k8s.NewForConfig(restConfig)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
return nil
|
||||
}
|
||||
|
||||
reg := k8sRegistry.NewRegistry(clientSet)
|
||||
|
||||
return reg
|
||||
}
|
||||
13
registry/kubernetes/client_test.go
Normal file
13
registry/kubernetes/client_test.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package kubernetes
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewKubernetesRegistry(t *testing.T) {
|
||||
var cfg conf.Registry
|
||||
reg := NewRegistry(&cfg)
|
||||
assert.Nil(t, reg)
|
||||
}
|
||||
45
registry/nacos/client.go
Normal file
45
registry/nacos/client.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package nacos
|
||||
|
||||
import (
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
nacosKratos "github.com/go-kratos/kratos/contrib/registry/nacos/v2"
|
||||
nacosClients "github.com/nacos-group/nacos-sdk-go/clients"
|
||||
nacosConstant "github.com/nacos-group/nacos-sdk-go/common/constant"
|
||||
nacosVo "github.com/nacos-group/nacos-sdk-go/vo"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewRegistry 创建一个注册发现客户端 - Nacos
|
||||
func NewRegistry(c *conf.Registry) *nacosKratos.Registry {
|
||||
srvConf := []nacosConstant.ServerConfig{
|
||||
*nacosConstant.NewServerConfig(c.Nacos.Address, c.Nacos.Port),
|
||||
}
|
||||
|
||||
cliConf := nacosConstant.ClientConfig{
|
||||
NamespaceId: c.Nacos.NamespaceId,
|
||||
TimeoutMs: uint64(c.Nacos.Timeout.AsDuration().Milliseconds()), // http请求超时时间,单位毫秒
|
||||
BeatInterval: c.Nacos.BeatInterval.AsDuration().Milliseconds(), // 心跳间隔时间,单位毫秒
|
||||
UpdateThreadNum: int(c.Nacos.UpdateThreadNum), // 更新服务的线程数
|
||||
LogLevel: c.Nacos.LogLevel,
|
||||
CacheDir: c.Nacos.CacheDir, // 缓存目录
|
||||
LogDir: c.Nacos.LogDir, // 日志目录
|
||||
NotLoadCacheAtStart: c.Nacos.NotLoadCacheAtStart, // 在启动时不读取本地缓存数据,true--不读取,false--读取
|
||||
UpdateCacheWhenEmpty: c.Nacos.UpdateCacheWhenEmpty, // 当服务列表为空时是否更新本地缓存,true--更新,false--不更新
|
||||
}
|
||||
|
||||
cli, err := nacosClients.NewNamingClient(
|
||||
nacosVo.NacosClientParam{
|
||||
ClientConfig: &cliConf,
|
||||
ServerConfigs: srvConf,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
reg := nacosKratos.New(cli)
|
||||
|
||||
return reg
|
||||
}
|
||||
16
registry/nacos/client_test.go
Normal file
16
registry/nacos/client_test.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package nacos
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewNacosRegistry(t *testing.T) {
|
||||
var cfg conf.Registry
|
||||
cfg.Nacos.Address = "127.0.0.1"
|
||||
cfg.Nacos.Port = 8848
|
||||
|
||||
reg := NewRegistry(&cfg)
|
||||
assert.Nil(t, reg)
|
||||
}
|
||||
14
registry/options.go
Normal file
14
registry/options.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package registry
|
||||
|
||||
type Type string
|
||||
|
||||
const (
|
||||
Consul Type = "consul"
|
||||
Etcd Type = "etcd"
|
||||
ZooKeeper Type = "zookeeper"
|
||||
Nacos Type = "nacos"
|
||||
Kubernetes Type = "kubernetes"
|
||||
Eureka Type = "eureka"
|
||||
Polaris Type = "polaris"
|
||||
Servicecomb Type = "servicecomb"
|
||||
)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user