1
0
mirror of https://github.com/go-acme/lego.git synced 2025-09-16 09:36:23 +02:00

alidns: add support to handle more than 20 domains (#739)

This commit is contained in:
smartwang
2018-12-20 18:52:34 +08:00
committed by Ludovic Fernandez
parent 15764a17b6
commit cb3c4c7937

View File

@@ -136,9 +136,25 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
func (d *DNSProvider) getHostedZone(domain string) (string, string, error) { func (d *DNSProvider) getHostedZone(domain string) (string, string, error) {
request := alidns.CreateDescribeDomainsRequest() request := alidns.CreateDescribeDomainsRequest()
zones, err := d.client.DescribeDomains(request)
if err != nil { var domains []alidns.Domain
return "", "", fmt.Errorf("API call failed: %v", err) startPage := 1
for {
request.PageNumber = requests.NewInteger(startPage)
response, err := d.client.DescribeDomains(request)
if err != nil {
return "", "", fmt.Errorf("API call failed: %v", err)
}
domains = append(domains, response.Domains.Domain...)
if response.PageNumber >= response.PageSize {
break
}
startPage++
} }
authZone, err := dns01.FindZoneByFqdn(dns01.ToFqdn(domain)) authZone, err := dns01.FindZoneByFqdn(dns01.ToFqdn(domain))
@@ -147,7 +163,7 @@ func (d *DNSProvider) getHostedZone(domain string) (string, string, error) {
} }
var hostedZone alidns.Domain var hostedZone alidns.Domain
for _, zone := range zones.Domains.Domain { for _, zone := range domains {
if zone.DomainName == dns01.UnFqdn(authZone) { if zone.DomainName == dns01.UnFqdn(authZone) {
hostedZone = zone hostedZone = zone
} }