Files
unkinben 02e3e0315d
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
Initial implementation: dns-updater daemon
RFC2136 dynamic-DNS updater. Watches a records file (inotify) and new
interface addresses and pushes TSIG-signed updates to BIND per zone, sending
only the delta. Native miekg/dns (structured per-zone RCODEs), local status
API + facter fact, systemd unit, nfpm RPM, Woodpecker CI.

Replaces the puppet dns-update shell script; keeps the same records-file and
TSIG-key contract.
2026-07-17 23:24:49 +10:00

28 lines
644 B
Go

package config
import (
"net"
"os"
)
// SdNotify sends a state string to systemd via NOTIFY_SOCKET (Type=notify). It
// is a no-op when not run under systemd. Implemented inline to avoid a
// dependency for a few lines of socket writing.
func SdNotify(state string) {
sock := os.Getenv("NOTIFY_SOCKET")
if sock == "" {
return
}
addr := &net.UnixAddr{Name: sock, Net: "unixgram"}
// Abstract namespace sockets start with '@'.
if len(sock) > 0 && sock[0] == '@' {
addr.Name = "\x00" + sock[1:]
}
conn, err := net.DialUnix("unixgram", nil, addr)
if err != nil {
return
}
defer conn.Close()
_, _ = conn.Write([]byte(state))
}