From 7a60d3415fd334d90ad80a73cbbde997c0bf8019 Mon Sep 17 00:00:00 2001 From: Timothy Date: Thu, 1 Oct 2020 18:28:31 +0800 Subject: [PATCH] fix: DNSPod handler issue for checking IPv4/IPv6 --- handler/dnspod/dnspod_handler.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/handler/dnspod/dnspod_handler.go b/handler/dnspod/dnspod_handler.go index ee7939a..e1a79e9 100644 --- a/handler/dnspod/dnspod_handler.go +++ b/handler/dnspod/dnspod_handler.go @@ -177,6 +177,15 @@ func (handler *Handler) GetSubDomain(domainID int64, name string) (string, strin value.Add("length", "1") value.Add("sub_domain", name) + if handler.Configuration.IPType == "" || strings.ToUpper(handler.Configuration.IPType) == godns.IPV4 { + value.Add("record_type", "A") + } else if strings.ToUpper(handler.Configuration.IPType) == godns.IPV6 { + value.Add("record_type", "AAAA") + } else { + log.Println("Error: must specify \"ip_type\" in config for DNSPod.") + return "", "" + } + response, err := handler.PostData("/Record.List", value) if err != nil {