Files
EdgeAPI/internal/dnsclients/types.go

75 lines
2.2 KiB
Go
Raw Normal View History

package dnsclients
2020-11-11 21:32:25 +08:00
2021-06-02 18:13:48 +08:00
import (
"github.com/iwind/TeaGo/maps"
)
2020-11-11 21:32:25 +08:00
type ProviderType = string
2020-11-12 14:41:28 +08:00
// 服务商代号
2020-11-11 21:32:25 +08:00
const (
2021-06-02 18:13:48 +08:00
ProviderTypeDNSPod ProviderType = "dnspod" // DNSPod
ProviderTypeAliDNS ProviderType = "alidns" // 阿里云DNS
2021-08-04 22:14:54 +08:00
ProviderTypeHuaweiDNS ProviderType = "huaweiDNS" // 华为DNS
2021-06-02 18:13:48 +08:00
ProviderTypeCloudFlare ProviderType = "cloudFlare" // CloudFlare DNS
ProviderTypeLocalEdgeDNS ProviderType = "localEdgeDNS" // 和当前系统集成的EdgeDNS
2022-09-08 19:36:32 +08:00
ProviderTypeEdgeDNSAPI ProviderType = "edgeDNSAPI" // 通过API连接的EdgeDNS
2021-06-02 18:13:48 +08:00
ProviderTypeCustomHTTP ProviderType = "customHTTP" // 自定义HTTP接口
2024-07-27 14:15:25 +08:00
ProviderTypeDNSLA ProviderType = "dnsla" // DNSLA
2020-11-11 21:32:25 +08:00
)
2021-06-02 18:13:48 +08:00
// FindAllProviderTypes 所有的服务商类型
func FindAllProviderTypes() []maps.Map {
2022-09-08 19:36:32 +08:00
var typeMaps = []maps.Map{
2024-07-27 14:15:25 +08:00
{
"name": "DNS.LA",
"code": ProviderTypeDNSLA,
"description": "DNS.LA提供的DNS服务。",
},
2021-06-02 18:13:48 +08:00
{
"name": "阿里云DNS",
"code": ProviderTypeAliDNS,
"description": "阿里云提供的DNS服务。",
},
{
"name": "腾讯云DNSPod",
2021-06-02 18:13:48 +08:00
"code": ProviderTypeDNSPod,
"description": "DNSPod提供的DNS服务。",
},
2021-08-04 22:14:54 +08:00
{
"name": "华为云DNS",
"code": ProviderTypeHuaweiDNS,
"description": "华为云解析DNS。",
},
2021-06-02 18:13:48 +08:00
{
"name": "CloudFlare DNS",
"code": ProviderTypeCloudFlare,
"description": "CloudFlare提供的DNS服务。",
},
2022-09-08 19:36:32 +08:00
{
"name": "EdgeDNS API",
"code": ProviderTypeEdgeDNSAPI,
"description": "通过API连接GoEdge商业版系统提供的DNS服务。",
},
2021-06-02 18:13:48 +08:00
}
2022-04-19 12:58:00 +08:00
typeMaps = filterTypeMaps(typeMaps)
2021-06-02 18:13:48 +08:00
typeMaps = append(typeMaps, maps.Map{
"name": "自定义HTTP DNS",
"code": ProviderTypeCustomHTTP,
2024-07-27 14:15:25 +08:00
"description": "通过自定义的HTTP接口提供DNS服务具体使用方法请参考官网文档https://goedge.cloud/docs/DNS/CustomHTTP.md ",
2021-06-02 18:13:48 +08:00
})
return typeMaps
2020-11-11 21:32:25 +08:00
}
2021-04-15 17:02:01 +08:00
// FindProviderTypeName 查找服务商名称
func FindProviderTypeName(providerType ProviderType) string {
2021-06-02 18:13:48 +08:00
for _, t := range FindAllProviderTypes() {
2020-11-11 21:32:25 +08:00
if t.GetString("code") == providerType {
return t.GetString("name")
}
}
return ""
}