mirror of
				https://github.com/TeaOSLab/EdgeCommon.git
				synced 2025-11-04 05:00:24 +08:00 
			
		
		
		
	优化智能DNS相关接口
This commit is contained in:
		
							
								
								
									
										7441
									
								
								build/rpc.json
									
									
									
									
									
								
							
							
						
						
									
										7441
									
								
								build/rpc.json
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -13,11 +13,13 @@ const (
 | 
				
			|||||||
	RecordTypeSRV   RecordType = "SRV"
 | 
						RecordTypeSRV   RecordType = "SRV"
 | 
				
			||||||
	RecordTypeTXT   RecordType = "TXT"
 | 
						RecordTypeTXT   RecordType = "TXT"
 | 
				
			||||||
	RecordTypeCAA   RecordType = "CAA"
 | 
						RecordTypeCAA   RecordType = "CAA"
 | 
				
			||||||
 | 
						RecordTypeSOA   RecordType = "SOA"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type RecordTypeDefinition struct {
 | 
					type RecordTypeDefinition struct {
 | 
				
			||||||
	Type        RecordType `json:"type"`
 | 
						Type        RecordType `json:"type"`
 | 
				
			||||||
	Description string     `json:"description"`
 | 
						Description string     `json:"description"`
 | 
				
			||||||
 | 
						CanDefine   bool       `json:"canDefine"` // 用户是否可以自定义
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func FindAllRecordTypeDefinitions() []*RecordTypeDefinition {
 | 
					func FindAllRecordTypeDefinitions() []*RecordTypeDefinition {
 | 
				
			||||||
@@ -25,34 +27,57 @@ func FindAllRecordTypeDefinitions() []*RecordTypeDefinition {
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			Type:        RecordTypeA,
 | 
								Type:        RecordTypeA,
 | 
				
			||||||
			Description: "将域名指向一个IPV4地址",
 | 
								Description: "将域名指向一个IPV4地址",
 | 
				
			||||||
 | 
								CanDefine:   true,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Type:        RecordTypeCNAME,
 | 
								Type:        RecordTypeCNAME,
 | 
				
			||||||
			Description: "将域名指向另外一个域名",
 | 
								Description: "将域名指向另外一个域名",
 | 
				
			||||||
 | 
								CanDefine:   true,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Type:        RecordTypeAAAA,
 | 
								Type:        RecordTypeAAAA,
 | 
				
			||||||
			Description: "将域名指向一个IPV6地址",
 | 
								Description: "将域名指向一个IPV6地址",
 | 
				
			||||||
 | 
								CanDefine:   true,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Type:        RecordTypeNS,
 | 
								Type:        RecordTypeNS,
 | 
				
			||||||
			Description: "将子域名指定其他DNS服务器解析",
 | 
								Description: "将子域名指定其他DNS服务器解析",
 | 
				
			||||||
 | 
								CanDefine:   false,
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Type:        RecordTypeSOA,
 | 
				
			||||||
 | 
								Description: "起始授权机构记录",
 | 
				
			||||||
 | 
								CanDefine:   false,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Type:        RecordTypeMX,
 | 
								Type:        RecordTypeMX,
 | 
				
			||||||
			Description: "将域名指向邮件服务器地址",
 | 
								Description: "将域名指向邮件服务器地址",
 | 
				
			||||||
 | 
								CanDefine:   true,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Type:        RecordTypeSRV,
 | 
								Type:        RecordTypeSRV,
 | 
				
			||||||
			Description: "记录提供特定的服务的服务器",
 | 
								Description: "记录提供特定的服务的服务器",
 | 
				
			||||||
 | 
								CanDefine:   true,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Type:        RecordTypeTXT,
 | 
								Type:        RecordTypeTXT,
 | 
				
			||||||
			Description: "文本长度限制512,通常做SPF记录或者校验域名所有者",
 | 
								Description: "文本长度限制512,通常做SPF记录或者校验域名所有者",
 | 
				
			||||||
 | 
								CanDefine:   true,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Type:        RecordTypeCAA,
 | 
								Type:        RecordTypeCAA,
 | 
				
			||||||
			Description: "CA证书颁发机构授权校验",
 | 
								Description: "CA证书颁发机构授权校验",
 | 
				
			||||||
 | 
								CanDefine:   true,
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func FindAllUserRecordTypeDefinitions() []*RecordTypeDefinition {
 | 
				
			||||||
 | 
						var result = []*RecordTypeDefinition{}
 | 
				
			||||||
 | 
						for _, r := range FindAllRecordTypeDefinitions() {
 | 
				
			||||||
 | 
							if r.CanDefine {
 | 
				
			||||||
 | 
								result = append(result, r)
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return result
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,6 +39,8 @@ type NSCluster struct {
 | 
				
			|||||||
	TlsJSON         []byte   `protobuf:"bytes,6,opt,name=tlsJSON,proto3" json:"tlsJSON,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"`
 | 
						UdpJSON         []byte   `protobuf:"bytes,7,opt,name=udpJSON,proto3" json:"udpJSON,omitempty"`
 | 
				
			||||||
	Hosts           []string `protobuf:"bytes,8,rep,name=hosts,proto3" json:"hosts,omitempty"`
 | 
						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"`
 | 
				
			||||||
	AutoRemoteStart bool     `protobuf:"varint,9,opt,name=autoRemoteStart,proto3" json:"autoRemoteStart,omitempty"`
 | 
						AutoRemoteStart bool     `protobuf:"varint,9,opt,name=autoRemoteStart,proto3" json:"autoRemoteStart,omitempty"`
 | 
				
			||||||
	TimeZone        string   `protobuf:"bytes,10,opt,name=timeZone,proto3" json:"timeZone,omitempty"`
 | 
						TimeZone        string   `protobuf:"bytes,10,opt,name=timeZone,proto3" json:"timeZone,omitempty"`
 | 
				
			||||||
	AnswerJSON      []byte   `protobuf:"bytes,11,opt,name=answerJSON,proto3" json:"answerJSON,omitempty"`
 | 
						AnswerJSON      []byte   `protobuf:"bytes,11,opt,name=answerJSON,proto3" json:"answerJSON,omitempty"`
 | 
				
			||||||
@@ -132,6 +134,20 @@ func (x *NSCluster) GetHosts() []string {
 | 
				
			|||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (x *NSCluster) GetSoaJSON() []byte {
 | 
				
			||||||
 | 
						if x != nil {
 | 
				
			||||||
 | 
							return x.SoaJSON
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (x *NSCluster) GetEmail() string {
 | 
				
			||||||
 | 
						if x != nil {
 | 
				
			||||||
 | 
							return x.Email
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return ""
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (x *NSCluster) GetAutoRemoteStart() bool {
 | 
					func (x *NSCluster) GetAutoRemoteStart() bool {
 | 
				
			||||||
	if x != nil {
 | 
						if x != nil {
 | 
				
			||||||
		return x.AutoRemoteStart
 | 
							return x.AutoRemoteStart
 | 
				
			||||||
@@ -158,7 +174,7 @@ var File_models_model_ns_cluster_proto protoreflect.FileDescriptor
 | 
				
			|||||||
var file_models_model_ns_cluster_proto_rawDesc = []byte{
 | 
					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,
 | 
						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,
 | 
						0x73, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
 | 
				
			||||||
	0x02, 0x70, 0x62, 0x22, 0xad, 0x02, 0x0a, 0x09, 0x4e, 0x53, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65,
 | 
						0x02, 0x70, 0x62, 0x22, 0xdd, 0x02, 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,
 | 
						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,
 | 
						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,
 | 
						0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20,
 | 
				
			||||||
@@ -170,7 +186,10 @@ var file_models_model_ns_cluster_proto_rawDesc = []byte{
 | 
				
			|||||||
	0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x74, 0x6c, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x18, 0x0a,
 | 
						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,
 | 
						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,
 | 
						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, 0x28, 0x0a,
 | 
						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,
 | 
						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,
 | 
						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,
 | 
						0x74, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x5a,
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -13,6 +13,8 @@ message NSCluster {
 | 
				
			|||||||
	bytes tlsJSON = 6;
 | 
						bytes tlsJSON = 6;
 | 
				
			||||||
	bytes udpJSON = 7;
 | 
						bytes udpJSON = 7;
 | 
				
			||||||
	repeated string hosts = 8;
 | 
						repeated string hosts = 8;
 | 
				
			||||||
 | 
						bytes soaJSON = 12;
 | 
				
			||||||
 | 
						string email = 13;
 | 
				
			||||||
	bool autoRemoteStart = 9;
 | 
						bool autoRemoteStart = 9;
 | 
				
			||||||
	string timeZone = 10;
 | 
						string timeZone = 10;
 | 
				
			||||||
	bytes answerJSON = 11;
 | 
						bytes answerJSON = 11;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -79,6 +79,12 @@ service NSClusterService {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// 设置应答模式
 | 
						// 设置应答模式
 | 
				
			||||||
	rpc updateNSClusterAnswerConfig(UpdateNSClusterAnswerConfigRequest) returns (RPCSuccess);
 | 
						rpc updateNSClusterAnswerConfig(UpdateNSClusterAnswerConfigRequest) returns (RPCSuccess);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// 查找SOA配置
 | 
				
			||||||
 | 
						rpc findNSClusterSOAConfig(FindNSClusterSOAConfigRequest) returns (FindNSClusterSOAConfigResponse);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// 设置SOA配置
 | 
				
			||||||
 | 
						rpc updateNSClusterSOAConfig(UpdateNSClusterSOAConfigRequest) returns (RPCSuccess);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 创建集群
 | 
					// 创建集群
 | 
				
			||||||
@@ -86,6 +92,8 @@ message CreateNSClusterRequest {
 | 
				
			|||||||
	string name = 1;
 | 
						string name = 1;
 | 
				
			||||||
	bytes accessLogJSON = 2;
 | 
						bytes accessLogJSON = 2;
 | 
				
			||||||
	repeated string hosts = 3;
 | 
						repeated string hosts = 3;
 | 
				
			||||||
 | 
						bytes soaJSON = 4;
 | 
				
			||||||
 | 
						string email = 5;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
message CreateNSClusterResponse {
 | 
					message CreateNSClusterResponse {
 | 
				
			||||||
@@ -98,6 +106,7 @@ message UpdateNSClusterRequest {
 | 
				
			|||||||
	string name = 2;
 | 
						string name = 2;
 | 
				
			||||||
	bool isOn = 3;
 | 
						bool isOn = 3;
 | 
				
			||||||
	repeated string hosts = 4;
 | 
						repeated string hosts = 4;
 | 
				
			||||||
 | 
						string email = 8;
 | 
				
			||||||
	bool autoRemoteStart = 5;
 | 
						bool autoRemoteStart = 5;
 | 
				
			||||||
	string timeZone = 6;
 | 
						string timeZone = 6;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -265,4 +274,19 @@ message FindNSClusterAnswerConfigResponse {
 | 
				
			|||||||
message UpdateNSClusterAnswerConfigRequest {
 | 
					message UpdateNSClusterAnswerConfigRequest {
 | 
				
			||||||
	int64 nsClusterId = 1;
 | 
						int64 nsClusterId = 1;
 | 
				
			||||||
	bytes answerJSON = 2;
 | 
						bytes answerJSON = 2;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// 查找SOA配置
 | 
				
			||||||
 | 
					message FindNSClusterSOAConfigRequest {
 | 
				
			||||||
 | 
						int64 nsClusterId = 1;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					message FindNSClusterSOAConfigResponse {
 | 
				
			||||||
 | 
						bytes soaJSON = 1;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// 设置SOA配置
 | 
				
			||||||
 | 
					message UpdateNSClusterSOAConfigRequest {
 | 
				
			||||||
 | 
						int64 nsClusterId = 1;
 | 
				
			||||||
 | 
						bytes soaJSON = 2;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user