实现基本的集群DNS列表、设置、简单数据同步

This commit is contained in:
刘祥超
2020-11-13 18:22:22 +08:00
parent eb8e281615
commit b46960e45a
51 changed files with 1074 additions and 391 deletions

View File

@@ -0,0 +1,47 @@
package dnsclients
import "github.com/iwind/TeaGo/maps"
type ProviderType = string
// 服务商代号
const (
ProviderTypeDNSPod ProviderType = "dnspod"
ProviderTypeAliyun ProviderType = "aliyun"
ProviderTypeDNSCom ProviderType = "dnscom"
)
// 所有的服务商类型
var AllProviderTypes = []maps.Map{
{
"name": "DNSPod",
"code": ProviderTypeDNSPod,
},
{
"name": "阿里云",
"code": ProviderTypeAliyun,
},
{
"name": "帝恩思",
"code": ProviderTypeDNSCom,
},
}
// 查找服务商实例
func FindProvider(providerType ProviderType) ProviderInterface {
switch providerType {
case ProviderTypeDNSPod:
return &DNSPodProvider{}
}
return nil
}
// 查找服务商名称
func FindProviderTypeName(providerType ProviderType) string {
for _, t := range AllProviderTypes {
if t.GetString("code") == providerType {
return t.GetString("name")
}
}
return ""
}