From 220001cf6a0dd06c35368124c4de0e4dbecf6804 Mon Sep 17 00:00:00 2001 From: WaterLemons2k <62788816+WaterLemons2k@users.noreply.github.com> Date: Fri, 14 Jul 2023 12:43:07 +0800 Subject: [PATCH] fix(GoDaddy): use `@` as name when subdomain is missing --- config/domains.go | 2 +- dns/godaddy.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/domains.go b/config/domains.go index 04abf5fff..2b07402d9 100644 --- a/config/domains.go +++ b/config/domains.go @@ -45,7 +45,7 @@ func (d Domain) GetFullDomain() string { } // GetSubDomain 获得子域名,为空返回@ -// 阿里云/腾讯云/dnspod/namecheap 需要 +// 阿里云/腾讯云/dnspod/GoDaddy/namecheap 需要 func (d Domain) GetSubDomain() string { if d.SubDomain != "" { return d.SubDomain diff --git a/dns/godaddy.go b/dns/godaddy.go index ccf6606b9..b7516cdda 100644 --- a/dns/godaddy.go +++ b/dns/godaddy.go @@ -72,7 +72,7 @@ func (g *GoDaddyDNS) updateDomainRecord(recordType string, ipAddr string, domain for _, domain := range domains { err := g.sendReq(http.MethodPut, recordType, domain, &godaddyRecords{godaddyRecord{ Data: ipAddr, - Name: domain.SubDomain, + Name: domain.GetSubDomain(), TTL: g.ttl, Type: recordType, }}) @@ -107,7 +107,7 @@ func (g *GoDaddyDNS) sendReq(method string, rType string, domain *config.Domain, } } path := fmt.Sprintf("https://api.godaddy.com/v1/domains/%s/records/%s/%s", - domain.DomainName, rType, domain.SubDomain) + domain.DomainName, rType, domain.GetSubDomain()) req, err := http.NewRequest(method, path, body) if err != nil {