mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-11-10 17:26:10 +08:00
INWX: Paginate through Nameserver Records (#2609)
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
parent
65c47cbfe8
commit
bf4118a041
2 changed files with 16 additions and 16 deletions
|
@ -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 %}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue