feat(p2p): add production infrastructure modules

- error.rs: Structured error types with context for all subsystems
  (transport, routing, crypto, protocol, store, config)
- config.rs: Runtime configuration with TOML parsing and validation
- metrics.rs: Counter/gauge/histogram metrics with transport-specific
  tracking and JSON-serializable snapshots
- rate_limit.rs: Token bucket rate limiting with per-peer tracking,
  duty cycle enforcement for LoRa, and backpressure control

These modules provide the foundation for production deployment.
This commit is contained in:
2026-04-01 09:16:44 +02:00
parent ac36534063
commit 024b6c91d1
7 changed files with 1824 additions and 0 deletions

18
Cargo.lock generated
View File

@@ -2157,6 +2157,22 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]]
name = "humantime"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424"
[[package]]
name = "humantime-serde"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57a3db5ea5923d99402c94e9feb261dc5ee9b4efa158b0315f788cf549cc200c"
dependencies = [
"humantime",
"serde",
]
[[package]]
name = "hybrid-array"
version = "0.2.3"
@@ -4454,6 +4470,7 @@ dependencies = [
"ciborium",
"hex",
"hkdf",
"humantime-serde",
"iroh",
"quicprochat-core",
"rand 0.8.5",
@@ -4463,6 +4480,7 @@ dependencies = [
"tempfile",
"thiserror 1.0.69",
"tokio",
"toml",
"tracing",
"x25519-dalek",
"zeroize",