From cea3d66cdd8f6ce9df1a2947fba83fb6cccffbe4 Mon Sep 17 00:00:00 2001 From: Vantz Stockwell Date: Thu, 11 Jun 2026 10:02:46 -0400 Subject: [PATCH] =?UTF-8?q?feat(host-agent):=20Rust=20rewrite=20Phase=200?= =?UTF-8?q?=20=E2=80=94=20multi-instance=20foundation,=20v2=20wire=20proto?= =?UTF-8?q?col,=20real=20telemetry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New corrosion-host-agent/ crate (Go companion-agent stays as behavior reference until parity). Wire protocol v2 per COA-B: instance-scoped subjects corrosion.{license}.{instance}.* + host-level .host.* — spec in PROTOCOL.md, designed for the license->host->instance fleet model. - Multi-instance TOML config in the foundation, not retrofitted - NATS layer on the Vigilance production profile (infinite reconnect, capped backoff, 30s ping, 8192-msg offline buffer) - Heartbeat with real sysinfo telemetry — Go agent shipped hardcoded disk/cpu placeholders; this is the panel's first true Resources data - Connectivity prober (outbound TCP, periodic + on-demand) - Host cmd channel (ping/probe/sysinfo), going-offline beacon, CancellationToken shutdown - Live-fire verified against production NATS; artifacts: 3.7MB static linux-musl, 3.8MB windows .exe (static CRT) Co-Authored-By: Claude Fable 5 --- CHANGELOG.md | 15 + corrosion-host-agent/.cargo/config.toml | 22 + corrosion-host-agent/.gitignore | 1 + corrosion-host-agent/Cargo.lock | 2100 +++++++++++++++++++++++ corrosion-host-agent/Cargo.toml | 36 + corrosion-host-agent/PROTOCOL.md | 143 ++ corrosion-host-agent/README.md | 36 + corrosion-host-agent/agent.example.toml | 39 + corrosion-host-agent/build.rs | 21 + corrosion-host-agent/src/agent.rs | 16 + corrosion-host-agent/src/bus.rs | 58 + corrosion-host-agent/src/config.rs | 186 ++ corrosion-host-agent/src/hostcmd.rs | 115 ++ corrosion-host-agent/src/main.rs | 168 ++ corrosion-host-agent/src/prober.rs | 121 ++ corrosion-host-agent/src/subjects.rs | 30 + corrosion-host-agent/src/telemetry.rs | 175 ++ corrosion-host-agent/src/version.rs | 10 + 18 files changed, 3292 insertions(+) create mode 100644 corrosion-host-agent/.cargo/config.toml create mode 100644 corrosion-host-agent/.gitignore create mode 100644 corrosion-host-agent/Cargo.lock create mode 100644 corrosion-host-agent/Cargo.toml create mode 100644 corrosion-host-agent/PROTOCOL.md create mode 100644 corrosion-host-agent/README.md create mode 100644 corrosion-host-agent/agent.example.toml create mode 100644 corrosion-host-agent/build.rs create mode 100644 corrosion-host-agent/src/agent.rs create mode 100644 corrosion-host-agent/src/bus.rs create mode 100644 corrosion-host-agent/src/config.rs create mode 100644 corrosion-host-agent/src/hostcmd.rs create mode 100644 corrosion-host-agent/src/main.rs create mode 100644 corrosion-host-agent/src/prober.rs create mode 100644 corrosion-host-agent/src/subjects.rs create mode 100644 corrosion-host-agent/src/telemetry.rs create mode 100644 corrosion-host-agent/src/version.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b5c3fd..1bdccf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Added (Corrosion Host Agent — Rust rewrite Phase 0 — 2026-06-11) + +**New: `corrosion-host-agent/`** — Rust rewrite of the Go companion agent (which stays in-tree as the behavior reference until parity). Wire protocol v2 (COA-B, Commander-approved): instance-scoped subjects `corrosion.{license}.{instance}.*` with host-level `corrosion.{license}.host.*` — full spec in `corrosion-host-agent/PROTOCOL.md`. + +- Multi-instance TOML config baked into the foundation (one agent supervises N game instances; rust/conan/soulmask/dune), env overrides for secrets, strict validation (subject-safe ids, reserved segments) +- NATS layer with the production-proven Vigilance profile: infinite reconnect w/ capped backoff, 30s ping, 8192-msg offline send buffer, `tls://` scheme support +- Host heartbeat with REAL telemetry via sysinfo (CPU/mem/disks/per-instance state) — the Go agent hardcoded disk=50000MB and cpu=0.0; this is the first true Resources data +- Connectivity prober (outbound TCP + latency, periodic jittered + on-demand) — first piece of the support-triage story +- Host command channel (`ping`/`probe`/`sysinfo`, request-reply), going-offline beacon, CancellationToken graceful shutdown +- Version embedding (semver + git hash + build ts) in `--version` and every heartbeat +- Verified live against production NATS: connected, heartbeats published, clean shutdown +- Deploy artifacts verified: 3.7MB fully-static linux-musl binary, 3.8MB windows .exe (static CRT, no VC++ redist needed) + +**Next phases**: 1 = process-class adapter (spawn/RCON/SteamCMD/files for Rust/Conan/Soulmask) + NestJS v2 heartbeat consumer; 2 = Dune Docker adapter; 3 = signed self-update (release gate) + service install. + ### Fixed (Site Audit — Fake Data, Resilience, Fonts — 2026-06-11) **Frontend:** diff --git a/corrosion-host-agent/.cargo/config.toml b/corrosion-host-agent/.cargo/config.toml new file mode 100644 index 0000000..e83c612 --- /dev/null +++ b/corrosion-host-agent/.cargo/config.toml @@ -0,0 +1,22 @@ +# Corrosion Host Agent — cross-compilation configuration +# +# Deploy targets: +# Linux: x86_64-unknown-linux-musl (fully static — runs on any distro) +# Windows: x86_64-pc-windows-msvc (build via `cargo xwin build` on non-Windows) +# +# Prerequisites on macOS: +# brew install filosottile/musl-cross/musl-cross (x86_64-linux-musl-gcc) +# cargo install cargo-xwin (bundles MSVC CRT + lld-link) + +[target.x86_64-unknown-linux-musl] +linker = "x86_64-linux-musl-gcc" + +[env] +CC_x86_64_unknown_linux_musl = "x86_64-linux-musl-gcc" + +[target.x86_64-pc-windows-msvc] +linker = "lld-link" +# Statically link the MSVC CRT so the agent runs on fresh Windows installs +# without the Visual C++ Redistributable (otherwise: STATUS_DLL_NOT_FOUND on +# any machine missing VCRUNTIME140.dll — most fresh OEM images). +rustflags = ["-C", "target-feature=+crt-static"] diff --git a/corrosion-host-agent/.gitignore b/corrosion-host-agent/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/corrosion-host-agent/.gitignore @@ -0,0 +1 @@ +/target diff --git a/corrosion-host-agent/Cargo.lock b/corrosion-host-agent/Cargo.lock new file mode 100644 index 0000000..8af7393 --- /dev/null +++ b/corrosion-host-agent/Cargo.lock @@ -0,0 +1,2100 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[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 0.61.2", +] + +[[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 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "async-nats" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3bdd6ea595b2ea504500a3566071beb81125fc15d40a6f6bffa43575f64152" +dependencies = [ + "base64", + "bytes", + "futures", + "memchr", + "nkeys", + "nuid", + "once_cell", + "portable-atomic", + "rand", + "regex", + "ring", + "rustls-native-certs", + "rustls-pemfile", + "rustls-webpki 0.102.8", + "serde", + "serde_json", + "serde_nanos", + "serde_repr", + "thiserror", + "time", + "tokio", + "tokio-rustls", + "tokio-util", + "tracing", + "tryhard", + "url", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + +[[package]] +name = "bitflags" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" +dependencies = [ + "serde", +] + +[[package]] +name = "cc" +version = "1.2.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "556e016178bb5662a08681bbe0f00f8e17631781a4dfc8c45e466e4b185ec27f" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "clap" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "corrosion-host-agent" +version = "2.0.0-alpha.1" +dependencies = [ + "anyhow", + "async-nats", + "chrono", + "clap", + "futures", + "rand", + "serde", + "serde_json", + "sysinfo", + "tokio", + "tokio-util", + "toml", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "rustc_version", + "subtle", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "data-encoding" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4ae5f15dda3c708c0ade84bfee31ccab44a3da4f88015ed22f63732abe300c8" + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +dependencies = [ + "powerfmt", + "serde_core", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "displaydoc" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek", + "ed25519", + "sha2", + "signature", + "subtle", +] + +[[package]] +name = "either" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[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" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-executor" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-macro" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core 0.62.2", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[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 = "js-sys" +version = "0.3.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2025f20d7a4fa7785846e7b63d10a76d3f1cee98ee5cb79ea59703f95e42162" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[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.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a" + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "memchr" +version = "2.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b947ae49db0d222b1dbc6b113ce7248a3fc3a6ca21b696717bfc000ba4484d8" + +[[package]] +name = "mio" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "nkeys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879011babc47a1c7fdf5a935ae3cfe94f34645ca0cac1c7f6424b36fc743d1bf" +dependencies = [ + "data-encoding", + "ed25519", + "ed25519-dalek", + "getrandom", + "log", + "rand", + "signatory", +] + +[[package]] +name = "ntapi" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3b335231dfd352ffb0f8017f3b6027a4917f7df785ea2143d8af2adc66980ae" +dependencies = [ + "winapi", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "nuid" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc895af95856f929163a0aa20c26a78d26bfdc839f51b9d5aa7a5b79e52b7e83" +dependencies = [ + "rand", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[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 = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[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 = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[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 = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "portable-atomic" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" + +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[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.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rayon" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +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 = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustls" +version = "0.23.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef86cd5876211988985292b91c96a8f2d298df24e75989a43a3c73f2d4d8168b" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki 0.103.13", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a7197ae7eb376e574fe940d068c30fe0462554a3ddbe4eca7838e049c937a9" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.102.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "schannel" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.150" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_nanos" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a93142f0367a4cc53ae0fead1bcda39e85beccfad3dcd717656cacab94b12985" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_repr" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "signatory" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1e303f8205714074f6068773f0e29527e0453937fe837c9717d066635b65f31" +dependencies = [ + "pkcs8", + "rand_core", + "signature", + "zeroize", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sysinfo" +version = "0.33.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fc858248ea01b66f19d8e8a6d55f41deaf91e9d495246fd01368d99935c6c01" +dependencies = [ + "core-foundation-sys", + "libc", + "memchr", + "ntapi", + "rayon", + "windows", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[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", +] + +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "time" +version = "0.3.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" + +[[package]] +name = "time-macros" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "futures-util", + "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 = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "tryhard" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fe58ebd5edd976e0fe0f8a14d2a04b7c81ef153ea9a54eebc42e67c2c23b4e5" +dependencies = [ + "pin-project-lite", + "tokio", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[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 = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.123" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a254a4b10c19a76f09a27640e7ffbf9bc30bf67e16a3bf28aaefa4920fe81563" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.123" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24a40fc75b0ec6f3746ceb10d36f53a93dcd68a93b11b6445983945d79eba0dc" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.123" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "908f34bd9b9ce3d4caf07b72dfab63d61504d156856c6bd3cd87fa350cf3985b" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.123" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7acbf7616c27b194bbb550bf77ed0c2c3e5b7fd1260a93082b95fb7f47959b92" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" +dependencies = [ + "windows-core 0.57.0", + "windows-targets", +] + +[[package]] +name = "windows-core" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" +dependencies = [ + "windows-implement 0.57.0", + "windows-interface 0.57.0", + "windows-result 0.1.2", + "windows-targets", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement 0.60.2", + "windows-interface 0.59.3", + "windows-link", + "windows-result 0.4.1", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[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 = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +dependencies = [ + "memchr", +] + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce1022995ff5ff5d841ad7d994facc23098cd40152f2c1d11cd607c6f530653f" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ae7f38b72ec2a254e2b87ef277cf2cd4fb97cbebf944faa6f33354da0867930" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[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.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zerotrie" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/corrosion-host-agent/Cargo.toml b/corrosion-host-agent/Cargo.toml new file mode 100644 index 0000000..f4dc8ec --- /dev/null +++ b/corrosion-host-agent/Cargo.toml @@ -0,0 +1,36 @@ +[package] +name = "corrosion-host-agent" +version = "2.0.0-alpha.1" +edition = "2021" +description = "Corrosion Host Agent — multi-game ops runtime for self-hosted game servers" +license = "UNLICENSED" +publish = false + +[[bin]] +name = "corrosion-host-agent" +path = "src/main.rs" + +[dependencies] +tokio = { version = "1", features = ["full"] } +tokio-util = { version = "0.7", features = ["rt"] } +futures = "0.3" +async-nats = "0.37" +serde = { version = "1", features = ["derive"] } +serde_json = "1" +toml = "0.8" +sysinfo = "0.33" +chrono = { version = "0.4", features = ["serde", "clock"] } +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] } +anyhow = "1" +clap = { version = "4.5", features = ["derive"] } +rand = "0.8" + +# Size-optimized release: single static binary living next to RAM-heavy game +# servers. Panic stays 'unwind' so a panicking task surfaces through its +# JoinHandle instead of killing the whole agent. +[profile.release] +opt-level = "s" +lto = true +codegen-units = 1 +strip = true diff --git a/corrosion-host-agent/PROTOCOL.md b/corrosion-host-agent/PROTOCOL.md new file mode 100644 index 0000000..99b609b --- /dev/null +++ b/corrosion-host-agent/PROTOCOL.md @@ -0,0 +1,143 @@ +# Corrosion Wire Protocol v2 + +Status: **Phase 0 implemented** (host heartbeat, host commands, going-offline +beacon). Per-instance command/status subjects are reserved and specified here +for Phase 1. + +## Design + +One **host agent** per machine supervises **N game instances**. Subjects are +scoped license-first, then by addressee: + +``` +corrosion.{license_id}.host.* host-level (the agent itself) +corrosion.{license_id}.{instance_id}.* instance-level (one game server) +``` + +`instance_id` is a config-defined slug (`[a-z0-9_-]{1,64}`), validated at +agent start. `host` is a reserved segment and can never be an instance id. +Payloads are JSON. Every heartbeat carries `"schema": 2` so consumers can +distinguish v2 from the legacy Go companion protocol (which used +`corrosion.{license_id}.companion.heartbeat`, no schema field). + +## Host-level subjects (Phase 0 — live) + +### `corrosion.{license_id}.host.heartbeat` (agent → backend, publish) + +Published every `heartbeat_seconds` (default 60, jittered ±20%). + +```json +{ + "schema": 2, + "timestamp": "2026-06-11T18:00:00Z", + "agent": { + "version": "2.0.0-alpha.1", + "commit": "a8722a7", + "os": "linux", + "arch": "x86_64", + "uptime_seconds": 86400 + }, + "host": { + "hostname": "asgard-01", + "cpu_percent": 12.5, + "cpu_cores": 80, + "mem_total_mb": 262144, + "mem_used_mb": 81920, + "uptime_seconds": 1209600, + "disks": [ + { "mount": "/", "total_mb": 1907729, "free_mb": 1532211 } + ] + }, + "instances": [ + { + "id": "rust-main", + "game": "rust", + "label": "Main 2x Vanilla", + "state": "configured", + "root_disk_free_mb": 1532211 + } + ], + "probe": { + "timestamp": "2026-06-11T17:58:00Z", + "results": [ + { "name": "corrosion-cdn", "host": "cdn.corrosionmgmt.com", "port": 443, "ok": true, "latency_ms": 18 } + ] + } +} +``` + +All telemetry is measured, never fabricated. Fields the agent cannot measure +are omitted (`probe` before the first probe completes, `hostname` if +unavailable). + +Phase 0 instance `state` values: `configured` (root path exists), +`missing_root`. Phase 1 adds live process states: `running`, `stopped`, +`crashed`, `starting`, `updating`. + +### `corrosion.{license_id}.host.cmd` (backend → agent, request-reply) + +Request: `{ "func": "" }`. Reply: `{ "status": "success" | "error", ... }`. + +| func | Reply payload | +| --------- | -------------------------------------------------------- | +| `ping` | `version`, `commit`, `uptime_seconds` | +| `probe` | `report` — fresh ProbeReport (also cached for heartbeat) | +| `sysinfo` | `snapshot` — full heartbeat payload, collected on demand | + +Unknown funcs return `status: "error"` with a message listing supported funcs. + +### `corrosion.{license_id}.host.going_offline` (agent → backend, publish) + +Best-effort beacon (500ms budget) on graceful shutdown so the panel can flip +the host to offline immediately instead of waiting out heartbeat staleness. +Payload: `{}`. + +## Instance-level subjects (Phase 1 — reserved, not yet implemented) + +### `corrosion.{license_id}.{instance_id}.cmd` (backend → agent, request-reply) + +Lifecycle and control for one game instance. Planned funcs: `start`, `stop`, +`restart`, `status`, `rcon` (process-class games), `steam_update`, +`oxide_install` (rust), plus game-adapter-specific commands (Dune: docker +lifecycle, RabbitMQ bus commands, Coriolis reset). + +### `corrosion.{license_id}.{instance_id}.status` (agent → backend, publish) + +State-change events (started/stopped/crashed) so the panel does not wait for +the next heartbeat. + +### `corrosion.{license_id}.{instance_id}.console` (agent → backend, publish) + +Live console/log lines for the panel console view. + +### `corrosion.{license_id}.{instance_id}.files.cmd` (backend → agent, request-reply) + +VueFinder-style file manager ops, jailed to the instance root. Carries over +the Go agent's jailed filemanager semantics (`fm_list`, `fm_save`, ...); the +legacy UNJAILED `files.get/put/delete/list` API is retired and will not be +ported. + +## Backend mapping notes (Phase 0) + +- The NestJS NATS bridge subscribes `corrosion.*.host.heartbeat` and + `corrosion.*.host.going_offline`. +- Until the license→host→instance schema lands, the backend may map the host + heartbeat onto the existing single `server_connections` row per license: + `companion_last_seen` ← heartbeat arrival, `connection_status` ← + connected/offline, resources ← `host.cpu_percent` / `mem_*` / first disk. + Instance-level mapping activates with the fleet schema. + +## Probing — scope honesty + +The Phase 0 prober measures **outbound** reachability from the host (TCP +connect + latency). It cannot verify **inbound** port-forwarding (the thing +players hit). Inbound verification requires a backend-side reverse probe +service that attempts connections to the customer's public IP/ports on +request; that is specified as a Phase 1+ feature and will reuse this report +format with `direction: "inbound"`. + +## Versioning + +- The agent embeds semver + git hash + build timestamp (`--version`, + heartbeat `agent` block). +- Schema changes bump `schema` and are additive where possible. diff --git a/corrosion-host-agent/README.md b/corrosion-host-agent/README.md new file mode 100644 index 0000000..907be60 --- /dev/null +++ b/corrosion-host-agent/README.md @@ -0,0 +1,36 @@ +# Corrosion Host Agent + +Rust rewrite of the Go companion agent (`companion-agent/`, retained as the +behavior reference until parity). One agent per machine supervises every game +instance on that host — Rust, Conan Exiles, Soulmask, Dune: Awakening. + +- **Wire protocol**: see [PROTOCOL.md](./PROTOCOL.md) (v2, instance-scoped subjects) +- **Config**: see [agent.example.toml](./agent.example.toml) + +## Status — Phase 0 + +- [x] Multi-instance TOML config + env overrides (`CORROSION_LICENSE_ID`, `CORROSION_NATS_URL`, `CORROSION_NATS_TOKEN`) +- [x] NATS connection (infinite reconnect, capped backoff, 30s ping, offline send-buffering, `tls://` support) +- [x] Host heartbeat with real telemetry (sysinfo: CPU, memory, disks) — no fabricated values +- [x] Connectivity prober (outbound TCP, periodic + on-demand) +- [x] Host command channel (`ping`, `probe`, `sysinfo`) +- [x] Graceful shutdown (cancellation token, going-offline beacon, NATS flush) +- [ ] Phase 1: process-class game adapter (spawn/RCON/SteamCMD/files) — Rust, Conan, Soulmask +- [ ] Phase 2: Dune Docker adapter (compose lifecycle, RabbitMQ bus, Postgres admin) +- [ ] Phase 3: signed self-update (enforced ed25519 — release gate), service install, supervisor split + +## Build + +```bash +cargo build --release # native +cargo build --release --target x86_64-unknown-linux-gnu # linux deploy target +cargo build --release --target x86_64-pc-windows-msvc # windows (cargo-xwin on non-Windows) +``` + +## Run + +```bash +corrosion-host-agent --config ./agent.toml # foreground +corrosion-host-agent --config ./agent.toml check # validate config only +corrosion-host-agent version # semver + git hash + build ts +``` diff --git a/corrosion-host-agent/agent.example.toml b/corrosion-host-agent/agent.example.toml new file mode 100644 index 0000000..1d6e8c9 --- /dev/null +++ b/corrosion-host-agent/agent.example.toml @@ -0,0 +1,39 @@ +# Corrosion Host Agent configuration +# Default location: /etc/corrosion/agent.toml (Linux) +# C:\ProgramData\Corrosion\agent.toml (Windows) +# Override with: corrosion-host-agent --config /path/to/agent.toml +# +# Secrets can come from the environment instead of this file: +# CORROSION_LICENSE_ID, CORROSION_NATS_URL, CORROSION_NATS_TOKEN + +[agent] +license_id = "your-license-uuid" +nats_url = "nats://nats.corrosionmgmt.com:4222" +# nats_token = "set-me-or-use-CORROSION_NATS_TOKEN" +heartbeat_seconds = 60 +log_level = "info" + +# One agent supervises every game instance on this host. +# Each instance gets a stable id (lowercase letters, digits, '-', '_') that +# the panel uses to address it. Changing an id orphans its panel history. + +[[instance]] +id = "rust-main" +game = "rust" # rust | conan | soulmask | dune +root = "/opt/rustserver" +label = "Main 2x Vanilla" + +# [[instance]] +# id = "soulmask-main" +# game = "soulmask" +# root = "/opt/soulmask/main" +# label = "Cloud Mist Forest (cluster main)" + +[prober] +interval_seconds = 300 + +# Extra outbound TCP checks beyond the built-in defaults: +# [[prober.target]] +# name = "steam-cdn" +# host = "steamcdn-a.akamaihd.net" +# port = 443 diff --git a/corrosion-host-agent/build.rs b/corrosion-host-agent/build.rs new file mode 100644 index 0000000..e2d4a0c --- /dev/null +++ b/corrosion-host-agent/build.rs @@ -0,0 +1,21 @@ +use std::process::Command; +use std::time::{SystemTime, UNIX_EPOCH}; + +fn main() { + let git_hash = Command::new("git") + .args(["rev-parse", "--short", "HEAD"]) + .output() + .ok() + .filter(|o| o.status.success()) + .map(|o| String::from_utf8_lossy(&o.stdout).trim().to_string()) + .unwrap_or_else(|| "unknown".to_string()); + + let build_ts = SystemTime::now() + .duration_since(UNIX_EPOCH) + .map(|d| d.as_secs()) + .unwrap_or(0); + + println!("cargo:rustc-env=CORROSION_GIT_HASH={git_hash}"); + println!("cargo:rustc-env=CORROSION_BUILD_TS={build_ts}"); + println!("cargo:rerun-if-changed=../.git/HEAD"); +} diff --git a/corrosion-host-agent/src/agent.rs b/corrosion-host-agent/src/agent.rs new file mode 100644 index 0000000..b706f4e --- /dev/null +++ b/corrosion-host-agent/src/agent.rs @@ -0,0 +1,16 @@ +//! Shared agent handle: every subsystem task holds an `Arc`. + +use std::time::Instant; +use tokio::sync::RwLock; +use tokio_util::sync::CancellationToken; + +use crate::config::Settings; +use crate::prober::ProbeReport; + +pub struct Agent { + pub cfg: Settings, + pub nats: async_nats::Client, + pub started: Instant, + pub last_probe: RwLock>, + pub shutdown: CancellationToken, +} diff --git a/corrosion-host-agent/src/bus.rs b/corrosion-host-agent/src/bus.rs new file mode 100644 index 0000000..03f441b --- /dev/null +++ b/corrosion-host-agent/src/bus.rs @@ -0,0 +1,58 @@ +//! NATS connection layer. +//! +//! Connection parameters follow the production-proven Vigilance profile: +//! infinite reconnects with capped exponential backoff, 30s pings to detect +//! zombie TCP in ~60s, and a deep client-side send queue so telemetry buffers +//! through broker outages instead of erroring. + +use anyhow::{Context, Result}; +use std::time::Duration; + +use crate::config::Settings; + +pub async fn connect(cfg: &Settings) -> Result { + let (url, force_tls) = normalize_url(&cfg.nats_url); + + let mut opts = async_nats::ConnectOptions::new() + .name("corrosion-host-agent") + .retry_on_initial_connect() + .max_reconnects(None) + .ping_interval(Duration::from_secs(30)) + .client_capacity(8192) + .reconnect_delay_callback(|attempts| { + Duration::from_millis(std::cmp::min(attempts as u64 * 100, 8_000)) + }) + .event_callback(|event| async move { + match event { + async_nats::Event::Disconnected => tracing::warn!("nats disconnected"), + async_nats::Event::Connected => tracing::info!("nats connected"), + other => tracing::debug!("nats event: {other}"), + } + }); + + if force_tls { + opts = opts.require_tls(true); + } + if let Some(token) = &cfg.nats_token { + opts = opts.token(token.clone()); + } + + let client = opts + .connect(&url) + .await + .with_context(|| format!("connecting to NATS at {url}"))?; + + Ok(client) +} + +/// Accept `tls://` / `nats+tls://` URL schemes by translating to `nats://` + +/// an explicit TLS requirement. +fn normalize_url(raw: &str) -> (String, bool) { + if let Some(rest) = raw.strip_prefix("tls://") { + (format!("nats://{rest}"), true) + } else if let Some(rest) = raw.strip_prefix("nats+tls://") { + (format!("nats://{rest}"), true) + } else { + (raw.to_string(), false) + } +} diff --git a/corrosion-host-agent/src/config.rs b/corrosion-host-agent/src/config.rs new file mode 100644 index 0000000..598affb --- /dev/null +++ b/corrosion-host-agent/src/config.rs @@ -0,0 +1,186 @@ +//! Agent configuration: TOML file + environment overrides. +//! +//! Multi-instance is foundational, not bolted on: one agent supervises N game +//! instances on the host, each declared as an `[[instance]]` block. Connection +//! secrets may come from env so the config file can be world-readable-ish +//! while the token is not. + +use anyhow::{bail, Context, Result}; +use serde::Deserialize; +use std::collections::HashSet; +use std::path::{Path, PathBuf}; + +/// Instance ids share the NATS subject namespace with host-level segments. +const RESERVED_INSTANCE_IDS: &[&str] = &["host", "cmd", "files", "update", "agent"]; + +pub const SUPPORTED_GAMES: &[&str] = &["rust", "conan", "soulmask", "dune"]; + +#[derive(Debug, Clone, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ConfigFile { + pub agent: AgentSection, + #[serde(default, rename = "instance")] + pub instances: Vec, + #[serde(default)] + pub prober: ProberSection, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct AgentSection { + pub license_id: Option, + pub nats_url: Option, + pub nats_token: Option, + #[serde(default = "default_heartbeat_seconds")] + pub heartbeat_seconds: u64, + #[serde(default = "default_log_level")] + pub log_level: String, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct InstanceConfig { + /// Short slug, unique per license: becomes a NATS subject segment. + pub id: String, + /// One of SUPPORTED_GAMES. + pub game: String, + /// Install root for this instance on the host. + pub root: PathBuf, + /// Optional human label shown in the panel. + #[serde(default)] + pub label: Option, +} + +#[derive(Debug, Clone, Default, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ProberSection { + #[serde(default = "default_probe_interval")] + pub interval_seconds: u64, + /// Extra TCP targets beyond the built-in defaults. + #[serde(default, rename = "target")] + pub targets: Vec, +} + +#[derive(Debug, Clone, Deserialize)] +#[serde(deny_unknown_fields)] +pub struct ProbeTargetConfig { + pub name: String, + pub host: String, + pub port: u16, +} + +fn default_heartbeat_seconds() -> u64 { + 60 +} + +fn default_probe_interval() -> u64 { + 300 +} + +fn default_log_level() -> String { + "info".to_string() +} + +/// Fully-resolved settings after merging file + env. Everything required is +/// present and validated. +#[derive(Debug, Clone)] +pub struct Settings { + pub license_id: String, + pub nats_url: String, + pub nats_token: Option, + pub heartbeat_seconds: u64, + pub log_level: String, + pub instances: Vec, + pub probe_interval_seconds: u64, + pub probe_targets: Vec, +} + +pub fn default_config_path() -> PathBuf { + #[cfg(windows)] + { + PathBuf::from(r"C:\ProgramData\Corrosion\agent.toml") + } + #[cfg(not(windows))] + { + PathBuf::from("/etc/corrosion/agent.toml") + } +} + +pub fn load(path: &Path) -> Result { + let raw = std::fs::read_to_string(path) + .with_context(|| format!("reading config file {}", path.display()))?; + let file: ConfigFile = toml::from_str(&raw) + .with_context(|| format!("parsing config file {}", path.display()))?; + resolve(file) +} + +/// Merge env overrides (env wins) and validate. +fn resolve(file: ConfigFile) -> Result { + let license_id = std::env::var("CORROSION_LICENSE_ID") + .ok() + .filter(|v| !v.is_empty()) + .or(file.agent.license_id) + .context("license_id missing: set [agent].license_id or CORROSION_LICENSE_ID")?; + + let nats_url = std::env::var("CORROSION_NATS_URL") + .ok() + .filter(|v| !v.is_empty()) + .or(file.agent.nats_url) + .context("nats_url missing: set [agent].nats_url or CORROSION_NATS_URL")?; + + let nats_token = std::env::var("CORROSION_NATS_TOKEN") + .ok() + .filter(|v| !v.is_empty()) + .or(file.agent.nats_token); + + validate_subject_segment("license_id", &license_id)?; + + let mut seen: HashSet<&str> = HashSet::new(); + for inst in &file.instances { + validate_subject_segment("instance id", &inst.id)?; + if RESERVED_INSTANCE_IDS.contains(&inst.id.as_str()) { + bail!("instance id '{}' is reserved", inst.id); + } + if !seen.insert(inst.id.as_str()) { + bail!("duplicate instance id '{}'", inst.id); + } + if !SUPPORTED_GAMES.contains(&inst.game.as_str()) { + bail!( + "instance '{}': unsupported game '{}' (supported: {})", + inst.id, + inst.game, + SUPPORTED_GAMES.join(", ") + ); + } + } + + if file.agent.heartbeat_seconds < 10 { + bail!("[agent].heartbeat_seconds must be >= 10"); + } + + Ok(Settings { + license_id, + nats_url, + nats_token, + heartbeat_seconds: file.agent.heartbeat_seconds, + log_level: file.agent.log_level, + instances: file.instances, + probe_interval_seconds: file.prober.interval_seconds.max(30), + probe_targets: file.prober.targets, + }) +} + +/// NATS subject segments must not contain '.', '*', '>', whitespace, etc. +/// Keep it strict: lowercase alphanumerics plus '-' and '_', max 64 chars. +fn validate_subject_segment(what: &str, value: &str) -> Result<()> { + if value.is_empty() || value.len() > 64 { + bail!("{what} '{value}' must be 1-64 characters"); + } + if !value + .chars() + .all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '-' || c == '_') + { + bail!("{what} '{value}' may only contain lowercase letters, digits, '-' and '_'"); + } + Ok(()) +} diff --git a/corrosion-host-agent/src/hostcmd.rs b/corrosion-host-agent/src/hostcmd.rs new file mode 100644 index 0000000..18f13af --- /dev/null +++ b/corrosion-host-agent/src/hostcmd.rs @@ -0,0 +1,115 @@ +//! Host-level command handler: request-reply on `corrosion.{license}.host.cmd`. +//! +//! One subscriber; each message handled in its own task so a slow command +//! never blocks the dispatch loop. Phase 0 commands: ping, probe, sysinfo. + +use futures::StreamExt; +use serde::Deserialize; +use serde_json::json; +use std::sync::Arc; +use sysinfo::System; + +use crate::agent::Agent; +use crate::prober; +use crate::subjects; +use crate::telemetry; +use crate::version; + +#[derive(Debug, Deserialize)] +struct HostCommand { + func: String, +} + +pub async fn run(agent: Arc) -> anyhow::Result<()> { + let subject = subjects::host_cmd(&agent.cfg.license_id); + let mut sub = agent.nats.subscribe(subject.clone()).await?; + tracing::info!("host command handler listening on {subject}"); + + let cancel = agent.shutdown.clone(); + loop { + tokio::select! { + msg = sub.next() => { + match msg { + Some(msg) => { + let agent = agent.clone(); + tokio::spawn(async move { handle(agent, msg).await }); + } + None => { + tracing::warn!("host command subscription ended"); + break; + } + } + } + _ = cancel.cancelled() => { + tracing::info!("host command handler stopping"); + break; + } + } + } + Ok(()) +} + +async fn handle(agent: Arc, msg: async_nats::Message) { + let Some(reply) = msg.reply.clone() else { + tracing::warn!("host command without reply subject ignored"); + return; + }; + + let response = match serde_json::from_slice::(&msg.payload) { + Ok(cmd) => dispatch(&agent, &cmd.func).await, + Err(e) => json!({ "status": "error", "message": format!("invalid command payload: {e}") }), + }; + + let bytes = match serde_json::to_vec(&response) { + Ok(b) => b, + Err(e) => { + tracing::error!("response serialize failed: {e}"); + return; + } + }; + if let Err(e) = agent.nats.publish(reply, bytes.into()).await { + tracing::warn!("response publish failed: {e}"); + } +} + +async fn dispatch(agent: &Arc, func: &str) -> serde_json::Value { + match func { + "ping" => json!({ + "status": "success", + "func": "ping", + "version": version::VERSION, + "commit": version::GIT_HASH, + "uptime_seconds": agent.started.elapsed().as_secs(), + }), + "probe" => { + let report = prober::run_probe(&agent.cfg.probe_targets).await; + *agent.last_probe.write().await = Some(report.clone()); + match serde_json::to_value(&report) { + Ok(report_json) => json!({ + "status": "success", + "func": "probe", + "report": report_json, + }), + Err(e) => json!({ "status": "error", "message": format!("probe serialize: {e}") }), + } + } + "sysinfo" => { + let mut sys = System::new(); + sys.refresh_cpu_usage(); + tokio::time::sleep(std::time::Duration::from_millis(250)).await; + let payload = telemetry::collect(agent, &mut sys).await; + match serde_json::to_value(&payload) { + Ok(snapshot) => json!({ + "status": "success", + "func": "sysinfo", + "snapshot": snapshot, + }), + Err(e) => json!({ "status": "error", "message": format!("sysinfo serialize: {e}") }), + } + } + other => json!({ + "status": "error", + "message": format!("unknown func '{other}' (supported: ping, probe, sysinfo)"), + }), + } +} diff --git a/corrosion-host-agent/src/main.rs b/corrosion-host-agent/src/main.rs new file mode 100644 index 0000000..59d9f34 --- /dev/null +++ b/corrosion-host-agent/src/main.rs @@ -0,0 +1,168 @@ +//! Corrosion Host Agent — multi-game ops runtime. +//! +//! Phase 0: NATS connectivity, real host telemetry, multi-instance config, +//! connectivity prober, host command channel. Process control, file ops, and +//! game adapters arrive in Phase 1+ (see PROTOCOL.md). + +mod agent; +mod bus; +mod config; +mod hostcmd; +mod prober; +mod subjects; +mod telemetry; +mod version; + +use anyhow::{Context, Result}; +use clap::{Parser, Subcommand}; +use std::path::PathBuf; +use std::sync::Arc; +use std::time::{Duration, Instant}; +use tokio::sync::RwLock; +use tokio_util::sync::CancellationToken; + +use crate::agent::Agent; + +#[derive(Parser)] +#[command(name = "corrosion-host-agent", version = version::VERSION, about)] +struct Cli { + /// Path to agent.toml (default: /etc/corrosion/agent.toml on Linux, + /// C:\ProgramData\Corrosion\agent.toml on Windows) + #[arg(long, short = 'c')] + config: Option, + + #[command(subcommand)] + command: Option, +} + +#[derive(Subcommand)] +enum Command { + /// Validate the config file and exit. + Check, + /// Print full version (semver, git hash, build timestamp) and exit. + Version, +} + +fn main() -> Result<()> { + let cli = Cli::parse(); + let config_path = cli.config.unwrap_or_else(config::default_config_path); + + match cli.command { + Some(Command::Version) => { + println!("corrosion-host-agent {}", version::long()); + Ok(()) + } + Some(Command::Check) => { + let settings = config::load(&config_path)?; + println!( + "config ok: license {}, {} instance(s), nats {}", + settings.license_id, + settings.instances.len(), + settings.nats_url + ); + Ok(()) + } + None => { + let settings = config::load(&config_path)?; + init_logging(&settings.log_level); + tokio::runtime::Builder::new_multi_thread() + .enable_all() + .build() + .context("building tokio runtime")? + .block_on(run(settings)) + } + } +} + +fn init_logging(level: &str) { + let filter = tracing_subscriber::EnvFilter::try_from_default_env() + .unwrap_or_else(|_| tracing_subscriber::EnvFilter::new(level)); + tracing_subscriber::fmt() + .with_env_filter(filter) + .with_target(false) + .init(); +} + +async fn run(settings: config::Settings) -> Result<()> { + tracing::info!( + "corrosion-host-agent {} starting: license {}, {} instance(s)", + version::long(), + settings.license_id, + settings.instances.len() + ); + for inst in &settings.instances { + tracing::info!(" instance '{}' ({}) at {}", inst.id, inst.game, inst.root.display()); + } + + let nats = bus::connect(&settings).await?; + + let agent = Arc::new(Agent { + cfg: settings, + nats, + started: Instant::now(), + last_probe: RwLock::new(None), + shutdown: CancellationToken::new(), + }); + + let mut handles = Vec::new(); + handles.push(tokio::spawn(telemetry::run(agent.clone()))); + handles.push(tokio::spawn(prober::run_loop(agent.clone()))); + { + let agent = agent.clone(); + handles.push(tokio::spawn(async move { + if let Err(e) = hostcmd::run(agent).await { + tracing::error!("host command handler failed: {e:#}"); + } + })); + } + + wait_for_shutdown_signal().await; + tracing::info!("shutdown signal received"); + agent.shutdown.cancel(); + + // Best-effort offline beacon so the panel flips to offline immediately + // instead of waiting out the heartbeat staleness window. + let beacon = subjects::host_going_offline(&agent.cfg.license_id); + let _ = tokio::time::timeout( + Duration::from_millis(500), + agent.nats.publish(beacon, "{}".into()), + ) + .await; + + match tokio::time::timeout( + Duration::from_secs(10), + futures::future::join_all(handles), + ) + .await + { + Ok(_) => tracing::info!("all subsystems stopped cleanly"), + Err(_) => tracing::warn!("shutdown timeout: some subsystems did not stop within 10s"), + } + + let _ = agent.nats.flush().await; + tracing::info!("corrosion-host-agent stopped"); + Ok(()) +} + +async fn wait_for_shutdown_signal() { + #[cfg(unix)] + { + use tokio::signal::unix::{signal, SignalKind}; + let mut sigterm = match signal(SignalKind::terminate()) { + Ok(s) => s, + Err(e) => { + tracing::error!("SIGTERM handler failed: {e}; falling back to ctrl-c only"); + let _ = tokio::signal::ctrl_c().await; + return; + } + }; + tokio::select! { + _ = tokio::signal::ctrl_c() => {} + _ = sigterm.recv() => {} + } + } + #[cfg(not(unix))] + { + let _ = tokio::signal::ctrl_c().await; + } +} diff --git a/corrosion-host-agent/src/prober.rs b/corrosion-host-agent/src/prober.rs new file mode 100644 index 0000000..a79b00f --- /dev/null +++ b/corrosion-host-agent/src/prober.rs @@ -0,0 +1,121 @@ +//! Connectivity prober. +//! +//! Answers "is it the box or is it the network?" before a support ticket gets +//! written. Phase 0 scope is OUTBOUND reachability: TCP connect timing from +//! the host to known endpoints. Inbound port-forward verification (the thing +//! panel users actually struggle with) requires a backend-side reverse probe +//! and is specified in PROTOCOL.md as a later phase. + +use chrono::{SecondsFormat, Utc}; +use serde::Serialize; +use std::sync::Arc; +use std::time::{Duration, Instant}; +use tokio::net::TcpStream; + +use crate::agent::Agent; +use crate::config::ProbeTargetConfig; + +const CONNECT_TIMEOUT: Duration = Duration::from_secs(3); + +#[derive(Debug, Clone, Serialize)] +pub struct ProbeResult { + pub name: String, + pub host: String, + pub port: u16, + pub ok: bool, + #[serde(skip_serializing_if = "Option::is_none")] + pub latency_ms: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, +} + +#[derive(Debug, Clone, Serialize)] +pub struct ProbeReport { + pub timestamp: String, + pub results: Vec, +} + +/// Built-in targets every agent checks, before config extras. +fn default_targets() -> Vec { + vec![ProbeTargetConfig { + name: "corrosion-cdn".to_string(), + host: "cdn.corrosionmgmt.com".to_string(), + port: 443, + }] +} + +pub async fn run_probe(extra_targets: &[ProbeTargetConfig]) -> ProbeReport { + let mut targets = default_targets(); + targets.extend(extra_targets.iter().cloned()); + + let checks = targets.into_iter().map(|t| async move { + let started = Instant::now(); + let addr = format!("{}:{}", t.host, t.port); + let outcome = tokio::time::timeout(CONNECT_TIMEOUT, TcpStream::connect(&addr)).await; + match outcome { + Ok(Ok(_stream)) => ProbeResult { + name: t.name, + host: t.host, + port: t.port, + ok: true, + latency_ms: Some(started.elapsed().as_millis() as u64), + error: None, + }, + Ok(Err(e)) => ProbeResult { + name: t.name, + host: t.host, + port: t.port, + ok: false, + latency_ms: None, + error: Some(e.to_string()), + }, + Err(_) => ProbeResult { + name: t.name, + host: t.host, + port: t.port, + ok: false, + latency_ms: None, + error: Some(format!("timeout after {}s", CONNECT_TIMEOUT.as_secs())), + }, + } + }); + + let results = futures::future::join_all(checks).await; + + ProbeReport { + timestamp: Utc::now().to_rfc3339_opts(SecondsFormat::Secs, true), + results, + } +} + +/// Periodic probe loop; results land in shared state and ride the next +/// heartbeat. Jittered interval to avoid fleet-wide synchronization. +pub async fn run_loop(agent: Arc) { + let cancel = agent.shutdown.clone(); + loop { + let report = run_probe(&agent.cfg.probe_targets).await; + let failed: Vec<&str> = report + .results + .iter() + .filter(|r| !r.ok) + .map(|r| r.name.as_str()) + .collect(); + if failed.is_empty() { + tracing::debug!("probe ok ({} targets)", report.results.len()); + } else { + tracing::warn!("probe failures: {}", failed.join(", ")); + } + *agent.last_probe.write().await = Some(report); + + let jitter = rand::Rng::gen_range(&mut rand::thread_rng(), 0.8..1.2); + let interval = + Duration::from_secs_f64(agent.cfg.probe_interval_seconds as f64 * jitter); + tokio::select! { + _ = tokio::time::sleep(interval) => {} + _ = cancel.cancelled() => { + tracing::info!("prober stopping"); + break; + } + } + } +} diff --git a/corrosion-host-agent/src/subjects.rs b/corrosion-host-agent/src/subjects.rs new file mode 100644 index 0000000..6f87052 --- /dev/null +++ b/corrosion-host-agent/src/subjects.rs @@ -0,0 +1,30 @@ +//! Corrosion wire protocol v2 subject scheme (see PROTOCOL.md). +//! +//! Host-level subjects live under `corrosion.{license}.host.*`; per-instance +//! subjects under `corrosion.{license}.{instance_id}.*`. Instance ids are +//! validated at config load so they can never collide with the reserved +//! `host` segment or contain subject metacharacters. + +pub fn host_heartbeat(license: &str) -> String { + format!("corrosion.{license}.host.heartbeat") +} + +pub fn host_cmd(license: &str) -> String { + format!("corrosion.{license}.host.cmd") +} + +pub fn host_going_offline(license: &str) -> String { + format!("corrosion.{license}.host.going_offline") +} + +/// Phase 1: per-instance command channel (start/stop/restart/rcon/...). +#[allow(dead_code)] +pub fn instance_cmd(license: &str, instance: &str) -> String { + format!("corrosion.{license}.{instance}.cmd") +} + +/// Phase 1: per-instance state-change events. +#[allow(dead_code)] +pub fn instance_status(license: &str, instance: &str) -> String { + format!("corrosion.{license}.{instance}.status") +} diff --git a/corrosion-host-agent/src/telemetry.rs b/corrosion-host-agent/src/telemetry.rs new file mode 100644 index 0000000..8d8d2be --- /dev/null +++ b/corrosion-host-agent/src/telemetry.rs @@ -0,0 +1,175 @@ +//! Host heartbeat: real telemetry, never fabricated. +//! +//! The Go agent shipped `disk_free_mb: 50000` and `cpu_percent: 0.0` as +//! hardcoded placeholders. This module is the first time the panel's +//! Resources view receives the truth. Anything we cannot measure is omitted +//! or null — never invented. + +use chrono::{SecondsFormat, Utc}; +use rand::Rng; +use serde::Serialize; +use std::path::Path; +use std::sync::Arc; +use std::time::Duration; +use sysinfo::{Disks, System}; + +use crate::agent::Agent; +use crate::prober::ProbeReport; +use crate::subjects; +use crate::version; + +#[derive(Debug, Serialize)] +pub struct HeartbeatPayload { + /// Wire schema version — lets the backend distinguish v2 host heartbeats + /// from legacy Go companion heartbeats during any transition window. + pub schema: u32, + pub timestamp: String, + pub agent: AgentInfo, + pub host: HostInfo, + pub instances: Vec, + #[serde(skip_serializing_if = "Option::is_none")] + pub probe: Option, +} + +#[derive(Debug, Serialize)] +pub struct AgentInfo { + pub version: String, + pub commit: String, + pub os: String, + pub arch: String, + pub uptime_seconds: u64, +} + +#[derive(Debug, Serialize)] +pub struct HostInfo { + #[serde(skip_serializing_if = "Option::is_none")] + pub hostname: Option, + pub cpu_percent: f32, + pub cpu_cores: usize, + pub mem_total_mb: u64, + pub mem_used_mb: u64, + pub uptime_seconds: u64, + pub disks: Vec, +} + +#[derive(Debug, Serialize)] +pub struct DiskInfo { + pub mount: String, + pub total_mb: u64, + pub free_mb: u64, +} + +#[derive(Debug, Serialize)] +pub struct InstanceInfo { + pub id: String, + pub game: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub label: Option, + /// Phase 0 states: `configured` (root exists) or `missing_root`. + /// Phase 1 adds live process states (running/stopped/crashed). + pub state: String, + #[serde(skip_serializing_if = "Option::is_none")] + pub root_disk_free_mb: Option, +} + +pub async fn run(agent: Arc) { + let cancel = agent.shutdown.clone(); + let mut sys = System::new(); + + // CPU usage is a delta between refreshes; prime it once so the first + // heartbeat carries a real figure instead of 0. + sys.refresh_cpu_usage(); + tokio::time::sleep(Duration::from_millis(250)).await; + + loop { + let payload = collect(&agent, &mut sys).await; + match serde_json::to_vec(&payload) { + Ok(bytes) => { + let subject = subjects::host_heartbeat(&agent.cfg.license_id); + if let Err(e) = agent.nats.publish(subject, bytes.into()).await { + tracing::warn!("heartbeat publish failed: {e}"); + } else { + tracing::debug!( + "heartbeat sent: cpu {:.1}%, {} instance(s)", + payload.host.cpu_percent, + payload.instances.len() + ); + } + } + Err(e) => tracing::error!("heartbeat serialize failed: {e}"), + } + + let jitter = rand::thread_rng().gen_range(0.8..1.2); + let interval = Duration::from_secs_f64(agent.cfg.heartbeat_seconds as f64 * jitter); + tokio::select! { + _ = tokio::time::sleep(interval) => {} + _ = cancel.cancelled() => { + tracing::info!("telemetry stopping"); + break; + } + } + } +} + +pub async fn collect(agent: &Agent, sys: &mut System) -> HeartbeatPayload { + sys.refresh_cpu_usage(); + sys.refresh_memory(); + let disks = Disks::new_with_refreshed_list(); + + let disk_infos: Vec = disks + .iter() + .map(|d| DiskInfo { + mount: d.mount_point().to_string_lossy().to_string(), + total_mb: d.total_space() / 1_048_576, + free_mb: d.available_space() / 1_048_576, + }) + .collect(); + + let instances = agent + .cfg + .instances + .iter() + .map(|inst| { + let exists = inst.root.exists(); + InstanceInfo { + id: inst.id.clone(), + game: inst.game.clone(), + label: inst.label.clone(), + state: if exists { "configured" } else { "missing_root" }.to_string(), + root_disk_free_mb: disk_free_for_path(&disks, &inst.root), + } + }) + .collect(); + + HeartbeatPayload { + schema: 2, + timestamp: Utc::now().to_rfc3339_opts(SecondsFormat::Secs, true), + agent: AgentInfo { + version: version::VERSION.to_string(), + commit: version::GIT_HASH.to_string(), + os: std::env::consts::OS.to_string(), + arch: std::env::consts::ARCH.to_string(), + uptime_seconds: agent.started.elapsed().as_secs(), + }, + host: HostInfo { + hostname: System::host_name(), + cpu_percent: sys.global_cpu_usage(), + cpu_cores: sys.cpus().len(), + mem_total_mb: sys.total_memory() / 1_048_576, + mem_used_mb: sys.used_memory() / 1_048_576, + uptime_seconds: System::uptime(), + disks: disk_infos, + }, + instances, + probe: agent.last_probe.read().await.clone(), + } +} + +/// Free space on the disk whose mount point is the longest prefix of `path`. +fn disk_free_for_path(disks: &Disks, path: &Path) -> Option { + disks + .iter() + .filter(|d| path.starts_with(d.mount_point())) + .max_by_key(|d| d.mount_point().as_os_str().len()) + .map(|d| d.available_space() / 1_048_576) +} diff --git a/corrosion-host-agent/src/version.rs b/corrosion-host-agent/src/version.rs new file mode 100644 index 0000000..9f75003 --- /dev/null +++ b/corrosion-host-agent/src/version.rs @@ -0,0 +1,10 @@ +//! Build-time identity, embedded so every heartbeat and `--version` can state +//! exactly what is running. + +pub const VERSION: &str = env!("CARGO_PKG_VERSION"); +pub const GIT_HASH: &str = env!("CORROSION_GIT_HASH"); +pub const BUILD_TS: &str = env!("CORROSION_BUILD_TS"); + +pub fn long() -> String { + format!("{VERSION} ({GIT_HASH}, built {BUILD_TS})") +}