- Add test_duckdns_contract.py asserting token auth, prefix targeting, and verbose mode - Add duckdns_config fixture in conftest.py - Document DuckDNS protocol quirks and verbose 4-line block format in docs/contracts/class-a-duckdns.md - Make Dynu test_bad_credentials assertion resilient to remote IP match short-circuiting - Add .envrc for direnv integration
ddns-monitor
A provider-agnostic Dynamic DNS monitor written in Rust.
Monitors the machine's public WAN IPv4 address and, when a change is detected, notifies
all configured DDNS provider subscribers. Designed to replace ddclient on NixOS homelabs
and to work on any standard Linux system.
Why this exists
DDNS updaters like ddclient couple the IP-detection step to a single provider. When that
provider has an outage, the entire update chain breaks — even though your IP may not have
changed and other providers could accept the update.
ddns-monitor:
- Separates IP discovery (round-robin across multiple checkers) from DNS updating (fan-out to multiple DDNS provider plugins).
- Stores the last-known-good IP locally and skips updates when nothing has changed.
- Notifies all configured subscribers on a detected change.
- Runs as a systemd oneshot timer, consuming no resources between invocations.
Status
Phases 0 through 8 Complete — v1 Ready.
Full Rust implementation with domain models, round-robin WAN IP discovery via ureq (rustls), atomic JSON state persistence, JSONL execution history, native Dynu API updater plugin, multi-subscriber fan-out, and declarative NixOS systemd module.
See ROADMAP.md for details.
Quick Start (development)
Prerequisites: Nix with flakes enabled. No system OpenSSL required — TLS is handled by bundled rustls.
# Enter the development shell (downloads pinned Rust toolchain)
nix develop
# Build
cargo build
# Run tests
cargo nextest run
# Live-reload on save
cargo watch -x check
Architecture (target)
main.rs (composition root)
└── IpMonitorService (orchestration)
├── IpResolver — discovers WAN IP via rotating external checkers
├── StateRepository — persists last-known-good IP as JSON
├── NotificationBus — fans out to all configured DDNS updaters
│ ├── DynuUpdater (Phase 6)
│ └── «future plugins»
└── HistoryRepository — append-only JSONL audit log
The application service contains all decision logic. Infrastructure components (HTTP, fs, subprocess) are hidden behind traits and swappable in tests.
Configuration
The binary reads from (in priority order):
- NixOS module options (declarative, build-time injection)
~/.config/ddns-monitor/config.toml(runtime, for non-NixOS)
Example:
[ip_providers]
urls = [
"https://api.ipify.org",
"https://ifconfig.me/ip",
"https://icanhazip.com",
]
timeout_secs = 5
[[subscribers]]
provider = "dynu"
domain = "example.dyndns.org"
credentials_env = "DYNU_PASSWORD"
Never store plaintext credentials in
config.toml. Use env vars or sops-nix secrets.
NixOS
The NixOS module (Phase 8) will:
- Build the binary as a Nix derivation.
- Expose
services.ddns-monitor.subscribersas a list of option sets. - Inject credentials from
sops.secretsviaLoadCredential. - Run as a oneshot systemd timer (30-minute default, configurable).
Invariants
last_ip= the IP from the last fully successful fan-out (all subscribers succeeded).- Discovering an IP does not update
last_ip. - A partial or total update failure leaves
last_ipunchanged. - The monitor does not fire DDNS when the discovered IP matches
last_ip. - Provider rotation state may be persisted independently of IP changes.
- All infrastructure dependencies are injectable via traits (testable without network/fs).
License
Unlicense — public domain.