Skip to content

Commit 32381ef

Browse files
committed
实现基本的域名、记录管理
1 parent 7b0dbe1 commit 32381ef

15 files changed

+3422
-176
lines changed

pkg/dnsconfigs/cluster_dns_config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package dnsconfigs
22

3-
// 集群的DNS设置
3+
// ClusterDNSConfig 集群的DNS设置
44
type ClusterDNSConfig struct {
55
NodesAutoSync bool `yaml:"nodesAutoSync" json:"nodesAutoSync"` // 是否自动同步节点状态
66
ServersAutoSync bool `yaml:"serversAutoSync" json:"serversAutoSync"` // 是否自动同步服务状态

pkg/dnsconfigs/record_ttls.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright 2021 Liuxiangchao [email protected]. All rights reserved.
2+
3+
package dnsconfigs
4+
5+
type RecordTTL struct {
6+
Name string `json:"name"`
7+
Value int `json:"value"`
8+
}
9+
10+
func FindAllRecordTTL() []*RecordTTL {
11+
return []*RecordTTL{
12+
{
13+
Name: "10分钟",
14+
Value: 10 * 60,
15+
},
16+
{
17+
Name: "30分钟",
18+
Value: 30 * 60,
19+
},
20+
{
21+
Name: "1小时",
22+
Value: 3600,
23+
},
24+
{
25+
Name: "12小时",
26+
Value: 12 * 3600,
27+
},
28+
{
29+
Name: "1天",
30+
Value: 86400,
31+
},
32+
}
33+
}

pkg/dnsconfigs/record_types.go

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Copyright 2021 Liuxiangchao [email protected]. All rights reserved.
2+
3+
package dnsconfigs
4+
5+
type RecordType = string
6+
7+
const (
8+
RecordTypeA RecordType = "A"
9+
RecordTypeCNAME RecordType = "CNAME"
10+
RecordTypeAAAA RecordType = "AAAA"
11+
RecordTypeNS RecordType = "NS"
12+
RecordTypeMX RecordType = "MX"
13+
RecordTypeSRV RecordType = "SRV"
14+
RecordTypeTXT RecordType = "TXT"
15+
RecordTypeCAA RecordType = "CAA"
16+
)
17+
18+
type RecordTypeDefinition struct {
19+
Type RecordType `json:"type"`
20+
Description string `json:"description"`
21+
}
22+
23+
func FindAllRecordTypeDefinitions() []*RecordTypeDefinition {
24+
return []*RecordTypeDefinition{
25+
{
26+
Type: RecordTypeA,
27+
Description: "将域名指向一个IPV4地址",
28+
},
29+
{
30+
Type: RecordTypeCNAME,
31+
Description: "将域名指向另外一个域名",
32+
},
33+
{
34+
Type: RecordTypeAAAA,
35+
Description: "将域名指向一个IPV6地址",
36+
},
37+
{
38+
Type: RecordTypeNS,
39+
Description: "将子域名指定其他DNS服务器解析",
40+
},
41+
{
42+
Type: RecordTypeMX,
43+
Description: "将域名指向邮件服务器地址",
44+
},
45+
{
46+
Type: RecordTypeSRV,
47+
Description: "记录提供特定的服务的服务器",
48+
},
49+
{
50+
Type: RecordTypeTXT,
51+
Description: "文本长度限制512,通常做SPF记录(反垃圾邮件)",
52+
},
53+
{
54+
Type: RecordTypeCAA,
55+
Description: "CA证书颁发机构授权校验",
56+
},
57+
}
58+
}

pkg/rpc/pb/model_ns_domain.pb.go

Lines changed: 206 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)