Skip to content

Commit

Permalink
add notify
Browse files Browse the repository at this point in the history
  • Loading branch information
orvice committed Oct 23, 2024
1 parent 54edee2 commit 228bfaf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/ddns/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"fmt"
"log/slog"
"os"
"strings"
Expand All @@ -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
Expand Down Expand Up @@ -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{
{
Expand Down

0 comments on commit 228bfaf

Please sign in to comment.