dnscontrol/providers/cnr/nameservers.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

107 lines
3 KiB
Go
Raw Normal View History

package cnr
import (
"fmt"
"regexp"
"sort"
"strings"
"github.com/StackExchange/dnscontrol/v4/models"
)
var defaultNameservers = []*models.Nameserver{
{Name: "ns1.rrpproxy.net"},
{Name: "ns2.rrpproxy.net"},
{Name: "ns3.rrpproxy.net"},
}
var nsRegex = regexp.MustCompile(`ns([1-3]{1})[0-9]+\.rrpproxy\.net`)
// GetNameservers gets the nameservers set on a domain.
Squashed commit of the following: commit 901a3ac1c9ec93d504b7de48f0134ebb466a87f1 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Tue Jan 21 14:43:33 2025 -0500 CHORE: Update dependencies (#3397) commit 70e96590142bfd8084e874bf1666c8d3dd795a03 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Tue Jan 21 14:29:53 2025 -0500 MSDNS: Provider is failing due to lint fix gone wrong (#3396) commit 5e15bbe676332beaeae1a3838450b2d6f3e678f2 Author: Jakob Ackermann <das7pad@outlook.com> Date: Sat Jan 18 13:54:37 2025 +0000 BUG: fetch zones once in ZoneCache (#3394) commit a631c5bfdd5a46cbf4046232b3ad8858949c6794 Author: Kai Schwarz <kai.schwarz@centralnic.com> Date: Fri Jan 17 20:15:10 2025 +0100 CNR: Initial Performance improvement; golint review (#3391) commit e1c9785159df631a1991f5d8b2569e0d6b5c45a9 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Fri Jan 17 07:11:10 2025 -0500 CHORE: Update dependencies (#3385) commit 9e88b6a801e49260f1615469396cc8d9ed0371cc Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 21:47:10 2025 -0500 CICD: Make pager tests more visible (#3387) commit 67db0e287da5818757e042a9cc4818db2fda2b4d Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 14:41:18 2025 -0500 GCLOUD: remove (irrelevant) slow test (#3384) commit c348e354ff7f4ee6c996490e3236594e4b6f60a5 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 14:32:32 2025 -0500 GCLOUD: CICD: Skip the pager1201 integration test (#3383) commit 5cfb9073a20026294159d91f69156a52125515bc Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 14:17:47 2025 -0500 TRANSIP: Pause when rate-limited (#3378) commit f666af8714267efe0b931b6f84565fea1341d919 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 13:56:46 2025 -0500 GCLOUD: Re-try on 502 errors (#3376) commit 1a1a4bf00d7d6402471525f4d0d8676e3b689ec1 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 12:54:48 2025 -0500 INWX: Enable SRV to have "." target (#3380) commit 355643988ef90ed71becb1e42f4f976b01e39a02 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 10:58:11 2025 -0500 CLOUDFLAREAPI: No longer treat TTL=300 as special (#3368) Co-authored-by: Sukka <github@skk.moe> commit 89c65b6683f5752a5435ac2d9dfc66da5ccb76b8 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 10:03:00 2025 -0500 INWX: Permit "." target for SRV records (#3377) commit fc2c5069202fb8d2e1eb70aba5dde103afc16022 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Wed Jan 15 18:28:15 2025 -0500 CICD: Warn user if -provider does not match profiles.json:TYPE (#3375) commit 0d5b3c22b72db6a9e01630937409c5e45f82f8b3 Author: Jakob Ackermann <das7pad@outlook.com> Date: Wed Jan 15 22:43:24 2025 +0000 CLOUDFLARE: adopt ZoneCache (#3373) commit 2ef23621b5fbf0652a4eb5c7c86fba56444e3644 Author: Jakob Ackermann <das7pad@outlook.com> Date: Wed Jan 15 20:23:02 2025 +0000 HETZNER: adopt ZoneCache (#3372) commit ab00797f89b598a391a428e24f2a05332ed109a3 Author: Tom Hughes <tom@compton.nu> Date: Wed Jan 15 02:07:19 2025 +0000 FEATURE: Extend PTR magic handling to support RFC4183 names (#3364) commit 5c9b17039e05cbdb66d2aa954e6dbdfbc0b007c0 Author: Jakob Ackermann <das7pad@outlook.com> Date: Wed Jan 15 02:05:17 2025 +0000 FEAT: Add ZoneCache primitive (#3365)
2025-01-22 05:24:46 +08:00
func (n *Client) GetNameservers(domain string) ([]*models.Nameserver, error) {
// NOTE: This information is taken over from HX and adapted to CNR... might be wrong...
// This is an interesting edge case. CNR expects you to SET the nameservers to ns[1-3].rrpproxy.net,
// but it will internally set it to (ns1xyz|ns2uvw|ns3asd).rrpproxy.net, where xyz/uvw/asd is a uniqueish number.
// In order to avoid endless loops, we will use the unique nameservers if present, or else the generic ones if not.
nss, err := n.getNameserversRaw(domain)
if err != nil {
return nil, err
}
toUse := []string{
defaultNameservers[0].Name,
defaultNameservers[1].Name,
defaultNameservers[2].Name,
}
for _, ns := range nss {
if matches := nsRegex.FindStringSubmatch(ns); len(matches) == 2 && len(matches[1]) == 1 {
idx := matches[1][0] - '1' // regex ensures proper range
toUse[idx] = matches[0]
}
}
return models.ToNameservers(toUse)
}
Squashed commit of the following: commit 901a3ac1c9ec93d504b7de48f0134ebb466a87f1 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Tue Jan 21 14:43:33 2025 -0500 CHORE: Update dependencies (#3397) commit 70e96590142bfd8084e874bf1666c8d3dd795a03 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Tue Jan 21 14:29:53 2025 -0500 MSDNS: Provider is failing due to lint fix gone wrong (#3396) commit 5e15bbe676332beaeae1a3838450b2d6f3e678f2 Author: Jakob Ackermann <das7pad@outlook.com> Date: Sat Jan 18 13:54:37 2025 +0000 BUG: fetch zones once in ZoneCache (#3394) commit a631c5bfdd5a46cbf4046232b3ad8858949c6794 Author: Kai Schwarz <kai.schwarz@centralnic.com> Date: Fri Jan 17 20:15:10 2025 +0100 CNR: Initial Performance improvement; golint review (#3391) commit e1c9785159df631a1991f5d8b2569e0d6b5c45a9 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Fri Jan 17 07:11:10 2025 -0500 CHORE: Update dependencies (#3385) commit 9e88b6a801e49260f1615469396cc8d9ed0371cc Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 21:47:10 2025 -0500 CICD: Make pager tests more visible (#3387) commit 67db0e287da5818757e042a9cc4818db2fda2b4d Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 14:41:18 2025 -0500 GCLOUD: remove (irrelevant) slow test (#3384) commit c348e354ff7f4ee6c996490e3236594e4b6f60a5 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 14:32:32 2025 -0500 GCLOUD: CICD: Skip the pager1201 integration test (#3383) commit 5cfb9073a20026294159d91f69156a52125515bc Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 14:17:47 2025 -0500 TRANSIP: Pause when rate-limited (#3378) commit f666af8714267efe0b931b6f84565fea1341d919 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 13:56:46 2025 -0500 GCLOUD: Re-try on 502 errors (#3376) commit 1a1a4bf00d7d6402471525f4d0d8676e3b689ec1 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 12:54:48 2025 -0500 INWX: Enable SRV to have "." target (#3380) commit 355643988ef90ed71becb1e42f4f976b01e39a02 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 10:58:11 2025 -0500 CLOUDFLAREAPI: No longer treat TTL=300 as special (#3368) Co-authored-by: Sukka <github@skk.moe> commit 89c65b6683f5752a5435ac2d9dfc66da5ccb76b8 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 10:03:00 2025 -0500 INWX: Permit "." target for SRV records (#3377) commit fc2c5069202fb8d2e1eb70aba5dde103afc16022 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Wed Jan 15 18:28:15 2025 -0500 CICD: Warn user if -provider does not match profiles.json:TYPE (#3375) commit 0d5b3c22b72db6a9e01630937409c5e45f82f8b3 Author: Jakob Ackermann <das7pad@outlook.com> Date: Wed Jan 15 22:43:24 2025 +0000 CLOUDFLARE: adopt ZoneCache (#3373) commit 2ef23621b5fbf0652a4eb5c7c86fba56444e3644 Author: Jakob Ackermann <das7pad@outlook.com> Date: Wed Jan 15 20:23:02 2025 +0000 HETZNER: adopt ZoneCache (#3372) commit ab00797f89b598a391a428e24f2a05332ed109a3 Author: Tom Hughes <tom@compton.nu> Date: Wed Jan 15 02:07:19 2025 +0000 FEATURE: Extend PTR magic handling to support RFC4183 names (#3364) commit 5c9b17039e05cbdb66d2aa954e6dbdfbc0b007c0 Author: Jakob Ackermann <das7pad@outlook.com> Date: Wed Jan 15 02:05:17 2025 +0000 FEAT: Add ZoneCache primitive (#3365)
2025-01-22 05:24:46 +08:00
func (n *Client) getNameserversRaw(domain string) ([]string, error) {
r := n.client.Request(map[string]interface{}{
"COMMAND": "StatusDomain",
"DOMAIN": domain,
})
code := r.GetCode()
if code != 200 {
Squashed commit of the following: commit 901a3ac1c9ec93d504b7de48f0134ebb466a87f1 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Tue Jan 21 14:43:33 2025 -0500 CHORE: Update dependencies (#3397) commit 70e96590142bfd8084e874bf1666c8d3dd795a03 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Tue Jan 21 14:29:53 2025 -0500 MSDNS: Provider is failing due to lint fix gone wrong (#3396) commit 5e15bbe676332beaeae1a3838450b2d6f3e678f2 Author: Jakob Ackermann <das7pad@outlook.com> Date: Sat Jan 18 13:54:37 2025 +0000 BUG: fetch zones once in ZoneCache (#3394) commit a631c5bfdd5a46cbf4046232b3ad8858949c6794 Author: Kai Schwarz <kai.schwarz@centralnic.com> Date: Fri Jan 17 20:15:10 2025 +0100 CNR: Initial Performance improvement; golint review (#3391) commit e1c9785159df631a1991f5d8b2569e0d6b5c45a9 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Fri Jan 17 07:11:10 2025 -0500 CHORE: Update dependencies (#3385) commit 9e88b6a801e49260f1615469396cc8d9ed0371cc Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 21:47:10 2025 -0500 CICD: Make pager tests more visible (#3387) commit 67db0e287da5818757e042a9cc4818db2fda2b4d Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 14:41:18 2025 -0500 GCLOUD: remove (irrelevant) slow test (#3384) commit c348e354ff7f4ee6c996490e3236594e4b6f60a5 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 14:32:32 2025 -0500 GCLOUD: CICD: Skip the pager1201 integration test (#3383) commit 5cfb9073a20026294159d91f69156a52125515bc Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 14:17:47 2025 -0500 TRANSIP: Pause when rate-limited (#3378) commit f666af8714267efe0b931b6f84565fea1341d919 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 13:56:46 2025 -0500 GCLOUD: Re-try on 502 errors (#3376) commit 1a1a4bf00d7d6402471525f4d0d8676e3b689ec1 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 12:54:48 2025 -0500 INWX: Enable SRV to have "." target (#3380) commit 355643988ef90ed71becb1e42f4f976b01e39a02 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 10:58:11 2025 -0500 CLOUDFLAREAPI: No longer treat TTL=300 as special (#3368) Co-authored-by: Sukka <github@skk.moe> commit 89c65b6683f5752a5435ac2d9dfc66da5ccb76b8 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 10:03:00 2025 -0500 INWX: Permit "." target for SRV records (#3377) commit fc2c5069202fb8d2e1eb70aba5dde103afc16022 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Wed Jan 15 18:28:15 2025 -0500 CICD: Warn user if -provider does not match profiles.json:TYPE (#3375) commit 0d5b3c22b72db6a9e01630937409c5e45f82f8b3 Author: Jakob Ackermann <das7pad@outlook.com> Date: Wed Jan 15 22:43:24 2025 +0000 CLOUDFLARE: adopt ZoneCache (#3373) commit 2ef23621b5fbf0652a4eb5c7c86fba56444e3644 Author: Jakob Ackermann <das7pad@outlook.com> Date: Wed Jan 15 20:23:02 2025 +0000 HETZNER: adopt ZoneCache (#3372) commit ab00797f89b598a391a428e24f2a05332ed109a3 Author: Tom Hughes <tom@compton.nu> Date: Wed Jan 15 02:07:19 2025 +0000 FEATURE: Extend PTR magic handling to support RFC4183 names (#3364) commit 5c9b17039e05cbdb66d2aa954e6dbdfbc0b007c0 Author: Jakob Ackermann <das7pad@outlook.com> Date: Wed Jan 15 02:05:17 2025 +0000 FEAT: Add ZoneCache primitive (#3365)
2025-01-22 05:24:46 +08:00
return nil, n.GetAPIError("Could not get status for domain", domain, r)
}
nsColumn := r.GetColumn("NAMESERVER")
if nsColumn == nil {
fmt.Println("No nameservers found")
return []string{}, nil // No nameserver assigned
}
ns := nsColumn.GetData()
sort.Strings(ns)
return ns, nil
}
// GetRegistrarCorrections gathers corrections that would being n to match dc.
Squashed commit of the following: commit 901a3ac1c9ec93d504b7de48f0134ebb466a87f1 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Tue Jan 21 14:43:33 2025 -0500 CHORE: Update dependencies (#3397) commit 70e96590142bfd8084e874bf1666c8d3dd795a03 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Tue Jan 21 14:29:53 2025 -0500 MSDNS: Provider is failing due to lint fix gone wrong (#3396) commit 5e15bbe676332beaeae1a3838450b2d6f3e678f2 Author: Jakob Ackermann <das7pad@outlook.com> Date: Sat Jan 18 13:54:37 2025 +0000 BUG: fetch zones once in ZoneCache (#3394) commit a631c5bfdd5a46cbf4046232b3ad8858949c6794 Author: Kai Schwarz <kai.schwarz@centralnic.com> Date: Fri Jan 17 20:15:10 2025 +0100 CNR: Initial Performance improvement; golint review (#3391) commit e1c9785159df631a1991f5d8b2569e0d6b5c45a9 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Fri Jan 17 07:11:10 2025 -0500 CHORE: Update dependencies (#3385) commit 9e88b6a801e49260f1615469396cc8d9ed0371cc Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 21:47:10 2025 -0500 CICD: Make pager tests more visible (#3387) commit 67db0e287da5818757e042a9cc4818db2fda2b4d Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 14:41:18 2025 -0500 GCLOUD: remove (irrelevant) slow test (#3384) commit c348e354ff7f4ee6c996490e3236594e4b6f60a5 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 14:32:32 2025 -0500 GCLOUD: CICD: Skip the pager1201 integration test (#3383) commit 5cfb9073a20026294159d91f69156a52125515bc Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 14:17:47 2025 -0500 TRANSIP: Pause when rate-limited (#3378) commit f666af8714267efe0b931b6f84565fea1341d919 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 13:56:46 2025 -0500 GCLOUD: Re-try on 502 errors (#3376) commit 1a1a4bf00d7d6402471525f4d0d8676e3b689ec1 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 12:54:48 2025 -0500 INWX: Enable SRV to have "." target (#3380) commit 355643988ef90ed71becb1e42f4f976b01e39a02 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 10:58:11 2025 -0500 CLOUDFLAREAPI: No longer treat TTL=300 as special (#3368) Co-authored-by: Sukka <github@skk.moe> commit 89c65b6683f5752a5435ac2d9dfc66da5ccb76b8 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 10:03:00 2025 -0500 INWX: Permit "." target for SRV records (#3377) commit fc2c5069202fb8d2e1eb70aba5dde103afc16022 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Wed Jan 15 18:28:15 2025 -0500 CICD: Warn user if -provider does not match profiles.json:TYPE (#3375) commit 0d5b3c22b72db6a9e01630937409c5e45f82f8b3 Author: Jakob Ackermann <das7pad@outlook.com> Date: Wed Jan 15 22:43:24 2025 +0000 CLOUDFLARE: adopt ZoneCache (#3373) commit 2ef23621b5fbf0652a4eb5c7c86fba56444e3644 Author: Jakob Ackermann <das7pad@outlook.com> Date: Wed Jan 15 20:23:02 2025 +0000 HETZNER: adopt ZoneCache (#3372) commit ab00797f89b598a391a428e24f2a05332ed109a3 Author: Tom Hughes <tom@compton.nu> Date: Wed Jan 15 02:07:19 2025 +0000 FEATURE: Extend PTR magic handling to support RFC4183 names (#3364) commit 5c9b17039e05cbdb66d2aa954e6dbdfbc0b007c0 Author: Jakob Ackermann <das7pad@outlook.com> Date: Wed Jan 15 02:05:17 2025 +0000 FEAT: Add ZoneCache primitive (#3365)
2025-01-22 05:24:46 +08:00
func (n *Client) GetRegistrarCorrections(dc *models.DomainConfig) ([]*models.Correction, error) {
nss, err := n.getNameserversRaw(dc.Name)
if err != nil {
return nil, err
}
foundNameservers := strings.Join(nss, ",")
expected := []string{}
for _, ns := range dc.Nameservers {
name := strings.TrimRight(ns.Name, ".")
expected = append(expected, name)
}
sort.Strings(expected)
expectedNameservers := strings.Join(expected, ",")
if foundNameservers != expectedNameservers {
return []*models.Correction{
{
Msg: fmt.Sprintf("Update nameservers %s -> %s", foundNameservers, expectedNameservers),
F: n.updateNameservers(expected, dc.Name),
},
}, nil
}
return nil, nil
}
Squashed commit of the following: commit 901a3ac1c9ec93d504b7de48f0134ebb466a87f1 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Tue Jan 21 14:43:33 2025 -0500 CHORE: Update dependencies (#3397) commit 70e96590142bfd8084e874bf1666c8d3dd795a03 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Tue Jan 21 14:29:53 2025 -0500 MSDNS: Provider is failing due to lint fix gone wrong (#3396) commit 5e15bbe676332beaeae1a3838450b2d6f3e678f2 Author: Jakob Ackermann <das7pad@outlook.com> Date: Sat Jan 18 13:54:37 2025 +0000 BUG: fetch zones once in ZoneCache (#3394) commit a631c5bfdd5a46cbf4046232b3ad8858949c6794 Author: Kai Schwarz <kai.schwarz@centralnic.com> Date: Fri Jan 17 20:15:10 2025 +0100 CNR: Initial Performance improvement; golint review (#3391) commit e1c9785159df631a1991f5d8b2569e0d6b5c45a9 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Fri Jan 17 07:11:10 2025 -0500 CHORE: Update dependencies (#3385) commit 9e88b6a801e49260f1615469396cc8d9ed0371cc Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 21:47:10 2025 -0500 CICD: Make pager tests more visible (#3387) commit 67db0e287da5818757e042a9cc4818db2fda2b4d Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 14:41:18 2025 -0500 GCLOUD: remove (irrelevant) slow test (#3384) commit c348e354ff7f4ee6c996490e3236594e4b6f60a5 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 14:32:32 2025 -0500 GCLOUD: CICD: Skip the pager1201 integration test (#3383) commit 5cfb9073a20026294159d91f69156a52125515bc Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 14:17:47 2025 -0500 TRANSIP: Pause when rate-limited (#3378) commit f666af8714267efe0b931b6f84565fea1341d919 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 13:56:46 2025 -0500 GCLOUD: Re-try on 502 errors (#3376) commit 1a1a4bf00d7d6402471525f4d0d8676e3b689ec1 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 12:54:48 2025 -0500 INWX: Enable SRV to have "." target (#3380) commit 355643988ef90ed71becb1e42f4f976b01e39a02 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 10:58:11 2025 -0500 CLOUDFLAREAPI: No longer treat TTL=300 as special (#3368) Co-authored-by: Sukka <github@skk.moe> commit 89c65b6683f5752a5435ac2d9dfc66da5ccb76b8 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Thu Jan 16 10:03:00 2025 -0500 INWX: Permit "." target for SRV records (#3377) commit fc2c5069202fb8d2e1eb70aba5dde103afc16022 Author: Tom Limoncelli <tlimoncelli@stackoverflow.com> Date: Wed Jan 15 18:28:15 2025 -0500 CICD: Warn user if -provider does not match profiles.json:TYPE (#3375) commit 0d5b3c22b72db6a9e01630937409c5e45f82f8b3 Author: Jakob Ackermann <das7pad@outlook.com> Date: Wed Jan 15 22:43:24 2025 +0000 CLOUDFLARE: adopt ZoneCache (#3373) commit 2ef23621b5fbf0652a4eb5c7c86fba56444e3644 Author: Jakob Ackermann <das7pad@outlook.com> Date: Wed Jan 15 20:23:02 2025 +0000 HETZNER: adopt ZoneCache (#3372) commit ab00797f89b598a391a428e24f2a05332ed109a3 Author: Tom Hughes <tom@compton.nu> Date: Wed Jan 15 02:07:19 2025 +0000 FEATURE: Extend PTR magic handling to support RFC4183 names (#3364) commit 5c9b17039e05cbdb66d2aa954e6dbdfbc0b007c0 Author: Jakob Ackermann <das7pad@outlook.com> Date: Wed Jan 15 02:05:17 2025 +0000 FEAT: Add ZoneCache primitive (#3365)
2025-01-22 05:24:46 +08:00
func (n *Client) updateNameservers(ns []string, domain string) func() error {
return func() error {
cmd := map[string]interface{}{
"COMMAND": "ModifyDomain",
"DOMAIN": domain,
}
for idx, ns := range ns {
cmd[fmt.Sprintf("NAMESERVER%d", idx)] = ns
}
response := n.client.Request(cmd)
code := response.GetCode()
if code != 200 {
return fmt.Errorf("%d %s", code, response.GetDescription())
}
return nil
}
}