File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import (
1212 "github.com/spf13/viper"
1313)
1414
15+ // Run performs a one time DDNS update.
1516func Run (ctx context.Context ) error {
1617 ip , err := ip .GetPublicIPWithRetry (10 , 5 * time .Second )
1718 if err != nil {
@@ -27,10 +28,18 @@ func Run(ctx context.Context) error {
2728 return errors .Trace (err )
2829}
2930
30- func Daemon (ctx context.Context ) error {
31- updatePeriod := 10 * time .Second
32- failureRetryDelay := updatePeriod
31+ // DaemonWithDefaults calls Daemon but with default values
32+ // updatePeriod - 10 seconds
33+ // failureRetryDelay - 10 seconds
34+ func DaemonWithDefaults (ctx context.Context ) error {
35+ d := 10 * time .Second
36+ return errors .Trace (Daemon (ctx , d , d ))
37+ }
3338
39+ // Daemon continually keeps DDNS up to date.
40+ // updatePeriod - how often to check for updates
41+ // failureRetryDelay - how long to wait until retry after a failure
42+ func Daemon (ctx context.Context , updatePeriod , failureRetryDelay time.Duration ) error {
3443 var lastIP string
3544 var lastIPUpdate time.Time
3645
You can’t perform that action at this time.
0 commit comments