mirror of
https://github.com/taigrr/godns
synced 2025-01-18 04:03:25 -08:00
enable socks for domain update and telegram notification seperately
- add configuration to enable socks for domain update and telegram notification seperately. - sleep to reduce cpu usage while connection error occurred.
This commit is contained in:
@@ -38,7 +38,15 @@ func (handler *Handler) DomainLoop(domain *godns.Domain, panicChan chan<- godns.
|
||||
}
|
||||
}()
|
||||
|
||||
looping := false
|
||||
for {
|
||||
if looping {
|
||||
// Sleep with interval
|
||||
log.Printf("Going to sleep, will start next checking in %d seconds...\r\n", handler.Configuration.Interval)
|
||||
time.Sleep(time.Second * time.Duration(handler.Configuration.Interval))
|
||||
}
|
||||
looping = true
|
||||
|
||||
currentIP, err := godns.GetCurrentIP(handler.Configuration)
|
||||
|
||||
if err != nil {
|
||||
@@ -63,10 +71,6 @@ func (handler *Handler) DomainLoop(domain *godns.Domain, panicChan chan<- godns.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sleep with interval
|
||||
log.Printf("Going to sleep, will start next checking in %d seconds...\r\n", handler.Configuration.Interval)
|
||||
time.Sleep(time.Second * time.Duration(handler.Configuration.Interval))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -106,7 +110,7 @@ func (handler *Handler) updateDNS(dns, ip, hostname, action string) {
|
||||
log.Fatalf("Unknown action %s\n", action)
|
||||
}
|
||||
|
||||
client := godns.GetHttpClient(handler.Configuration)
|
||||
client := godns.GetHttpClient(handler.Configuration, handler.Configuration.UseProxy)
|
||||
req, _ := http.NewRequest("POST", DreamhostURL, strings.NewReader(values.Encode()))
|
||||
req.SetBasicAuth(handler.Configuration.Email, handler.Configuration.Password)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user