pub struct NetworkConfig {Show 15 fields
pub data_dir: Option<PathBuf>,
pub listen_addresses: Vec<Multiaddr>,
pub boot_nodes: Vec<Multiaddr>,
pub max_inbound_peers: u32,
pub max_outbound_peers: u32,
pub gossip_topics: Vec<String>,
pub enable_dht: bool,
pub enable_mdns: bool,
pub connection_idle_timeout: Duration,
pub gossip_heartbeat_interval: Duration,
pub protocol_version: String,
pub user_agent: String,
pub enable_hole_punching: bool,
pub enable_relay: bool,
pub external_addresses: Vec<Multiaddr>,
}Expand description
Network configuration
Fields§
§data_dir: Option<PathBuf>Data directory for persistent state (keypair, etc.)
listen_addresses: Vec<Multiaddr>Listen addresses (multiaddr format)
boot_nodes: Vec<Multiaddr>Bootstrap nodes to connect to on startup
max_inbound_peers: u32Maximum number of inbound peers
max_outbound_peers: u32Maximum number of outbound peers
gossip_topics: Vec<String>Topics to subscribe to on startup
enable_dht: boolEnable DHT for peer discovery
enable_mdns: boolEnable mDNS for local peer discovery
connection_idle_timeout: DurationConnection idle timeout
gossip_heartbeat_interval: DurationHeartbeat interval for gossipsub
protocol_version: StringProtocol version
user_agent: StringUser agent string
enable_hole_punching: boolEnable hole punching for NAT traversal
enable_relay: boolEnable relay server
external_addresses: Vec<Multiaddr>Statically-configured external addresses this node advertises to peers
via Identify. Required on cloud deployments where the host binds to
0.0.0.0 and Identify’s listen-addr enumeration is hidden (see
behaviour.rs::hide_listen_addrs). Each multiaddr listed here is
passed to Swarm::add_external_address at startup.
For validator-0 in the live GCE testnet this is set to
/ip4/<external-ip>/tcp/9000 from the per-VM Terraform output. For
nodes whose external address must be discovered (community joiners
behind NAT), leave this empty and rely on AutoNAT v2 + Relay v2 +
DCUtR to confirm a reachable address dynamically.
Implementations§
Trait Implementations§
Source§impl Clone for NetworkConfig
impl Clone for NetworkConfig
Source§fn clone(&self) -> NetworkConfig
fn clone(&self) -> NetworkConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NetworkConfig
impl Debug for NetworkConfig
Source§impl Default for NetworkConfig
impl Default for NetworkConfig
Source§impl<'de> Deserialize<'de> for NetworkConfig
impl<'de> Deserialize<'de> for NetworkConfig
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 NetworkConfig
impl RefUnwindSafe for NetworkConfig
impl Send for NetworkConfig
impl Sync for NetworkConfig
impl Unpin for NetworkConfig
impl UnsafeUnpin for NetworkConfig
impl UnwindSafe for NetworkConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more