diff --git a/cmd/ddns/main.go b/cmd/ddns/main.go index 23d4048..007083c 100644 --- a/cmd/ddns/main.go +++ b/cmd/ddns/main.go @@ -2,6 +2,7 @@ package main import ( "context" + "fmt" "log/slog" "os" "strings" @@ -21,6 +22,10 @@ var ( DNSMode string ) +var ( + IPNotifyFormat = "[%s] ip changed, old IP: %s new IP: %s" +) + func Init() error { logger := slog.Default() var err error @@ -110,6 +115,7 @@ func updateIP(ctx context.Context) error { logger.Error("Set records error", "error", err) return err } + notify.Notify(ctx, fmt.Sprintf(IPNotifyFormat, config.DOMAIN, record.Value, ip)) } else { _, err = dnsProvider.AppendRecords(ctx, zone, []libdns.Record{ {