Files
EdgeAPI/internal/dnsproviders/types.go

38 lines
680 B
Go
Raw Normal View History

2020-11-11 21:32:25 +08:00
package dnsproviders
import "github.com/iwind/TeaGo/maps"
type ProviderType = string
2020-11-12 14:41:28 +08:00
// 服务商代号
2020-11-11 21:32:25 +08:00
const (
ProviderTypeDNSPod ProviderType = "dnspod"
2020-11-12 14:41:28 +08:00
ProviderTypeAliyun ProviderType = "aliyun"
ProviderTypeDNSCom ProviderType = "dnscom"
2020-11-11 21:32:25 +08:00
)
2020-11-12 14:41:28 +08:00
// 所有的服务商类型
2020-11-11 21:32:25 +08:00
var AllProviderTypes = []maps.Map{
{
"name": "DNSPod",
"code": ProviderTypeDNSPod,
},
2020-11-12 14:41:28 +08:00
{
"name": "阿里云",
"code": ProviderTypeAliyun,
},
{
"name": "帝恩思",
"code": ProviderTypeDNSCom,
},
2020-11-11 21:32:25 +08:00
}
func FindProviderTypeName(providerType string) string {
for _, t := range AllProviderTypes {
if t.GetString("code") == providerType {
return t.GetString("name")
}
}
return ""
}