pub struct P2pConfigBuilder { /* private fields */ }Expand description
Builder for P2pConfig
Implementations§
Source§impl P2pConfigBuilder
impl P2pConfigBuilder
Sourcepub fn bind_addr(self, addr: SocketAddr) -> Self
pub fn bind_addr(self, addr: SocketAddr) -> Self
Set the bind address
Sourcepub fn known_peer(self, addr: SocketAddr) -> Self
pub fn known_peer(self, addr: SocketAddr) -> Self
Add a known peer for initial discovery In v0.13.0+ all nodes are symmetric - these are just starting points
Sourcepub fn known_peers(self, addrs: impl IntoIterator<Item = SocketAddr>) -> Self
pub fn known_peers(self, addrs: impl IntoIterator<Item = SocketAddr>) -> Self
Add multiple known peers
Sourcepub fn max_connections(self, max: usize) -> Self
pub fn max_connections(self, max: usize) -> Self
Set maximum connections
Sourcepub fn timeouts(self, timeouts: TimeoutConfig) -> Self
pub fn timeouts(self, timeouts: TimeoutConfig) -> Self
Set timeout configuration
Sourcepub fn fast_timeouts(self) -> Self
pub fn fast_timeouts(self) -> Self
Use fast timeouts (for local networks)
Sourcepub fn conservative_timeouts(self) -> Self
pub fn conservative_timeouts(self) -> Self
Use conservative timeouts (for unreliable networks)
Sourcepub fn pqc_optimized_mtu(self) -> Self
pub fn pqc_optimized_mtu(self) -> Self
Use PQC-optimized MTU settings
Enables larger MTU bounds (up to 4096) for efficient PQC handshakes.
Sourcepub fn constrained_mtu(self) -> Self
pub fn constrained_mtu(self) -> Self
Use constrained network MTU settings
Disables MTU discovery and uses minimum MTU (1200).
Sourcepub fn jumbo_mtu(self) -> Self
pub fn jumbo_mtu(self) -> Self
Use jumbo frame MTU settings
For high-bandwidth networks supporting larger frames (up to 9000).
Sourcepub fn stats_interval(self, interval: Duration) -> Self
pub fn stats_interval(self, interval: Duration) -> Self
Set statistics collection interval
Sourcepub fn keypair(
self,
public_key: MlDsaPublicKey,
secret_key: MlDsaSecretKey,
) -> Self
pub fn keypair( self, public_key: MlDsaPublicKey, secret_key: MlDsaSecretKey, ) -> Self
Set identity keypair for persistent peer ID (ML-DSA-65)
If not set, a fresh keypair is generated on startup. Provide this for stable identity across restarts.
Sourcepub fn build(self) -> Result<P2pConfig, ConfigError>
pub fn build(self) -> Result<P2pConfig, ConfigError>
Build the configuration with validation
Trait Implementations§
Source§impl Clone for P2pConfigBuilder
impl Clone for P2pConfigBuilder
Source§fn clone(&self) -> P2pConfigBuilder
fn clone(&self) -> P2pConfigBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more