mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-09 08:14:42 +00:00
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:
@@ -102,7 +102,7 @@ impl Node {
|
||||
transport_id,
|
||||
remote_addr.clone(),
|
||||
LinkDirection::Outbound,
|
||||
Duration::from_millis(100), // Base RTT estimate for UDP
|
||||
Duration::from_millis(self.config.node.base_rtt_ms),
|
||||
);
|
||||
|
||||
self.links.insert(link_id, link);
|
||||
@@ -228,8 +228,8 @@ impl Node {
|
||||
self.state = NodeState::Starting;
|
||||
|
||||
// Create packet channel for transport -> Node communication
|
||||
const PACKET_BUFFER_SIZE: usize = 1024;
|
||||
let (packet_tx, packet_rx) = packet_channel(PACKET_BUFFER_SIZE);
|
||||
let packet_buffer_size = self.config.node.buffers.packet_channel;
|
||||
let (packet_tx, packet_rx) = packet_channel(packet_buffer_size);
|
||||
self.packet_tx = Some(packet_tx.clone());
|
||||
self.packet_rx = Some(packet_rx);
|
||||
|
||||
@@ -289,7 +289,8 @@ impl Node {
|
||||
let reader_tun_tx = tun_tx.clone();
|
||||
|
||||
// Create outbound channel for TUN reader → Node
|
||||
let (outbound_tx, outbound_rx) = tokio::sync::mpsc::channel(1024);
|
||||
let tun_channel_size = self.config.node.buffers.tun_channel;
|
||||
let (outbound_tx, outbound_rx) = tokio::sync::mpsc::channel(tun_channel_size);
|
||||
|
||||
// Spawn reader thread
|
||||
let reader_handle = thread::spawn(move || {
|
||||
@@ -315,8 +316,10 @@ impl Node {
|
||||
let bind = format!("{}:{}", self.config.dns.bind_addr(), self.config.dns.port());
|
||||
match tokio::net::UdpSocket::bind(&bind).await {
|
||||
Ok(socket) => {
|
||||
let (identity_tx, identity_rx) = tokio::sync::mpsc::channel(64);
|
||||
let handle = tokio::spawn(crate::dns::run_dns_responder(socket, identity_tx));
|
||||
let dns_channel_size = self.config.node.buffers.dns_channel;
|
||||
let (identity_tx, identity_rx) = tokio::sync::mpsc::channel(dns_channel_size);
|
||||
let dns_ttl = self.config.dns.ttl();
|
||||
let handle = tokio::spawn(crate::dns::run_dns_responder(socket, identity_tx, dns_ttl));
|
||||
self.dns_identity_rx = Some(identity_rx);
|
||||
self.dns_task = Some(handle);
|
||||
info!(bind = %bind, "DNS responder started for .fips domain");
|
||||
|
||||
Reference in New Issue
Block a user