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

send mail notify if IP is changed

This commit is contained in:
Timothy 2017-11-06 11:32:27 +08:00
parent ccbdf4e31d
commit 4c4f34c55b
2 changed files with 14 additions and 3 deletions

View File

@ -73,6 +73,12 @@ func (handler *DNSPodHandler) DomainLoop(domain *godns.Domain, panicChan chan<-
if len(ip) > 0 && !strings.Contains(currentIP, ip) { if len(ip) > 0 && !strings.Contains(currentIP, ip) {
log.Printf("%s.%s Start to update record IP...\n", subDomain, domain.DomainName) log.Printf("%s.%s Start to update record IP...\n", subDomain, domain.DomainName)
handler.UpdateIP(domainID, subDomainID, subDomain, currentIP) handler.UpdateIP(domainID, subDomainID, subDomain, currentIP)
// Send mail notification if notify is enabled
if handler.Configuration.Notify.Enabled {
godns.SendNotify(handler.Configuration, currentIP)
}
} else { } else {
log.Printf("%s.%s Current IP is same as domain IP, no need to update...\n", subDomain, domain.DomainName) log.Printf("%s.%s Current IP is same as domain IP, no need to update...\n", subDomain, domain.DomainName)
} }

View File

@ -58,6 +58,11 @@ func (handler *HEHandler) DomainLoop(domain *godns.Domain, panicChan chan<- godn
for _, subDomain := range domain.SubDomains { for _, subDomain := range domain.SubDomains {
log.Printf("%s.%s Start to update record IP...\n", subDomain, domain.DomainName) log.Printf("%s.%s Start to update record IP...\n", subDomain, domain.DomainName)
handler.UpdateIP(domain.DomainName, subDomain, currentIP) handler.UpdateIP(domain.DomainName, subDomain, currentIP)
// Send mail notification if notify is enabled
if handler.Configuration.Notify.Enabled {
godns.SendNotify(handler.Configuration, currentIP)
}
} }
} }