pub struct Config<LocalRecordProvider> {Show 26 fields
pub keypair: Keypair,
pub listen_on: Vec<Multiaddr>,
pub listen_on_fallback_to_random_port: bool,
pub timeout: Duration,
pub identify: Config,
pub kademlia: Config,
pub gossipsub: Option<Config>,
pub local_records_provider: LocalRecordProvider,
pub yamux_config: Config,
pub allow_non_global_addresses_in_dht: bool,
pub initial_random_query_interval: Duration,
pub known_peers_registry: Box<dyn KnownPeersRegistry>,
pub request_response_protocols: Vec<Box<dyn RequestHandler>>,
pub reserved_peers: Vec<Multiaddr>,
pub max_established_incoming_connections: u32,
pub max_established_outgoing_connections: u32,
pub max_pending_incoming_connections: u32,
pub max_pending_outgoing_connections: u32,
pub temporary_bans_cache_size: u32,
pub temporary_ban_backoff: ExponentialBackoff,
pub libp2p_metrics: Option<Metrics>,
pub metrics: Option<SubspaceMetrics>,
pub protocol_version: String,
pub bootstrap_addresses: Vec<Multiaddr>,
pub kademlia_mode: KademliaMode,
pub external_addresses: Vec<Multiaddr>,
}
Expand description
Node
configuration.
Fields§
§keypair: Keypair
Identity keypair of a node used for authenticated connections.
listen_on: Vec<Multiaddr>
List of [Multiaddr
] on which to listen for incoming connections.
listen_on_fallback_to_random_port: bool
Fallback to random port if specified (or default) port is already occupied.
timeout: Duration
Adds a timeout to the setup and protocol upgrade process for all inbound and outbound connections established through the transport.
identify: Config
The configuration for the Identify behaviour.
kademlia: Config
The configuration for the Kademlia behaviour.
gossipsub: Option<Config>
The configuration for the Gossip behaviour.
local_records_provider: LocalRecordProvider
Externally provided implementation of the local records provider
yamux_config: Config
Yamux multiplexing configuration.
allow_non_global_addresses_in_dht: bool
Should non-global addresses be added to the DHT?
initial_random_query_interval: Duration
How frequently should random queries be done using Kademlia DHT to populate routing table.
known_peers_registry: Box<dyn KnownPeersRegistry>
A reference to the NetworkingParametersRegistry
implementation.
request_response_protocols: Vec<Box<dyn RequestHandler>>
The configuration for the RequestResponsesBehaviour
protocol.
reserved_peers: Vec<Multiaddr>
Defines set of peers with a permanent connection (and reconnection if necessary).
max_established_incoming_connections: u32
Established incoming swarm connection limit.
max_established_outgoing_connections: u32
Established outgoing swarm connection limit.
max_pending_incoming_connections: u32
Pending incoming swarm connection limit.
max_pending_outgoing_connections: u32
Pending outgoing swarm connection limit.
temporary_bans_cache_size: u32
How many temporarily banned unreachable peers to keep in memory.
temporary_ban_backoff: ExponentialBackoff
Backoff policy for temporary banning of unreachable peers.
libp2p_metrics: Option<Metrics>
Optional libp2p prometheus metrics. None will disable metrics gathering.
metrics: Option<SubspaceMetrics>
Internal prometheus metrics. None will disable metrics gathering.
protocol_version: String
Defines protocol version for the network peers. Affects network partition.
bootstrap_addresses: Vec<Multiaddr>
Addresses to bootstrap Kademlia network
kademlia_mode: KademliaMode
Kademlia mode. The default value is set to Static(Client). The peer won’t add its address to other peers` Kademlia routing table. Changing this behaviour implies that a peer can provide pieces to others.
external_addresses: Vec<Multiaddr>
Known external addresses to the local peer. The addresses will be added on the swarm start and enable peer to notify others about its reachable address.
Implementations§
source§impl<LocalRecordProvider> Config<LocalRecordProvider>where
LocalRecordProvider: LocalRecordProvider,
impl<LocalRecordProvider> Config<LocalRecordProvider>where
LocalRecordProvider: LocalRecordProvider,
Trait Implementations§
Auto Trait Implementations§
impl<LocalRecordProvider> Freeze for Config<LocalRecordProvider>where
LocalRecordProvider: Freeze,
impl<LocalRecordProvider> !RefUnwindSafe for Config<LocalRecordProvider>
impl<LocalRecordProvider> Send for Config<LocalRecordProvider>where
LocalRecordProvider: Send,
impl<LocalRecordProvider> !Sync for Config<LocalRecordProvider>
impl<LocalRecordProvider> Unpin for Config<LocalRecordProvider>where
LocalRecordProvider: Unpin,
impl<LocalRecordProvider> !UnwindSafe for Config<LocalRecordProvider>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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