Documentation
¶
Overview ¶
Package dyndns implements a dynamic-DNS daemon that periodically detects a host's public IP and pushes updates to a DNS provider when the IP changes.
Per docs/plans/2026-05-20-dns-providers.md T14..T16.
The package is intentionally provider-agnostic: callers supply an Updater closure that talks to their DNS driver of choice (DO, Namecheap, Hover, etc.) via wfctl's existing infra.dns surface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Detectors quorum the public IP. Default: HTTPDetector against
// icanhazip.com + ifconfig.me + ipify.org (need ≥ 2 agreeing).
Detectors []IPDetector
// PollInterval is the steady-state interval between IP checks.
// Default 5m. Must be >= 30s.
PollInterval time.Duration
// QuorumSize is the number of detectors that must agree before
// an update fires. Default = (len(Detectors)+1)/2 — simple
// majority. Set to 1 for single-source mode.
QuorumSize int
// MaxBackoff caps the exponential backoff applied after
// consecutive Update failures. Default 1h.
MaxBackoff time.Duration
// Update is the callback that applies a new IP to DNS.
Update Updater
// Now is injectable for tests. Defaults to time.Now.
Now func() time.Time
// Sleep is injectable for tests. Defaults to time.Sleep.
Sleep func(time.Duration)
}
Config controls the daemon loop.
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon runs the detect → diff → update loop.
func (*Daemon) Current ¶
Current returns the most recently confirmed IP. Empty until first successful detection.
func (*Daemon) Run ¶
Run blocks until ctx is cancelled, ticking every PollInterval. Backoff applies after consecutive failures.
func (*Daemon) Tick ¶
Tick executes one detect/diff/update cycle. Tests call this directly to bypass the timer; Run() invokes it in a loop.
func (*Daemon) TotalUpdates ¶
TotalUpdates reports the cumulative count of successful Update calls.
type HTTPDetector ¶
HTTPDetector queries a simple "what's my IP" HTTP endpoint.
type IPDetector ¶
IPDetector returns the public IP this host appears to be reaching the internet from. Implementations should be lightweight; a single HTTPS GET is the canonical shape.
func DefaultDetectors ¶
func DefaultDetectors() []IPDetector
DefaultDetectors returns the three-source quorum used when no detectors are configured.