INWX: Paginate through Nameserver Records (#2609)

Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
Joachim Schwarm 2023-11-01 18:34:34 +01:00 committed by GitHub
parent 65c47cbfe8
commit bf4118a041
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 16 deletions

View file

@ -109,9 +109,3 @@ D("example.com", REG_INWX, DnsProvider(DSP_CF),
);
```
{% endcode %}
{% hint style="info" %}
**NOTE**: The INWX provider implementation currently only supports up to 2,147,483,647 domains. If you exceed
this limit, it is expected that DNSControl will fail to recognize some domains. Should you exceed this
limit, please [open an issue on GitHub](https://github.com/StackExchange/dnscontrol/issues/new/choose).
{% endhint %}

View file

@ -395,18 +395,24 @@ func (api *inwxAPI) GetRegistrarCorrections(dc *models.DomainConfig) ([]*models.
// fetchNameserverDomains returns the domains configured in INWX nameservers
func (api *inwxAPI) fetchNameserverDomains() error {
zones := map[string]int{}
request := &goinwx.NameserverListRequest{}
request.PageLimit = 2147483647 // int32 max value, highest number API accepts
page := 1
for {
request.Page = page
info, err := api.client.Nameservers.ListWithParams(request)
if err != nil {
return err
}
api.domainIndex = map[string]int{}
for _, domain := range info.Domains {
api.domainIndex[domain.Domain] = domain.RoID
zones[domain.Domain] = domain.RoID
}
if len(zones) >= info.Count {
break
}
page++
}
api.domainIndex = zones
return nil
}