feat: 增加DNS服务商CloudDNS (#7081)

Refs #7038
This commit is contained in:
igophper 2024-11-15 16:46:45 +08:00 committed by GitHub
parent 7e677ee9fa
commit af41e8e429
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 31 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import (
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/lego" "github.com/go-acme/lego/v4/lego"
"github.com/go-acme/lego/v4/providers/dns/alidns" "github.com/go-acme/lego/v4/providers/dns/alidns"
"github.com/go-acme/lego/v4/providers/dns/clouddns"
"github.com/go-acme/lego/v4/providers/dns/cloudflare" "github.com/go-acme/lego/v4/providers/dns/cloudflare"
"github.com/go-acme/lego/v4/providers/dns/dnspod" "github.com/go-acme/lego/v4/providers/dns/dnspod"
"github.com/go-acme/lego/v4/providers/dns/godaddy" "github.com/go-acme/lego/v4/providers/dns/godaddy"
@ -70,6 +71,7 @@ const (
AliYun DnsType = "AliYun" AliYun DnsType = "AliYun"
Volcengine DnsType = "Volcengine" Volcengine DnsType = "Volcengine"
CloudFlare DnsType = "CloudFlare" CloudFlare DnsType = "CloudFlare"
CloudDns DnsType = "CloudDns"
NameSilo DnsType = "NameSilo" NameSilo DnsType = "NameSilo"
NameCheap DnsType = "NameCheap" NameCheap DnsType = "NameCheap"
NameCom DnsType = "NameCom" NameCom DnsType = "NameCom"
@ -89,6 +91,8 @@ type DNSParam struct {
APISecret string `json:"apiSecret"` APISecret string `json:"apiSecret"`
SecretID string `json:"secretID"` SecretID string `json:"secretID"`
Region string `json:"region"` Region string `json:"region"`
ClientID string `json:"clientID"`
Password string `json:"password"`
} }
var ( var (
@ -140,6 +144,15 @@ func (c *AcmeClient) UseDns(dnsType DnsType, params string, websiteSSL model.Web
cloudflareConfig.PollingInterval = pollingInterval cloudflareConfig.PollingInterval = pollingInterval
cloudflareConfig.TTL = 3600 cloudflareConfig.TTL = 3600
p, err = cloudflare.NewDNSProviderConfig(cloudflareConfig) p, err = cloudflare.NewDNSProviderConfig(cloudflareConfig)
case CloudDns:
clouddnsConfig := clouddns.NewDefaultConfig()
clouddnsConfig.ClientID = param.ClientID
clouddnsConfig.Email = param.Email
clouddnsConfig.Password = param.Password
clouddnsConfig.PropagationTimeout = propagationTimeout
clouddnsConfig.PollingInterval = pollingInterval
clouddnsConfig.TTL = ttl
p, err = clouddns.NewDNSProviderConfig(clouddnsConfig)
case NameCheap: case NameCheap:
namecheapConfig := namecheap.NewDefaultConfig() namecheapConfig := namecheap.NewDefaultConfig()
namecheapConfig.APIKey = param.APIkey namecheapConfig.APIKey = param.APIkey

View File

@ -180,6 +180,10 @@ export const DNSTypes = [
label: 'Cloudflare', label: 'Cloudflare',
value: 'CloudFlare', value: 'CloudFlare',
}, },
{
label: 'CloudDns',
value: 'CloudDns',
},
{ {
label: 'NameSilo', label: 'NameSilo',
value: 'NameSilo', value: 'NameSilo',

View File

@ -77,6 +77,17 @@
<el-input v-model.trim="account.authorization['apiKey']"></el-input> <el-input v-model.trim="account.authorization['apiKey']"></el-input>
</el-form-item> </el-form-item>
</div> </div>
<div v-if="account.type === 'CloudDns'">
<el-form-item label="Client ID" prop="authorization.clientID">
<el-input v-model.trim="account.authorization['clientID']"></el-input>
</el-form-item>
<el-form-item label="Email" prop="authorization.email">
<el-input v-model.trim="account.authorization['email']"></el-input>
</el-form-item>
<el-form-item label="Password" prop="authorization.password">
<el-input v-model.trim="account.authorization['password']"></el-input>
</el-form-item>
</div>
<el-form-item <el-form-item
label="API Key" label="API Key"
prop="authorization.apiKey" prop="authorization.apiKey"
@ -146,6 +157,9 @@ const rules = ref<any>({
apiUser: [Rules.requiredInput], apiUser: [Rules.requiredInput],
secretID: [Rules.requiredInput], secretID: [Rules.requiredInput],
region: [Rules.requiredInput], region: [Rules.requiredInput],
clientID: [Rules.requiredInput],
email: [Rules.email],
password: [Rules.requiredInput],
}, },
}); });
const account = ref({ const account = ref({