Skip to main content

Module node

Module node 

Source
Expand description

functionality of a libp2p network node

Re-exportsΒ§

pub use self::config::DEFAULT_REPLICATION_FACTOR;
pub use self::config::GossipConfig;
pub use self::config::NetworkNodeConfig;
pub use self::config::NetworkNodeConfigBuilder;
pub use self::config::NetworkNodeConfigBuilderError;
pub use self::config::RequestResponseConfig;
pub use self::handle::NetworkNodeHandle;
pub use self::handle::NetworkNodeReceiver;
pub use self::handle::spawn_network_node;

ModulesΒ§

config πŸ”’
configuration for the libp2p network (e.g. how it should be built)
handle πŸ”’
libp2p network handle allows for control over the libp2p network

StructsΒ§

NetworkNode
Network definition

ConstantsΒ§

ESTABLISHED_LIMIT
Wrapped num of connections
ESTABLISHED_LIMIT_UNWR
Number of connections to a single peer before logging an error
MAX_GOSSIP_MSG_SIZE
Maximum size of a message
NO_INBOUND_CONNECTION_GRACE_PERIOD πŸ”’
How long to wait for the first inbound connection.

FunctionsΒ§

direct_message_protocol πŸ”’
Resolve the direct-message stream protocol for the given network discriminator.
gossipsub_prefix πŸ”’
Resolve the gossipsub protocol_id_prefix for the given network discriminator. None returns the mainnet value (the libp2p default).
identify_protocol πŸ”’
Resolve the identify protocol string for the given network discriminator.
kad_protocol πŸ”’
Resolve the kademlia stream protocol for the given network discriminator.
mainnet_direct_message_protocol πŸ”’
mainnet_gossipsub_prefix πŸ”’
Mainnet libp2p protocol identifiers. The snapshot tests below lock these down so a change that would partition mainnet (e.g. a stray protocol_id_prefix call) is caught. None for gossipsub means β€œdo not call protocol_id_prefix” β€” libp2p’s defaults (/meshsub/1.1.0 and /meshsub/1.0.0) are then used.
mainnet_identify_protocol πŸ”’
mainnet_kad_protocol πŸ”’
resolve_put_quorum πŸ”’
should_keep_peer πŸ”’
A peer’s network is identifiable only by its advertised kademlia StreamProtocol.

Type AliasesΒ§

SwarmTaskHandle
Join handle for the spawned swarm event-loop task.