pub struct Config {
pub allow_public_space: bool,
pub my_pub: Option<String>,
pub broadcast_buffer_size: usize,
pub ice_servers: Vec<String>,
pub dedup_capacity: usize,
pub mailbox_capacity: usize,
pub child_mailbox_capacity: usize,
}Expand description
Configuration for a Node and its associated adapters.
Controls public space access, broadcast channel sizing, and WebRTC ICE server configuration.
Fields§
§allow_public_space: boolWhether to accept writes to public space (non-user-owned nodes).
When true (default), the node accepts puts to any node ID. When
false, only content-addressed (signed) data and user-owned nodes
are accepted — matching Gun.js opt.enforce semantics.
my_pub: Option<String>Public key to prioritize for this node (format: x.y).
When set, the node will preferentially cache data owned by this public key. Used for user-authenticated nodes.
broadcast_buffer_size: usizeBuffer size for broadcast channels used by on() and map().
Defaults to 4096. Increase for high-throughput scenarios; decrease to save memory per active subscription.
ice_servers: Vec<String>STUN/TURN servers for WebRTC ICE negotiation.
Defaults to Google’s public STUN server. Only used when the
webrtc feature is enabled.
dedup_capacity: usizeMaximum entries for the router’s dedup bloom filter.
Defaults to 100000 (100K) — handles high-throughput relay scenarios without false positives. The original Gun.js default (999) is suitable for low-volume P2P traffic but causes false-positive drops under benchmark loads. Each entry uses ~1 bit of memory in the bloom filter, so 100K entries ≈ 12.5 KiB per generation.
mailbox_capacity: usizeBackpressure ceiling for the router/root actor’s mailbox.
The mailbox grows on demand (no pre-allocation). When the queue
length reaches this limit, send returns Err(()), applying
backpressure to senders. Defaults to 65536 — generous for the
high-throughput router hub. Reduce for memory-constrained environments.
child_mailbox_capacity: usizeBackpressure ceiling for child node actors’ mailboxes.
Child nodes handle messages for a single graph path — a smaller ceiling than the router is appropriate. Defaults to 256, which is sufficient for any realistic single-path burst while limiting memory usage under adversarial workloads (e.g. a peer creating unique soul paths to spawn many child actors).