PORKBUN: Improve non .DE domain delegation processing (remove the trailing dot in NS) (#2624)

Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
imlonghao 2023-11-16 23:56:31 +08:00 committed by GitHub
parent b8096b7b8a
commit 32fe2753d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,7 @@ import (
"io"
"net/http"
"sort"
"strings"
"time"
)
@ -156,7 +157,15 @@ func (c *porkbunProvider) getNameservers(domain string) ([]string, error) {
json.Unmarshal(bodyString, &ns)
sort.Strings(ns.Nameservers)
return ns.Nameservers, nil
var nameservers []string
for _, nameserver := range ns.Nameservers {
// Remove the trailing dot only if it exists.
// This provider seems to add the trailing dot to some domains but not others.
// The .DE domains seem to always include the dot, others don't.
nameservers = append(nameservers, strings.TrimSuffix(nameserver, "."))
}
return nameservers, nil
}
func (c *porkbunProvider) updateNameservers(ns []string, domain string) error {