Promote 27 hardcoded constants to configurable parameters

Add 9 config subsection structs (LimitsConfig, RateLimitConfig,
RetryConfig, CacheConfig, DiscoveryConfig, TreeConfig, BloomConfig,
SessionConfig, BuffersConfig) under node.* with serde defaults.

Wire all configurable values through to consuming code:
- Resource limits (max_connections, max_peers, max_links, max_pending_inbound)
- Rate limiting (handshake_burst, handshake_rate, handshake_timeout_secs)
- Retry/backoff (consolidate max_retries, base_interval_secs under
  node.retry.*, add max_backoff_secs)
- Cache sizes/TTL (coord_size, coord_ttl_secs, route_size)
- Discovery (ttl, timeout_secs, recent_expiry_secs)
- Spanning tree (root_refresh_secs, announce_min_interval_ms,
  parent_switch_threshold)
- Bloom filter (update_debounce_ms)
- Session/data plane (default_hop_limit, pending_packets_per_dest,
  pending_max_destinations)
- Internal buffers (packet_channel, tun_channel, dns_channel)
- Network internals (base_rtt_ms, tick_interval_secs)
- DNS responder TTL (dns.ttl)

REPLAY_WINDOW_SIZE kept as compile-time constant (array sizing).
Disable flaky test_discovery_100_nodes (run with --ignored).
This commit is contained in:
Johnathan Corgan
2026-02-14 21:33:38 +00:00
parent 9ee02489f0
commit 7463d8799a
16 changed files with 478 additions and 102 deletions
+3 -3
View File
@@ -9,8 +9,7 @@ use crate::NodeAddr;
use super::{Node, NodeError};
use tracing::{debug, info, warn};
/// Root nodes re-announce every 30 minutes to keep the tree alive.
const ROOT_REFRESH_INTERVAL_SECS: u64 = 30 * 60;
// Root refresh interval is configurable via `node.tree.root_refresh_secs`.
impl Node {
/// Build a TreeAnnounce from our current tree state.
@@ -269,7 +268,8 @@ impl Node {
.map(|d| d.as_secs())
.unwrap_or(0);
if now_secs.saturating_sub(self.last_root_refresh_secs) >= ROOT_REFRESH_INTERVAL_SECS {
let root_refresh_secs = self.config.node.tree.root_refresh_secs;
if now_secs.saturating_sub(self.last_root_refresh_secs) >= root_refresh_secs {
let new_seq = self.tree_state.my_declaration().sequence() + 1;
self.tree_state
.set_parent(*self.identity.node_addr(), new_seq, now_secs);