feat: support tls config.

This commit is contained in:
tx7do
2024-11-13 11:27:13 +08:00
parent e755b6cfc8
commit 9e051505a1
19 changed files with 1749 additions and 700 deletions

View File

@@ -5,22 +5,26 @@ 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;
Middleware middleware = 2; // 中间件
TLS tls = 3; // TLS配置
}
// gPRC
message GRPC {
google.protobuf.Duration timeout = 1; // 超时时间
Middleware middleware = 2;
Middleware middleware = 2; // 中间件
TLS tls = 3; // TLS配置
}
REST rest = 1; // REST服务
GRPC grpc = 2; // gRPC服务
optional REST rest = 1; // REST服务
optional GRPC grpc = 2; // gRPC服务
}

View File

@@ -11,43 +11,43 @@ message RemoteConfig {
message Nacos {
string address = 1; // 服务端地址
uint64 port = 2; // 服务端端口
string key = 3; //
string key = 3; // 配置键
}
message Etcd {
repeated string endpoints = 1;
google.protobuf.Duration timeout = 2;
string key = 3; //
repeated string endpoints = 1; // 服务端地址
google.protobuf.Duration timeout = 2; // 超时时间
string key = 3; // 配置键
}
message Consul {
string scheme = 1; // 网络样式
string address = 2; // 服务端地址
string key = 3; //
string key = 3; // 配置键
}
message Apollo {
string endpoint = 1;
string app_id = 2;
string cluster = 3;
string namespace = 4;
string secret = 5;
string endpoint = 1; // 服务端地址
string app_id = 2; // 应用ID
string cluster = 3; // 集群
string namespace = 4; // 命名空间
string secret = 5; // 密钥
}
message Kubernetes {
string namespace = 1;
string namespace = 1; // 命名空间
}
message Polaris {
}
string type = 1;
string type = 1; // 配置类型
Etcd etcd = 2;
Consul consul = 3;
Nacos nacos = 4;
Apollo apollo = 6;
Kubernetes kubernetes = 7;
Polaris polaris = 8;
optional Etcd etcd = 2;
optional Consul consul = 3;
optional Nacos nacos = 4;
optional Apollo apollo = 6;
optional Kubernetes kubernetes = 7;
optional Polaris polaris = 8;
}

View File

@@ -169,25 +169,25 @@ message Data {
string group_name = 11;
}
Database database = 1; // 数据库DSN
optional Database database = 1; // 数据库DSN
Redis redis = 10; // Redis
MongoDB mongodb = 11; // MongoDB数据库
ElasticSearch elastic_search = 12; // ElasticSearch数据库
Cassandra cassandra = 13; // Cassandra数据库
optional Redis redis = 10; // Redis
optional MongoDB mongodb = 11; // MongoDB数据库
optional ElasticSearch elastic_search = 12; // ElasticSearch数据库
optional Cassandra cassandra = 13; // Cassandra数据库
ClickHouse clickhouse = 20; // ClickHouse数据库
InfluxDB influxdb = 21; // InfluxDB数据库
Doris doris = 22; // Doris数据库
optional ClickHouse clickhouse = 20; // ClickHouse数据库
optional InfluxDB influxdb = 21; // InfluxDB数据库
optional Doris doris = 22; // Doris数据库
// Message Queue
Kafka kafka = 30; // Kafka服务
RabbitMQ rabbitmq = 31; // RabbitMQ服务
Mqtt mqtt = 32; // MQTT服务
ActiveMQ activemq = 33; // ActiveMQ
NATS nats = 34; // NATS
NSQ nsq = 35; // NATS
Pulsar pulsar = 36; // Pulsar
RocketMQ rocketmq = 38; // RocketMQ
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
}

View File

@@ -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;
}

View File

@@ -4,6 +4,8 @@ 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 {
@@ -11,9 +13,12 @@ message OSS {
string access_key = 2; // 访问密钥
string secret_key = 3; // 密钥
string token = 4; // 令牌
bool use_ssl = 5; // 使用SSL
string upload_host = 6; // 上传链接的主机名
string download_host = 7; // 下载链接的主机名
bool use_ssl = 10; // 使用SSL
TLS tls = 11; // TLS配置
string upload_host = 20; // 上传链接的主机名
string download_host = 21; // 下载链接的主机名
}
MinIO minio = 1;

View File

@@ -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: 不更新
}

