pub struct NodeConfig {Show 17 fields
pub peer_id: Option<PeerId>,
pub listen_addrs: Vec<SocketAddr>,
pub listen_addr: SocketAddr,
pub bootstrap_peers: Vec<SocketAddr>,
pub bootstrap_peers_str: Vec<String>,
pub enable_ipv6: bool,
pub connection_timeout: Duration,
pub keep_alive_interval: Duration,
pub max_connections: usize,
pub max_incoming_connections: usize,
pub dht_config: DHTConfig,
pub security_config: SecurityConfig,
pub production_config: Option<ProductionConfig>,
pub bootstrap_cache_config: Option<CacheConfig>,
pub diversity_config: Option<IPDiversityConfig>,
pub stale_peer_threshold: Duration,
pub max_message_size: Option<usize>,
}Expand description
Configuration for a P2P node
Fields§
§peer_id: Option<PeerId>Local peer ID for this node
listen_addrs: Vec<SocketAddr>Addresses to listen on for incoming connections
listen_addr: SocketAddrPrimary listen address (for compatibility)
bootstrap_peers: Vec<SocketAddr>Bootstrap peers to connect to on startup (legacy)
bootstrap_peers_str: Vec<String>Bootstrap peers as strings (for integration tests)
enable_ipv6: boolEnable IPv6 support
connection_timeout: DurationConnection timeout duration
keep_alive_interval: DurationKeep-alive interval for connections
max_connections: usizeMaximum number of concurrent connections
max_incoming_connections: usizeMaximum number of incoming connections
dht_config: DHTConfigDHT configuration
security_config: SecurityConfigSecurity configuration
production_config: Option<ProductionConfig>Production hardening configuration
bootstrap_cache_config: Option<CacheConfig>Bootstrap cache configuration
diversity_config: Option<IPDiversityConfig>Optional IP diversity configuration for Sybil protection tuning.
When set, this configuration is used by bootstrap peer discovery and
other diversity-enforcing subsystems. If None, defaults are used.
stale_peer_threshold: DurationStale peer threshold - peers with no activity for this duration are considered stale. Defaults to 60 seconds. Can be reduced for testing purposes.
max_message_size: Option<usize>Optional override for the maximum application-layer message size.
When None, the transport crate default is used (1 MiB).
Implementations§
Source§impl NodeConfig
impl NodeConfig
Source§impl NodeConfig
impl NodeConfig
Sourcepub fn from_config(config: &Config) -> Result<Self>
pub fn from_config(config: &Config) -> Result<Self>
Create NodeConfig from Config
Sourcepub fn with_listen_addr(addr: &str) -> Result<Self>
pub fn with_listen_addr(addr: &str) -> Result<Self>
Try to build a NodeConfig from a listen address string
Trait Implementations§
Source§impl Clone for NodeConfig
impl Clone for NodeConfig
Source§fn clone(&self) -> NodeConfig
fn clone(&self) -> NodeConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NodeConfig
impl Debug for NodeConfig
Source§impl Default for NodeConfig
impl Default for NodeConfig
Source§impl<'de> Deserialize<'de> for NodeConfig
impl<'de> Deserialize<'de> for NodeConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for NodeConfig
impl RefUnwindSafe for NodeConfig
impl Send for NodeConfig
impl Sync for NodeConfig
impl Unpin for NodeConfig
impl UnsafeUnpin for NodeConfig
impl UnwindSafe for NodeConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.