mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-03 12:20:27 +08:00
实现基本的域名、记录管理
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package dnsconfigs
|
||||
|
||||
// 集群的DNS设置
|
||||
// ClusterDNSConfig 集群的DNS设置
|
||||
type ClusterDNSConfig struct {
|
||||
NodesAutoSync bool `yaml:"nodesAutoSync" json:"nodesAutoSync"` // 是否自动同步节点状态
|
||||
ServersAutoSync bool `yaml:"serversAutoSync" json:"serversAutoSync"` // 是否自动同步服务状态
|
||||
|
||||
33
pkg/dnsconfigs/record_ttls.go
Normal file
33
pkg/dnsconfigs/record_ttls.go
Normal 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,
|
||||
},
|
||||
}
|
||||
}
|
||||
58
pkg/dnsconfigs/record_types.go
Normal file
58
pkg/dnsconfigs/record_types.go
Normal 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证书颁发机构授权校验",
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user