智能DNS实现DoH功能

This commit is contained in:
GoEdgeLab
2023-06-11 17:57:41 +08:00
parent 2a8e703e70
commit ae8682dd2d
5 changed files with 736 additions and 377 deletions

View File

@@ -7654,6 +7654,24 @@
],
"isDeprecated": false
},
{
"name": "findNSClusterDoHConfig",
"requestMessageName": "FindNSClusterDoHConfigRequest",
"responseMessageName": "FindNSClusterDoHConfigResponse",
"code": "rpc findNSClusterDoHConfig(FindNSClusterDoHConfigRequest) returns (FindNSClusterDoHConfigResponse);",
"doc": "查找集群的DoH设置",
"roles": [],
"isDeprecated": false
},
{
"name": "updateNSClusterDoH",
"requestMessageName": "UpdateNSClusterDoHRequest",
"responseMessageName": "RPCSuccess",
"code": "rpc updateNSClusterDoH (UpdateNSClusterDoHRequest) returns (RPCSuccess);",
"doc": "修改集群的DoH设置",
"roles": [],
"isDeprecated": false
},
{
"name": "countAllNSClustersWithSSLCertId",
"requestMessageName": "CountAllNSClustersWithSSLCertIdRequest",
@@ -18734,6 +18752,16 @@
"code": "message FindNSClusterDDoSProtectionResponse {\n\tbytes ddosProtectionJSON = 1;\n}",
"doc": ""
},
{
"name": "FindNSClusterDoHConfigRequest",
"code": "message FindNSClusterDoHConfigRequest {\n\tint64 nsClusterId = 1;\n}",
"doc": "查找集群的DoH设置"
},
{
"name": "FindNSClusterDoHConfigResponse",
"code": "message FindNSClusterDoHConfigResponse {\n\tbytes dohJSON = 1;\n}",
"doc": ""
},
{
"name": "FindNSClusterHostsRequest",
"code": "message FindNSClusterHostsRequest {\n\tint64 nsClusterId = 1;\n}",
@@ -20686,7 +20714,7 @@
},
{
"name": "NSCluster",
"code": "message NSCluster {\n\tint64 id = 1;\n\tbool isOn = 2;\n\tstring name = 3;\n\tstring installDir = 4;\n\tbytes tcpJSON = 5;\n\tbytes tlsJSON = 6;\n\tbytes udpJSON = 7;\n\trepeated string hosts = 8;\n\tbytes soaJSON = 12;\n\tstring email = 13;\n\tbool autoRemoteStart = 9;\n\tstring timeZone = 10;\n\tbytes answerJSON = 11;\n\tbool detectAgents = 14;\n\tbool checkingPorts = 15; // 检查端口连通性\n}",
"code": "message NSCluster {\n\tint64 id = 1;\n\tbool isOn = 2;\n\tstring name = 3;\n\tstring installDir = 4;\n\tbytes tcpJSON = 5; // TCP设置\n\tbytes tlsJSON = 6; // TLS设置\n\tbytes udpJSON = 7; // UDP设置\n\tbytes dohJSON = 16; // DoH设置\n\trepeated string hosts = 8;\n\tbytes soaJSON = 12;\n\tstring email = 13;\n\tbool autoRemoteStart = 9;\n\tstring timeZone = 10;\n\tbytes answerJSON = 11;\n\tbool detectAgents = 14;\n\tbool checkingPorts = 15; // 检查端口连通性\n}",
"doc": "域名服务集群"
},
{
@@ -21879,6 +21907,11 @@
"code": "message UpdateNSClusterDDoSProtectionRequest {\n\tint64 nsClusterId = 1;\n\tbytes ddosProtectionJSON = 2;\n}",
"doc": "修改集群的DDoS设置"
},
{
"name": "UpdateNSClusterDoHRequest",
"code": "message UpdateNSClusterDoHRequest {\n\tint64 nsClusterId = 1;\n\tbytes dohJSON = 2;\n}",
"doc": "修改集群的DoH设置"
},
{
"name": "UpdateNSClusterRecursionConfigRequest",
"code": "message UpdateNSClusterRecursionConfigRequest {\n\tint64 nsClusterId = 1;\n\tbytes recursionJSON = 2;\n}",

View File

@@ -35,9 +35,10 @@ type NSCluster struct {
IsOn bool `protobuf:"varint,2,opt,name=isOn,proto3" json:"isOn,omitempty"`
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
InstallDir string `protobuf:"bytes,4,opt,name=installDir,proto3" json:"installDir,omitempty"`
TcpJSON []byte `protobuf:"bytes,5,opt,name=tcpJSON,proto3" json:"tcpJSON,omitempty"`
TlsJSON []byte `protobuf:"bytes,6,opt,name=tlsJSON,proto3" json:"tlsJSON,omitempty"`
UdpJSON []byte `protobuf:"bytes,7,opt,name=udpJSON,proto3" json:"udpJSON,omitempty"`
TcpJSON []byte `protobuf:"bytes,5,opt,name=tcpJSON,proto3" json:"tcpJSON,omitempty"` // TCP设置
TlsJSON []byte `protobuf:"bytes,6,opt,name=tlsJSON,proto3" json:"tlsJSON,omitempty"` // TLS设置
UdpJSON []byte `protobuf:"bytes,7,opt,name=udpJSON,proto3" json:"udpJSON,omitempty"` // UDP设置
DohJSON []byte `protobuf:"bytes,16,opt,name=dohJSON,proto3" json:"dohJSON,omitempty"` // DoH设置
Hosts []string `protobuf:"bytes,8,rep,name=hosts,proto3" json:"hosts,omitempty"`
SoaJSON []byte `protobuf:"bytes,12,opt,name=soaJSON,proto3" json:"soaJSON,omitempty"`
Email string `protobuf:"bytes,13,opt,name=email,proto3" json:"email,omitempty"`
@@ -129,6 +130,13 @@ func (x *NSCluster) GetUdpJSON() []byte {
return nil
}
func (x *NSCluster) GetDohJSON() []byte {
if x != nil {
return x.DohJSON
}
return nil
}
func (x *NSCluster) GetHosts() []string {
if x != nil {
return x.Hosts
@@ -190,7 +198,7 @@ var File_models_model_ns_cluster_proto protoreflect.FileDescriptor
var file_models_model_ns_cluster_proto_rawDesc = []byte{
0x0a, 0x1d, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
0x73, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x02, 0x70, 0x62, 0x22, 0xa7, 0x03, 0x0a, 0x09, 0x4e, 0x53, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65,
0x02, 0x70, 0x62, 0x22, 0xc1, 0x03, 0x0a, 0x09, 0x4e, 0x53, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65,
0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69,
0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52,
0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20,
@@ -201,23 +209,25 @@ var file_models_model_ns_cluster_proto_rawDesc = []byte{
0x53, 0x4f, 0x4e, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x6c, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x06,
0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x74, 0x6c, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x18, 0x0a,
0x07, 0x75, 0x64, 0x70, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07,
0x75, 0x64, 0x70, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x14, 0x0a, 0x05, 0x68, 0x6f, 0x73, 0x74, 0x73,
0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x18, 0x0a,
0x07, 0x73, 0x6f, 0x61, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07,
0x73, 0x6f, 0x61, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c,
0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x28, 0x0a,
0x0f, 0x61, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74,
0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x61, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x6d, 0x6f,
0x74, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x5a,
0x6f, 0x6e, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x5a,
0x6f, 0x6e, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x4a, 0x53, 0x4f,
0x4e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x4a,
0x53, 0x4f, 0x4e, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x41, 0x67, 0x65,
0x6e, 0x74, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x64, 0x65, 0x74, 0x65, 0x63,
0x74, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x68, 0x65, 0x63, 0x6b,
0x69, 0x6e, 0x67, 0x50, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d,
0x63, 0x68, 0x65, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x72, 0x74, 0x73, 0x42, 0x06, 0x5a,
0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x75, 0x64, 0x70, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x68, 0x4a, 0x53,
0x4f, 0x4e, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x64, 0x6f, 0x68, 0x4a, 0x53, 0x4f,
0x4e, 0x12, 0x14, 0x0a, 0x05, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09,
0x52, 0x05, 0x68, 0x6f, 0x73, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6f, 0x61, 0x4a, 0x53,
0x4f, 0x4e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x6f, 0x61, 0x4a, 0x53, 0x4f,
0x4e, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09,
0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x28, 0x0a, 0x0f, 0x61, 0x75, 0x74, 0x6f, 0x52,
0x65, 0x6d, 0x6f, 0x74, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08,
0x52, 0x0f, 0x61, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x53, 0x74, 0x61, 0x72,
0x74, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x5a, 0x6f, 0x6e, 0x65, 0x18, 0x0a, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x5a, 0x6f, 0x6e, 0x65, 0x12, 0x1e, 0x0a,
0x0a, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0b, 0x20, 0x01, 0x28,
0x0c, 0x52, 0x0a, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x22, 0x0a,
0x0c, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x0e, 0x20,
0x01, 0x28, 0x08, 0x52, 0x0c, 0x64, 0x65, 0x74, 0x65, 0x63, 0x74, 0x41, 0x67, 0x65, 0x6e, 0x74,
0x73, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x50, 0x6f, 0x72,
0x74, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x69,
0x6e, 0x67, 0x50, 0x6f, 0x72, 0x74, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

File diff suppressed because it is too large Load Diff

View File

@@ -9,9 +9,10 @@ message NSCluster {
bool isOn = 2;
string name = 3;
string installDir = 4;
bytes tcpJSON = 5;
bytes tlsJSON = 6;
bytes udpJSON = 7;
bytes tcpJSON = 5; // TCP设置
bytes tlsJSON = 6; // TLS设置
bytes udpJSON = 7; // UDP设置
bytes dohJSON = 16; // DoH设置
repeated string hosts = 8;
bytes soaJSON = 12;
string email = 13;

View File

@@ -59,6 +59,12 @@ service NSClusterService {
// 修改集群的UDP设置
rpc updateNSClusterUDP (UpdateNSClusterUDPRequest) returns (RPCSuccess);
// 查找集群的DoH设置
rpc findNSClusterDoHConfig(FindNSClusterDoHConfigRequest) returns (FindNSClusterDoHConfigResponse);
// 修改集群的DoH设置
rpc updateNSClusterDoH (UpdateNSClusterDoHRequest) returns (RPCSuccess);
// 计算使用某个SSL证书的集群数量
rpc countAllNSClustersWithSSLCertId (CountAllNSClustersWithSSLCertIdRequest) returns (RPCCountResponse);
@@ -207,6 +213,15 @@ message FindNSClusterUDPConfigResponse {
bytes udpJSON = 1;
}
// 查找集群的DoH设置
message FindNSClusterDoHConfigRequest {
int64 nsClusterId = 1;
}
message FindNSClusterDoHConfigResponse {
bytes dohJSON = 1;
}
// 修改集群的TCP设置
message UpdateNSClusterTCPRequest {
int64 nsClusterId = 1;
@@ -225,6 +240,12 @@ message UpdateNSClusterUDPRequest {
bytes udpJSON = 2;
}
// 修改集群的DoH设置
message UpdateNSClusterDoHRequest {
int64 nsClusterId = 1;
bytes dohJSON = 2;
}
// 计算使用某个SSL证书的集群数量
message CountAllNSClustersWithSSLCertIdRequest {
int64 sslCertId = 1;