From c25eefa8a2b7571fd151c52ebc18b4b355793efc Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Tue, 20 Oct 2026 22:46:25 -0500 Subject: [PATCH] chore(phase-0): dev environment, docs, and project rename - Rename crate from dynu-monitor to ddns-monitor - Add flake.nix: pinned Rust stable (rust-overlay), devShell with cargo-watch, cargo-nextest, cargo-audit, curl, jq; package and checks outputs scaffolded - Update .gitignore: cover Rust/Nix build artefacts, secrets, runtime state files (state.json, *.jsonl), editor cruft; keep flake.lock tracked - Rewrite README.md: reflects broadened multi-provider scope, architecture overview, dev-shell quick start, config example, NixOS integration plan, invariants - Add ROADMAP.md: 10-phase plan from cleanup through additional providers; fan-out semantics and partial-success policy documented - Fix models.rs: correct IpDiscoveryResult syntax error, upgrade types to Option / Ipv4Addr, add doc comments - Update main.rs: scaffold stub that initialises logging and exits cleanly instead of hello-world placeholder - Add Cargo.toml dependencies through Phase 5: serde, serde_json, toml, reqwest (blocking), thiserror, log, env_logger, mockito cargo check: passes with only expected dead_code warnings --- .gitignore | 38 ++ Cargo.lock | 1506 +++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 33 ++ README.md | 470 +++------------ ROADMAP.md | 379 +++++++++++++ flake.nix | 121 ++++ src/main.rs | 10 + src/models.rs | 25 + 8 files changed, 2186 insertions(+), 396 deletions(-) create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 ROADMAP.md create mode 100644 flake.nix create mode 100644 src/main.rs create mode 100644 src/models.rs diff --git a/.gitignore b/.gitignore index e69de29..3f62cea 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,38 @@ +# ── Rust / Cargo ─────────────────────────────────────────────────────────────── +/target/ +Cargo.lock # library crates omit it; for binaries keep it — uncomment if you want + +# ── Nix ──────────────────────────────────────────────────────────────────────── +result +result-* +.direnv/ + +# ── Secrets & credentials ─────────────────────────────────────────────────────── +# Never commit plaintext secrets, tokens, or API keys. +*.secret +*.key +*.pem +*.p12 +*.pfx +secrets/ +.env +.env.* +config.toml # local dev config may contain credential paths — keep out + +# ── Runtime state ────────────────────────────────────────────────────────────── +# Generated by the binary at runtime; not source artifacts. +state.json +*.jsonl +ip_history.jsonl + +# ── Editor / OS ──────────────────────────────────────────────────────────────── +.DS_Store +Thumbs.db +.idea/ +.vscode/ +*.swp +*.swo +*~ + +# ── Misc ─────────────────────────────────────────────────────────────────────── +*.log diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..405a642 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1506 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "assert-json-diff" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e4f2b81832e72834d7518d8487a0396a28cc408186a2e8854c0f98011faf12" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "colored" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf9468729b8cbcea668e36183cb69d317348c2e08e994829fb56ebfdfbaac34" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "ddns-monitor" +version = "0.1.0" +dependencies = [ + "env_logger", + "log", + "mockito", + "reqwest", + "reqwest-middleware", + "serde", + "serde_json", + "thiserror 2.0.21", + "toml", +] + +[[package]] +name = "defmt" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a0795ac740cb54d7b3775c9c17345f6aaecf884c01733b39d6017738e0e3e1" +dependencies = [ + "bitflags 1.3.2", + "defmt-macros", +] + +[[package]] +name = "defmt-macros" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "840bb056bd99c495c9188198a258ab787c79f306d864db3e6e8451442d6d8366" +dependencies = [ + "defmt-parser", + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "defmt-parser" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71958f69fb2de856c5dd51ac9377e986ca1aa5919f931bf5395a807277f889a0" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "env_filter" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900d271a03799a1ee8d1ca9b19893b48ca674a9284fefcfb85f05e74ed314217" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de671bd27a75a797dc9ae289ba1e77276e75e2026408aab65185384e2d5cd3f6" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", +] + +[[package]] +name = "h2" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d29020232d6aa3fb1daca64c1127cf662cf97f254ae16c18c05b8ab635fc118" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "icu_collections" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" + +[[package]] +name = "icu_properties" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" + +[[package]] +name = "icu_provider" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "ipnet" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jiff" +version = "0.2.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b005715dcbeb0089a3c0dab99f2ff1cc3b2525323552703d648585d342a383" +dependencies = [ + "defmt", + "jiff-core", + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e52fe76043ccecc9005d2305ebaadf7d7fc0cc89ca6baa10a94d6bc68c7128c" +dependencies = [ + "defmt", + "log", +] + +[[package]] +name = "jiff-static" +version = "0.2.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cc9817253cf7c7ee4684451bd327e88d6f3658014e54a29198625590650695c" +dependencies = [ + "jiff-core", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "js-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "mio" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" +dependencies = [ + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "mockito" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90820618712cab19cfc46b274c6c22546a82affcb3c3bdf0f29e3db8e1bb92c0" +dependencies = [ + "assert-json-diff", + "bytes", + "colored", + "futures-core", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "log", + "pin-project-lite", + "rand", + "regex", + "serde_json", + "serde_urlencoded", + "similar", + "tokio", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" +dependencies = [ + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "reqwest-middleware" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57f17d28a6e6acfe1733fe24bcd30774d13bffa4b8a22535b4c8c98423088d4e" +dependencies = [ + "anyhow", + "async-trait", + "http", + "reqwest", + "serde", + "thiserror 1.0.69", + "tower-service", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "similar" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.16.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "tinystr" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.54.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c168a474b95bfecfe908a65d4bdffc523144b649a74c09c286afb35d53e0bc" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "socket2", + "windows-sys", +] + +[[package]] +name = "tokio-util" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "libc", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags 2.13.2", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.9", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..04e41ae --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "ddns-monitor" +version = "0.1.0" +edition = "2024" +description = "Provider-agnostic DDNS monitor with plugin architecture" +license = "Unlicense" + +[[bin]] +name = "ddns-monitor" +path = "src/main.rs" + +[dependencies] +# Serialization — state JSON and config TOML +serde = { version = "1", features = ["derive"] } +serde_json = "1" +toml = "0.8" + +# HTTP client — blocking (no async needed for a oneshot binary) +reqwest = { version = "0.12", features = ["blocking"], default-features = false } + +# TLS backend — uses the system's OpenSSL +reqwest-middleware = { version = "0.4", optional = true } # future: retry middleware + +# Error handling +thiserror = "2" + +# Logging +log = "0.4" +env_logger = "0.11" + +[dev-dependencies] +# Lightweight HTTP mock server for testing IpResolver without real network +mockito = "1" diff --git a/README.md b/README.md index bd7dae6..e1adb3b 100644 --- a/README.md +++ b/README.md @@ -1,447 +1,125 @@ -# dynu-monitor +# ddns-monitor -## Overview +A provider-agnostic Dynamic DNS monitor written in Rust. -`dynu-monitor` is a small Rust service that monitors the machine's public IPv4 address and triggers a Dynamic DNS update only when a verified IP change is detected. - -The project exists primarily as a Rust learning project, but the resulting binary should be usable as a real component of a NixOS-based homelab. - -The system follows a local-first approach: - -1. Discover the current public IPv4 address. -2. Compare it against locally persisted state. -3. If unchanged, do nothing. -4. If changed, trigger `ddclient.service`. -5. Persist the new IP only after the update succeeds. +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. --- -## Problem Statement +## Why this exists -A DDNS updater can be invoked periodically regardless of whether the public IP address has changed. This can result in unnecessary requests to the DNS provider. +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. -`dynu-monitor` acts as a local change detector in front of the existing DDNS updater. +`ddns-monitor`: -The monitor should answer one question: - -> Has the machine's public IPv4 address changed since the last successfully completed DDNS update? - -If the answer is no, the DDNS updater should not be invoked. - -If the answer is yes, the monitor should request an update and record the new address only after that update succeeds. +- 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. --- -## Goals +## Status -### Functional Goals +**Phase 0 — in progress.** Laying foundations: flake, documentation, module structure. -* Discover the machine's public IPv4 address using external IP providers. -* Rotate through configured providers between executions. -* Validate that discovered addresses are valid public IPv4 addresses. -* Persist the last successfully updated IP address locally. -* Detect changes between the current and last successfully updated IP. -* Trigger `ddclient.service` when an IP change is detected. -* Preserve the previous successful IP if the DDNS update fails. -* Record successful and failed update attempts in an append-only history log. -* Exit with an appropriate non-zero status when the monitor cannot complete its operation. - -### Learning Goals - -The project should provide practical exposure to: - -* Rust project structure and Cargo. -* Structs and enums. -* `Option` and `Result`. -* Ownership and borrowing. -* Traits. -* Generics. -* Dependency injection through constructor parameters. -* Error propagation with `?`. -* File I/O. -* JSON serialization. -* HTTP clients. -* Subprocess execution. -* Unit testing. +See [`ROADMAP.md`](./ROADMAP.md) for the full plan. --- -## Core Architecture +## Quick Start (development) -The application should separate orchestration from infrastructure. +Prerequisites: Nix with flakes enabled. -```text - ┌───────────────┐ - │ main.rs │ - │ composition │ - │ root │ - └───────┬───────┘ - │ - ▼ - ┌───────────────┐ - │ IpMonitorService │ - │ application │ - │ logic │ - └───────┬───────┘ - │ - ┌─────────────┼─────────────┐ - ▼ ▼ ▼ - IpResolver StateRepository DdnsUpdater - │ │ │ - ▼ ▼ ▼ - HTTP JSON systemctl +```bash +# Enter the development shell (downloads pinned Rust toolchain) +nix develop - │ - ▼ - HistoryRepository - │ - ▼ - JSONL -``` +# Build +cargo build -The application service should contain the decision-making logic. +# Run tests +cargo nextest run -Infrastructure components should contain external concerns such as: - -* HTTP. -* Filesystem access. -* JSON serialization. -* Subprocess execution. -* systemd interaction. - ---- - -## Main Entities - -### MonitorState - -Represents the persisted state of the monitor. - -```text -MonitorState -├── last_provider_index: Option -└── last_ip: Option -``` - -`last_ip` represents the last public IP for which a DDNS update completed successfully. - -It must not be updated merely because a new IP was discovered. - ---- - -### IpDiscoveryResult - -Represents a successful public IP discovery. - -```text -IpDiscoveryResult -├── ip: Ipv4Addr -├── provider: String -└── provider_index: usize +# Live-reload on save +cargo watch -x check ``` --- -### HistoryEntry +## Architecture (target) -Represents an event recorded for observability. - -```text -HistoryEntry -├── timestamp -├── ip -├── status -└── details +``` +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 history log is an audit trail, not the primary source of runtime state. +The application service contains all decision logic. Infrastructure components (HTTP, fs, +subprocess) are hidden behind traits and swappable in tests. --- -## Roles and Responsibilities +## Configuration -### IpMonitorService +The binary reads from (in priority order): -Responsible for the application's core workflow. +1. NixOS module options (declarative, build-time injection) +2. `~/.config/ddns-monitor/config.toml` (runtime, for non-NixOS) -It should: +Example: -1. Load persisted state. -2. Determine which provider should be queried next. -3. Discover the current public IP. -4. Compare it with the previous successful IP. -5. Exit without updating if the IP is unchanged. -6. Trigger the DDNS updater if the IP changed. -7. Persist the new IP only after a successful update. -8. Record the update result. +```toml +[ip_providers] +urls = [ + "https://api.ipify.org", + "https://ifconfig.me/ip", + "https://icanhazip.com", +] +timeout_secs = 5 -It should not know: - -* how HTTP requests are performed, -* how JSON files are read, -* how systemctl is invoked. - ---- - -### IpResolver - -Responsible for discovering a public IPv4 address. - -Responsibilities: - -* Query configured providers. -* Start with the requested provider index. -* Fall back through remaining providers if necessary. -* Validate returned addresses. -* Return information about the successful provider. - ---- - -### StateRepository - -Responsible for persistent monitor state. - -Responsibilities: - -* Load state. -* Save state atomically. -* Report persistence failures. - -The state repository is the authoritative source of the monitor's runtime state. - ---- - -### HistoryRepository - -Responsible for recording monitor events. - -Responsibilities: - -* Append successful update events. -* Append failed update events. - -The history log must not control normal application decisions. - ---- - -### DdnsUpdater - -Responsible for triggering the existing DDNS mechanism. - -The initial implementation will invoke: - -```text -systemctl start --wait ddclient.service +[[subscribers]] +provider = "dynu" +domain = "example.dyndns.org" +credentials_env = "DYNU_PASSWORD" ``` -A successful invocation should represent a successful completion of the configured DDNS service. - -The exact semantics of `ddclient.service` should be verified during NixOS integration. +> **Never store plaintext credentials in `config.toml`.** Use env vars or sops-nix secrets. --- -## Core Workflow +## NixOS -```text -START - │ - ▼ -Load MonitorState - │ - ▼ -Select next IP provider - │ - ▼ -Discover public IPv4 - │ - ├── Failure - │ │ - │ ▼ - │ Try fallback providers - │ - └── Success - │ - ▼ -Compare with last_ip - │ - ├── Same - │ │ - │ ▼ - │ Save provider rotation state - │ │ - │ ▼ - │ EXIT 0 - │ - └── Different / first run - │ - ▼ - Trigger DDNS update - │ - ├── Failure - │ │ - │ ▼ - │ Record failure - │ │ - │ ▼ - │ Keep previous last_ip - │ │ - │ ▼ - │ EXIT != 0 - │ - └── Success - │ - ▼ - Update last_ip - │ - ▼ - Persist state - │ - ▼ - Record success - │ - ▼ - EXIT 0 -``` +The NixOS module (Phase 8) will: + +- Build the binary as a Nix derivation. +- Expose `services.ddns-monitor.subscribers` as a list of option sets. +- Inject credentials from `sops.secrets` via `LoadCredential`. +- Run as a oneshot systemd timer (30-minute default, configurable). --- -## Initial Technical Requirements - -The first implementation should use: - -* Rust stable. -* Cargo. -* A synchronous HTTP client. -* JSON for persistent state. -* JSON Lines for history. -* `std::process::Command` for systemd integration. - -Likely dependencies: - -```text -serde -serde_json -reqwest -thiserror -``` - -Async execution is intentionally not required for the first version. - ---- - -## Non-Goals - -The first version should not include: - -* A web API. -* A GUI. -* A database. -* Authentication. -* Direct Dynu API integration. -* IPv6 support. -* Async networking. -* Concurrent provider queries. -* A dependency injection framework. -* A plugin system. -* Provider auto-discovery. -* Configuration hot reloading. - -The project should remain a small system utility. - ---- - -## Important Invariants - -The following rules should remain true throughout the project: - -1. `last_ip` means the last IP successfully submitted through the DDNS update process. - -2. Discovering an IP does not modify `last_ip`. - -3. A failed DDNS update must leave `last_ip` unchanged. - -4. The monitor should not trigger DDNS when the discovered IP matches `last_ip`. +## Invariants +1. `last_ip` = the IP from the last fully successful fan-out (all subscribers succeeded). +2. Discovering an IP does **not** update `last_ip`. +3. A partial or total update failure leaves `last_ip` unchanged. +4. The monitor does not fire DDNS when the discovered IP matches `last_ip`. 5. Provider rotation state may be persisted independently of IP changes. - -6. Infrastructure implementations should be replaceable in tests. +6. All infrastructure dependencies are injectable via traits (testable without network/fs). --- -## Suggested Implementation Milestones - -### Milestone 1 — Domain - -Implement: - -* `MonitorState`. -* `IpDiscoveryResult`. -* IPv4 parsing and validation. -* Provider rotation logic. - -No external dependencies. - -### Milestone 2 — State - -Add: - -* JSON serialization. -* `StateRepository`. -* Atomic state persistence. - -### Milestone 3 — Application - -Implement: - -* Traits for dependencies. -* `IpMonitorService`. -* Fake implementations for unit tests. - -### Milestone 4 — HTTP - -Implement: - -* HTTP-based `IpResolver`. -* Provider fallback. -* Timeouts. - -### Milestone 5 — DDNS - -Implement: - -* `SystemdDdnsUpdater`. -* Subprocess error handling. - -### Milestone 6 — History - -Implement: - -* JSONL history. -* Success and failure event recording. - -### Milestone 7 — NixOS Integration - -Replace the existing Python monitor with the Rust binary and verify: - -* Timer execution. -* State persistence. -* DDNS triggering. -* Failure recovery. - ---- - -## Definition of Done - -The first usable version is complete when: - -* The binary can be executed manually. -* It can discover the machine's public IPv4 address. -* It persists monitor state. -* Repeated execution with the same IP does not invoke `ddclient`. -* A changed IP invokes `ddclient.service`. -* A failed DDNS update does not overwrite the previous successful IP. -* Provider failures fall back to another provider. -* Core application behavior is covered by unit tests without real HTTP, filesystem, or systemd dependencies. -* The binary can replace the existing Python implementation in the NixOS configuration. - +## License +[Unlicense](./UNLICENSE) — public domain. diff --git a/ROADMAP.md b/ROADMAP.md new file mode 100644 index 0000000..eb86b62 --- /dev/null +++ b/ROADMAP.md @@ -0,0 +1,379 @@ +# ddns-monitor — Project ROADMAP + +> [!NOTE] +> This document supersedes the `dynu-monitor` README. The project is being renamed and +> broadened from a single-provider Dynu wrapper into a generic, provider-agnostic DDNS +> monitor with a plugin architecture. + +--- + +## What Already Exists + +| File | What it does | +|---|---| +| [`nixos/scripts/monitor.py`](file:///home/kiskaadee/Homelab/Core/nixos/scripts/monitor.py) | Python prototype — round-robins IP providers, compares to history, fires `ddclient` | +| [`nixos/modules/dynu.nix`](file:///home/kiskaadee/Homelab/Core/nixos/modules/dynu.nix) | NixOS module wiring monitor.py + ddclient + sops secrets via systemd oneshot timer | +| [`src/main.rs`](file:///home/kiskaadee/Projects/active/ddns-monitor/src/main.rs) | Rust scaffold — placeholder `main()` | +| [`src/models.rs`](file:///home/kiskaadee/Projects/active/ddns-monitor/src/models.rs) | Draft structs: `MonitorState`, `IpDiscoveryResult` (syntax error present) | +| `README.md` | Architecture blueprint for a single-provider Rust rewrite (good bones, narrower scope) | + +**Root cause of today's outage:** Dynu API went down (data corruption incident). The monitor +currently couples the IP-check layer *and* the update-submission layer to a single provider +ecosystem. If Dynu is unreachable, the entire update chain breaks regardless of what the IP +checkers report. + +--- + +## Motivation for the Redesign + +The Python script already solves the **IP-detection** problem well. What it lacks is: + +1. **Provider independence for updates** — it delegates to `ddclient`, which is Dynu-specific. +2. **Fan-out** — one IP change must notify *all* configured domains, possibly across different + DDNS providers or multiple accounts on the same provider. +3. **Resilience** — if one DDNS provider is down, others should still be notified. +4. **NixOS portability + non-FSH Linux support** — the binary should be usable on both. +5. **No runtime Python dep** — a statically linked Rust binary compiles cleanly into a + Nix derivation and works on non-NixOS systems without a Python interpreter. + +--- + +## Target Architecture + +```mermaid +flowchart TD + A["main.rs\nComposition Root"] --> B["IpMonitorService\nApplication Logic"] + B --> C["IpResolver\nRound-Robin IP Check"] + B --> D["StateRepository\nJSON State"] + B --> E["NotificationBus\nFan-out dispatcher"] + E --> F1["DynuPlugin\nDDNS Updater"] + E --> F2["CloudflarePlugin\nDDNS Updater"] + E --> F3["«future»\nAny provider"] + C --> G1["api.ipify.org"] + C --> G2["ifconfig.me"] + C --> G3["icanhazip.com"] + D --> H["~/.config/ddns-monitor/state.json\nor /var/lib/ddns-monitor/"] + B --> I["HistoryRepository\nJSONL audit log"] +``` + +### Separation of Concerns + +| Layer | Responsibility | Knows about | +|---|---|---| +| **IpMonitorService** | Orchestration & decisions | Traits only | +| **IpResolver** | WAN IP discovery + rotation | HTTP | +| **StateRepository** | Persisted last-known-good IP | JSON / fs | +| **NotificationBus** | Fan-out to all subscribers | Vec of `DdnsUpdater` | +| **DdnsUpdater trait** | Contract for one provider plugin | Nothing external | +| **DynuUpdater** | Dynu HTTP API v2 | reqwest | +| **CloudflareUpdater** | Cloudflare DNS API | reqwest | +| **HistoryRepository** | Append-only audit trail | JSONL / fs | + +--- + +## Core Entities + +### MonitorState +```text +MonitorState +├── last_provider_index: Option -- which IP-check provider goes next +└── last_ip: Option -- IP from last *fully successful* update round +``` +`last_ip` advances only when **every** subscriber in the notification bus reports success. + +--- + +### DdnsUpdater (trait — the plugin contract) +```text +DdnsUpdater +├── name() -> &str +└── update(ip: Ipv4Addr) -> Result<(), UpdateError> +``` +All provider-specific HTTP, auth, and retry logic lives behind this trait. + +--- + +### SubscriberConfig (from config file or NixOS options) +```text +SubscriberConfig +├── provider: String -- "dynu" | "cloudflare" | ... +├── domain: String +└── credentials: ... -- per-provider fields +``` + +--- + +### IpDiscoveryResult +```text +IpDiscoveryResult +├── ip: Ipv4Addr +├── provider: String -- which checker responded +└── provider_index: usize -- for rotation persistence +``` + +--- + +### HistoryEntry +```text +HistoryEntry +├── timestamp: DateTime +├── ip: Ipv4Addr +├── subscribers: Vec -- one record per provider +└── overall_status: "success" | "partial" | "failed" +``` + +--- + +## Update Semantics + +> [!IMPORTANT] +> **Partial success rule:** if 3 of 4 subscribers succeed and 1 fails, `last_ip` is **not** +> updated. The next cycle will retry all subscribers. This is conservative: a transient +> failure on one subscriber won't cause the other three to re-update unnecessarily on +> subsequent cycles because `last_ip` hasn't advanced. +> +> This is a deliberate trade-off. An alternative (advance `last_ip` per-subscriber) is more +> complex and deferred to a future enhancement. + +--- + +## Core Workflow + +```mermaid +flowchart TD + S([START]) --> LD[Load MonitorState] + LD --> IP[Discover WAN IP\nRound-robin provider] + IP -->|All fail| XF([EXIT 1]) + IP -->|Success| CMP{IP == last_ip?} + CMP -->|Same| ROT[Save rotation index] + ROT --> X0([EXIT 0]) + CMP -->|Different or first run| FAN[Fan-out to all subscribers] + FAN --> RES{All succeeded?} + RES -->|Yes| UPD[Update last_ip\nPersist state\nLog success] + UPD --> X0 + RES -->|Partial or all failed| LOG[Log partial/failure\nKeep last_ip unchanged] + LOG --> X1([EXIT 1]) +``` + +--- + +## Configuration + +The service should accept configuration from two sources, in priority order: + +1. **NixOS module options** (declarative, build-time) +2. **`~/.config/ddns-monitor/config.toml`** (runtime, for non-NixOS) + +```toml +# Example config.toml +[ip_providers] +urls = [ + "https://api.ipify.org", + "https://ifconfig.me/ip", + "https://icanhazip.com", +] +timeout_secs = 5 + +[[subscribers]] +provider = "dynu" +domain = "roadtotech.me" +credentials_env = "DYNU_PASSWORD" # or path to a secrets file + +[[subscribers]] +provider = "dynu" +domain = "backupserver.me" +credentials_env = "DYNU_PASSWORD_2" + +# future +# [[subscribers]] +# provider = "cloudflare" +# domain = "example.com" +# zone_id = "..." +``` + +> [!NOTE] +> Credentials should never be stored in the config file in plaintext. On NixOS, sops-nix +> provides secrets via environment or file. On non-NixOS, the binary accepts env var names +> or secret-file paths. + +--- + +## NixOS Integration Target + +Replace `dynu.nix` with a new module that: + +- Builds `ddns-monitor` as a Nix derivation (native Rust build) +- Exposes `services.ddns-monitor.subscribers` as a list of NixOS option sets +- Injects credentials from `sops.secrets` via systemd `LoadCredential` +- Runs as a oneshot systemd timer (same 30-minute cadence, configurable) +- **Does not depend on `ddclient`** — the binary calls provider APIs directly + +--- + +## Implementation Phases + +### Phase 0 — Cleanup & Rename *(Now)* +- [ ] Fix syntax error in `models.rs` +- [ ] Rename crate from `dynu-monitor` to `ddns-monitor` in `Cargo.toml` +- [ ] Add `Cargo.toml` dependencies: `serde`, `serde_json`, `toml`, `reqwest` (blocking), `thiserror` +- [ ] Stub out module tree: `domain/`, `infra/`, `config.rs`, `plugins/` + +--- + +### Phase 1 — Domain Layer +*No external dependencies. Pure Rust types and logic.* + +- [ ] `MonitorState` with correct types (`Option`, `Option`) +- [ ] `IpDiscoveryResult` +- [ ] `HistoryEntry` + `SubscriberResult` +- [ ] IPv4 public-address validation (port Python's RFC-aware logic) +- [ ] Provider rotation logic (next index from state) +- [ ] `DdnsUpdater` trait +- [ ] `UpdateError` enum with `thiserror` +- [ ] Unit tests: rotation, validation, state transitions + +**Learning targets:** structs, enums, `Option`, traits, `Result`, unit tests + +--- + +### Phase 2 — Configuration +*Parse config file and build subscriber list.* + +- [ ] `Config` struct with `serde` + `toml` +- [ ] `SubscriberConfig` with per-provider credential resolution (env var → file → error) +- [ ] NixOS module integration stubs (paths, env vars, state dir) +- [ ] Unit tests: config parsing, credential resolution errors + +**Learning targets:** `serde`, generics, `Result` propagation with `?` + +--- + +### Phase 3 — Application Service +*Wire domain + config into orchestration logic.* + +- [ ] `IpMonitorService` struct taking trait objects +- [ ] Full workflow (load → discover → compare → fan-out → persist → log) +- [ ] In-memory fake implementations for all trait dependencies +- [ ] Integration-style unit tests: no HTTP, no fs, no systemd + +**Learning targets:** dependency injection via traits, `Box`, borrowing, lifetime basics + +--- + +### Phase 4 — IP Resolution (HTTP) +*Real network calls.* + +- [ ] `HttpIpResolver` using blocking `reqwest` +- [ ] Timeout configuration +- [ ] Provider fallback loop +- [ ] Address validation on response +- [ ] Unit tests: mock server or `mockito` + +**Learning targets:** HTTP clients, blocking async in Rust, error propagation + +--- + +### Phase 5 — State & History (Filesystem) +*Persistent JSON state and JSONL audit log.* + +- [ ] `JsonStateRepository`: atomic write (write-to-tmp → rename) +- [ ] `JsonlHistoryRepository`: append-only writes +- [ ] State directory creation (respects `StateDirectory=` systemd or XDG on non-NixOS) +- [ ] Unit tests: serialization round-trips, atomic write behavior + +**Learning targets:** file I/O, `serde_json`, atomic FS patterns + +--- + +### Phase 6 — Dynu Plugin +*First real DDNS provider.* + +- [ ] `DynuUpdater` implementing `DdnsUpdater` +- [ ] Calls Dynu HTTP API v2 directly (no ddclient) +- [ ] Credential loading from env / sops file +- [ ] Parses Dynu API response to confirm success +- [ ] Unit tests with mocked HTTP + +> [!NOTE] +> The Python script currently goes through `ddclient`. This phase eliminates that dependency. +> The Dynu API is simple: a single HTTPS GET with credentials and the new IP in query params. + +--- + +### Phase 7 — Fan-out & NotificationBus +*Multiple subscribers.* + +- [ ] `NotificationBus` iterating all configured `DdnsUpdater`s +- [ ] Collects per-subscriber results +- [ ] Applies partial-success rule (all-or-nothing `last_ip` advance) +- [ ] Integration test: 1 success + 1 failure → state unchanged + +--- + +### Phase 8 — NixOS Module Rewrite +*Replace dynu.nix.* + +- [ ] New `ddns-monitor.nix` module with subscriber list options +- [ ] Rust binary as Nix derivation (via `rustPlatform.buildRustPackage`) +- [ ] Credential injection via `LoadCredential` + sops-nix +- [ ] Timer configuration (interval, boot delay) +- [ ] Smoke test on homelab server + +--- + +### Phase 9 — Non-NixOS Support *(stretch)* +*Make it usable on Debian/Arch/etc.* + +- [ ] XDG config dir fallback (`~/.config/ddns-monitor/`) +- [ ] State dir fallback (`~/.local/share/ddns-monitor/` or `/var/lib/ddns-monitor/`) +- [ ] `systemd.service` unit file (generic, for non-NixOS install) +- [ ] Install instructions for manual systemd setup + +--- + +### Phase 10 — Additional Providers *(stretch)* + +- [ ] `CloudflareUpdater` +- [ ] `DuckDNSUpdater` +- [ ] Provider auto-detection from config `provider =` field +- [ ] Consider: compile-time feature flags per provider + +--- + +## What This Project Is NOT (in scope now) + +- No GUI or web API +- No IPv6 (explicitly deferred) +- No async networking (blocking reqwest is fine for a oneshot binary) +- No hot config reloading +- No concurrent provider queries +- No database +- No authentication layer on the binary itself + +--- + +## Definition of Done (Phase 6 complete = "v1 usable") + +- [ ] Binary discovers WAN IP via rotating providers +- [ ] Persists state across executions +- [ ] Detects IP changes correctly +- [ ] Calls Dynu API directly (no ddclient dependency) +- [ ] Notifies all configured subscribers on change +- [ ] Leaves `last_ip` unchanged on any subscriber failure +- [ ] Core logic is fully covered by unit tests (no real HTTP / fs / network) +- [ ] NixOS module replaces `dynu.nix` and `monitor.py` +- [ ] Tested live on homelab server + +--- + +## Open Questions + +1. **Partial success policy** — should `last_ip` advance per-subscriber (more complex, avoids + duplicate updates on retry) or stay all-or-nothing (simpler, may cause harmless re-updates)? + Current plan: all-or-nothing. Revisit after Phase 7. + +2. **Binary distribution** — Nix derivation is the primary path. Should a static musl build + also be published for non-NixOS users? + +3. **Credential model** — env var → file → error is the current plan. Should we also support + a `pass` / `age`-encrypted file directly? diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..3f40993 --- /dev/null +++ b/flake.nix @@ -0,0 +1,121 @@ +{ + description = "ddns-monitor — provider-agnostic DDNS monitor with plugin architecture"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + # Pinned Rust toolchain — gives us stable + clippy + rustfmt + rust-analyzer + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, rust-overlay, ... }: + let + system = "x86_64-linux"; + + pkgs = import nixpkgs { + inherit system; + overlays = [ rust-overlay.overlays.default ]; + }; + + # Pin to stable Rust. Edit the date to roll forward. + # rustc, cargo, clippy, rustfmt, and rust-analyzer are all included. + rustToolchain = pkgs.rust-bin.stable.latest.default.override { + extensions = [ "rust-src" "rust-analyzer" "clippy" "rustfmt" ]; + }; + + # Shared native build inputs used by both the devShell and the package + nativeBuildInputs = with pkgs; [ + rustToolchain + pkg-config + ]; + + # Runtime / link-time dependencies + buildInputs = with pkgs; [ + openssl # reqwest TLS backend + ]; + + in + { + # ── Development shell ───────────────────────────────────────────────────── + # Enter with: nix develop + devShells.${system}.default = pkgs.mkShell { + inherit nativeBuildInputs buildInputs; + + packages = with pkgs; [ + # Linting & formatting (also available via rustToolchain, listed + # here for clarity) + cargo-watch # cargo watch -x check -- live recompile on save + cargo-nextest # faster test runner (drop-in for cargo test) + + # Dependency auditing + cargo-audit + + # Useful during DDNS API development + curl + jq + ]; + + # Point OpenSSL build scripts at the Nix store paths + OPENSSL_NO_VENDOR = "1"; + PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; + + shellHook = '' + echo "" + echo " ddns-monitor dev shell" + echo " ─────────────────────────────────────────────" + echo " rustc $(rustc --version)" + echo " cargo $(cargo --version)" + echo "" + echo " Useful commands:" + echo " cargo build compile the binary" + echo " cargo test run unit tests" + echo " cargo nextest run run tests with nextest" + echo " cargo watch -x check live check on save" + echo " cargo audit scan dependencies for CVEs" + echo " cargo clippy lint" + echo " cargo fmt format" + echo "" + ''; + }; + + # ── Package ─────────────────────────────────────────────────────────────── + # Build the binary: nix build + packages.${system} = rec { + ddns-monitor = pkgs.rustPlatform.buildRustPackage { + pname = "ddns-monitor"; + version = "0.1.0"; + src = ./.; + + # Update this hash after running: nix build 2>&1 | grep "got:" + cargoHash = pkgs.lib.fakeHash; + + inherit nativeBuildInputs buildInputs; + + meta = with pkgs.lib; { + description = "Provider-agnostic DDNS monitor with plugin architecture"; + license = licenses.unlicense; + maintainers = [ ]; + }; + }; + + default = ddns-monitor; + }; + + # ── Checks ──────────────────────────────────────────────────────────────── + # Run with: nix flake check + checks.${system} = { + # cargo test inside a sandbox — proves tests pass without network/fs + cargo-test = pkgs.rustPlatform.buildRustPackage { + pname = "ddns-monitor-tests"; + version = "0.1.0"; + src = ./.; + cargoHash = pkgs.lib.fakeHash; + inherit nativeBuildInputs buildInputs; + doCheck = true; + }; + }; + }; +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..1b58215 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,10 @@ +mod models; + +fn main() { + env_logger::init(); + log::info!("ddns-monitor starting"); + + // TODO (Phase 3): wire IpMonitorService and run the full workflow. + eprintln!("ddns-monitor: not yet implemented"); + std::process::exit(1); +} diff --git a/src/models.rs b/src/models.rs new file mode 100644 index 0000000..27c6a89 --- /dev/null +++ b/src/models.rs @@ -0,0 +1,25 @@ +use std::net::Ipv4Addr; + +/// Persisted state of the monitor. +/// +/// Loaded at startup and saved after each successful update cycle. +/// `last_ip` is the IP address from the last *fully successful* fan-out — +/// it is not updated merely because a new IP was discovered. +#[derive(Debug, Clone, Default)] +pub struct MonitorState { + /// Index of the IP-check provider to query on the next run. + pub last_provider_index: Option, + /// Public IP address from the last successfully completed DDNS update. + pub last_ip: Option, +} + +/// Result of a successful public IP discovery. +#[derive(Debug, Clone)] +pub struct IpDiscoveryResult { + /// The discovered public IPv4 address. + pub ip: Ipv4Addr, + /// Display name of the provider that responded. + pub provider: String, + /// Index of the provider in the configured list (for rotation persistence). + pub provider_index: usize, +}