1
0
mirror of https://github.com/taigrr/godns synced 2025-01-18 04:03:25 -08:00

Merge pull request #53 from rlei/master

Better DNSPod error message handling and ip_type checking
This commit is contained in:
Timothy 2020-02-09 15:55:53 +08:00 committed by GitHub
commit 13fbb7275d
2 changed files with 6 additions and 0 deletions

View File

@ -204,6 +204,7 @@ For DNSPod, you need to provide your API Token(you can create it [here](https://
}
],
"ip_url": "https://myip.biturl.top",
"ip_type": "IPV4",
"interval": 300,
"socks5_proxy": ""
}

View File

@ -216,6 +216,9 @@ func (handler *Handler) UpdateIP(domainID int64, subDomainID string, subDomainNa
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
}
value.Add("record_line", "默认")
@ -238,6 +241,8 @@ func (handler *Handler) UpdateIP(domainID int64, subDomainID string, subDomainNa
if sjson.Get("status").Get("code").MustString() == "1" {
log.Println("New IP updated!")
} else {
log.Println("Failed to update IP record:", sjson.Get("status").Get("message").MustString())
}
}