View File

@@ -5,7 +5,9 @@ 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 {
@@ -20,18 +22,25 @@ message Server {
string network = 1; // 网络
string addr = 2; // 服务监听地址
google.protobuf.Duration timeout = 3; // 超时时间
CORS cors = 4; // 服务监听地址
Middleware middleware = 5; // 中间件
bool enable_swagger = 6; // 启用SwaggerUI
bool enable_pprof = 7; // 启用pprof
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
@@ -41,54 +50,64 @@ message Server {
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;
@@ -101,6 +120,8 @@ message Server {
string namespace = 9;
string instance_name = 10;
string group_name = 11;
TLS tls = 12; // TLS配置
}
// Asynq
@@ -109,12 +130,14 @@ message Server {
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
@@ -123,14 +146,15 @@ message Server {
string addr = 2; // 服务监听地址
string path = 3; // 路径
string codec = 4; // 编解码器
TLS tls = 5; // TLS配置
google.protobuf.Duration timeout = 5; // 超时时间
google.protobuf.Duration event_ttl = 6; // 超时时间
google.protobuf.Duration timeout = 10; // 超时时间
google.protobuf.Duration event_ttl = 11; //
bool auto_stream = 7; //
bool auto_reply = 8; //
bool split_data = 9; //
bool encode_base64 = 10; // 进行BASE64编码
bool auto_stream = 20; //
bool auto_reply = 21; //
bool split_data = 22; //
bool encode_base64 = 23; // 进行BASE64编码
}
// SocketIO
@@ -139,6 +163,7 @@ message Server {
string addr = 2; // 服务监听地址
string path = 3; // 路径
string codec = 4; // 编解码器
TLS tls = 5; // TLS配置
}
// SignalR
@@ -146,9 +171,11 @@ message Server {
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; // 超时时间
google.protobuf.Duration keep_alive_interval = 4; // 超时时间
google.protobuf.Duration chan_receive_timeout = 5; // 超时时间
bool debug = 6; // 调试开关
uint32 stream_buffer_capacity = 7; //
}
@@ -161,6 +188,7 @@ message Server {
string codec = 4; // 编解码器
google.protobuf.Duration timeout = 5; // 超时时间
bool strict_slash = 6;
TLS tls = 7; // TLS配置
}
// Thrift
@@ -171,36 +199,37 @@ message Server {
bool buffered = 4;
bool framed = 5;
bool buffer_size = 6;
TLS tls = 7; // TLS配置
}
// RPC
REST rest = 1; // REST服务
GRPC grpc = 2; // gRPC服务
GraphQL graphql = 3; // GraphQL服务
Thrift thrift = 4; // Thrift服务
optional REST rest = 1; // REST服务
optional GRPC grpc = 2; // gRPC服务
optional GraphQL graphql = 3; // GraphQL服务
optional Thrift thrift = 4; // Thrift服务
// Message Queue
Mqtt mqtt = 10; // MQTT服务
Kafka kafka = 11; // Kafka服务
RabbitMQ rabbitmq = 12; // RabbitMQ服务
ActiveMQ activemq = 13; // ActiveMQ
NATS nats = 14; // NATS
NSQ nsq = 15; // NATS
Pulsar pulsar = 16; // Pulsar
Redis redis = 17; // Redis
RocketMQ rocketmq = 18; // RocketMQ
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
// RealTime
Websocket websocket = 20; // Websocket服务
SSE sse = 21; // SSE服务
SocketIO socketio = 22; // SocketIO服务
SignalR signalr = 23; // SignalR服务
optional Websocket websocket = 20; // Websocket服务
optional SSE sse = 21; // SSE服务
optional SocketIO socketio = 22; // SocketIO服务
optional SignalR signalr = 23; // SignalR服务
// Task Queue
Asynq asynq = 30; // Asynq服务
Machinery machinery = 31; // Machinery服务
optional Asynq asynq = 30; // Asynq服务
optional Machinery machinery = 31; // Machinery服务
}

View 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;
}