实现基本的域名、记录管理

This commit is contained in:
GoEdgeLab
2021-05-27 17:08:57 +08:00
parent e9162bddd8
commit 25ffc98eec
15 changed files with 3423 additions and 177 deletions

View File

@@ -1,6 +1,6 @@
package dnsconfigs
// 集群的DNS设置
// ClusterDNSConfig 集群的DNS设置
type ClusterDNSConfig struct {
NodesAutoSync bool `yaml:"nodesAutoSync" json:"nodesAutoSync"` // 是否自动同步节点状态
ServersAutoSync bool `yaml:"serversAutoSync" json:"serversAutoSync"` // 是否自动同步服务状态

View File

@@ -0,0 +1,33 @@
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package dnsconfigs
type RecordTTL struct {
Name string `json:"name"`
Value int `json:"value"`
}
func FindAllRecordTTL() []*RecordTTL {
return []*RecordTTL{
{
Name: "10分钟",
Value: 10 * 60,
},
{
Name: "30分钟",
Value: 30 * 60,
},
{
Name: "1小时",
Value: 3600,
},
{
Name: "12小时",
Value: 12 * 3600,
},
{
Name: "1天",
Value: 86400,
},
}
}

View File

@@ -0,0 +1,58 @@
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package dnsconfigs
type RecordType = string
const (
RecordTypeA RecordType = "A"
RecordTypeCNAME RecordType = "CNAME"
RecordTypeAAAA RecordType = "AAAA"
RecordTypeNS RecordType = "NS"
RecordTypeMX RecordType = "MX"
RecordTypeSRV RecordType = "SRV"
RecordTypeTXT RecordType = "TXT"
RecordTypeCAA RecordType = "CAA"
)
type RecordTypeDefinition struct {
Type RecordType `json:"type"`
Description string `json:"description"`
}
func FindAllRecordTypeDefinitions() []*RecordTypeDefinition {
return []*RecordTypeDefinition{
{
Type: RecordTypeA,
Description: "将域名指向一个IPV4地址",
},
{
Type: RecordTypeCNAME,
Description: "将域名指向另外一个域名",
},
{
Type: RecordTypeAAAA,
Description: "将域名指向一个IPV6地址",
},
{
Type: RecordTypeNS,
Description: "将子域名指定其他DNS服务器解析",
},
{
Type: RecordTypeMX,
Description: "将域名指向邮件服务器地址",
},
{
Type: RecordTypeSRV,
Description: "记录提供特定的服务的服务器",
},
{
Type: RecordTypeTXT,
Description: "文本长度限制512通常做SPF记录反垃圾邮件",
},
{
Type: RecordTypeCAA,
Description: "CA证书颁发机构授权校验",
},
}
}