Weave documentation
Rust referenceweave-swarm

weave-swarm · config

Source declarations, signatures and documentation for config.

Source: sigil/weave/network/weave-swarm/src/config.rs. SHA-256: dba4bf4fcb4d05ea93683c46673d0256011b08bf351e5129059da7b039b0907f.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

config::SwarmConfig

Swarm configuration

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SwarmConfig {
/// Maximum total connections

pub max_connections: usize,
/// Maximum peers per topic

pub max_peers_per_topic: usize,
/// Maximum connection attempts per peer

pub max_retries: usize,
/// Connection timeout

pub connection_timeout: Duration,
/// Verify peer ownership via human roots

pub verify_ownership: bool,
/// DHT bootstrap nodes

pub bootstrap_nodes: Vec<String>,
/// Keep-alive interval

pub keep_alive_interval: Duration,
/// Enable connection deduplication

pub deduplicate: bool,
/// Listen address (None = auto)

pub listen_addr: Option<String>,
/// Listen port (0 = random)

pub listen_port: u16,
/// Backoff configuration

#[serde(default)]
pub backoff: BackoffConfig,
/// NAT traversal and relay configuration

#[serde(default)]
pub nat: NatConfig,
/// Resource limits

#[serde(default)]
pub limits: LimitsConfig,
/// Telemetry configuration

#[serde(default)]
pub telemetry: TelemetryConfig,
/// Firewall callback enabled (placeholder toggle)

#[serde(default)]
pub firewall_enabled: bool
}

Source line: 8.

config::SwarmConfig::minimal

Create a minimal config for testing

pub fn minimal() -> Self;

Source line: 84.

config::SwarmConfig::production

Create a production config

pub fn production() -> Self;

Source line: 120.

config::SwarmConfig::validate

Validate and clamp configuration

pub fn validate(&mut self);

Source line: 156.

config::BackoffConfig

Exponential backoff configuration with jitter

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BackoffConfig {
pub initial_ms: u64,
pub max_ms: u64,
pub multiplier: f64,
/// 0.0 - 1.0

pub jitter_pct: f64
}

Source line: 195.

config::NatConfig

NAT traversal configuration

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NatConfig {
pub enable_hole_punching: bool,
pub enable_upnp: bool,
pub relay_fallback: bool
}

Source line: 216.

config::LimitsConfig

Limits configuration

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LimitsConfig {
pub frame_size_cap_bytes: usize,
pub per_peer_rate_limit_per_sec: u64
}

Source line: 234.

config::TelemetryConfig

Telemetry configuration

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TelemetryConfig {
pub enable_metrics: bool,
pub metrics_interval_ms: u64
}

Source line: 250.

On this page