mirror of
https://github.com/taigrr/godns
synced 2025-01-18 04:03:25 -08:00
Addressed code review plus missed updates
This commit is contained in:
parent
690e138164
commit
e8ce3434ee
@ -102,7 +102,7 @@ Usage of ./godns:
|
||||
|
||||
## Config fields
|
||||
|
||||
* provider: The providers that GoDNS supports, available values are: `Cloudflare`, `Google`, `DNSPod`, `AliDNS`, `HE`, `DuckDNS`.
|
||||
* provider: The providers that GoDNS supports, available values are: `Cloudflare`, `Google`, `DNSPod`, `AliDNS`, `HE`, `DuckDNS`, `Dreamhost`.
|
||||
* email: Email or account name of your DNS provider.
|
||||
* password: Password of your account.
|
||||
* login_token: API token of your account.
|
||||
@ -117,10 +117,11 @@ Usage of ./godns:
|
||||
|
||||
Supported provider(s):
|
||||
* Cloudflare
|
||||
* HE.net
|
||||
* DNSPod
|
||||
* Dreamhost
|
||||
* DuckDNS
|
||||
* Google Domains
|
||||
* HE.net
|
||||
|
||||
To enable the `IPv6` mode of GoDNS, you only need two steps:
|
||||
* Set the `ip_type` as `IPv6`, and make sure the `ipv6_url` is configured.
|
||||
|
@ -81,12 +81,17 @@ func (handler *Handler) UpdateIP(hostname, currentIP, lastIP string) {
|
||||
|
||||
// updateDNS can add or remove DNS records.
|
||||
func (handler *Handler) updateDNS(dns, ip, hostname, action string) {
|
||||
ipType := "A"
|
||||
if strings.ToUpper(handler.Configuration.IPType) == godns.IPV6 {
|
||||
ipType = "AAAA"
|
||||
}
|
||||
|
||||
// Generates UUID
|
||||
uid, _ := uuid.NewRandom()
|
||||
values := url.Values{}
|
||||
values.Add("record", hostname)
|
||||
values.Add("key", handler.Configuration.LoginToken)
|
||||
values.Add("type", "A")
|
||||
values.Add("type", ipType)
|
||||
values.Add("unique_id", uid.String())
|
||||
switch action {
|
||||
case "remove":
|
||||
|
6
utils.go
6
utils.go
@ -226,14 +226,14 @@ func CheckSettings(config *Settings) error {
|
||||
}
|
||||
|
||||
default:
|
||||
return errors.New("please provide supported DNS provider: DNSPod/HE/AliDNS/Cloudflare/GoogleDomain/DuckDNS")
|
||||
return errors.New("please provide supported DNS provider: DNSPod/HE/AliDNS/Cloudflare/GoogleDomain/DuckDNS/Dreamhost")
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SendNotify sends notify if IP is changed
|
||||
// SendTelegramNotify sends notify if IP is changed
|
||||
func SendTelegramNotify(configuration *Settings, domain, currentIP string) error {
|
||||
if !configuration.Notify.Telegram.Enabled {
|
||||
return nil
|
||||
@ -294,7 +294,7 @@ func SendTelegramNotify(configuration *Settings, domain, currentIP string) error
|
||||
return nil
|
||||
}
|
||||
|
||||
// SendNotify sends mail notify if IP is changed
|
||||
// SendMailNotify sends mail notify if IP is changed
|
||||
func SendMailNotify(configuration *Settings, domain, currentIP string) error {
|
||||
if !configuration.Notify.Mail.Enabled {
|
||||
return nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user