Module network

Module network 

Source
Expand description

P2P networking layer built on libp2p.

This module owns the libp2p [Swarm] and exposes two public entry points:

  • build_swarm — constructs the swarm with all four behaviours (gossipsub, Kademlia, Identify, mDNS) and the Noise+Yamux transport.
  • run_network_loop — async task that drives the swarm event loop and processes NetworkCommands sent by the daemon over a Tokio channel.

§Sub-modules

Re-exports§

pub use behaviour::BillPouchBehaviour;
pub use behaviour::FragmentRequest;
pub use behaviour::FragmentResponse;
pub use bootstrap::BootstrapList;
pub use fragment_gossip::FragmentIndexAnnouncement;
pub use fragment_gossip::FragmentPointer;
pub use fragment_gossip::RemoteFragmentIndex;
pub use kad_store::KadPeers;
pub use qos::PeerQos;
pub use qos::QosRegistry;
pub use qos::FAULT_BLACKLISTED;
pub use qos::FAULT_DEGRADED;
pub use qos::FAULT_SUSPECTED;
pub use quality_monitor::run_quality_monitor;
pub use reputation::ReputationRecord;
pub use reputation::ReputationStore;
pub use reputation::ReputationTier;
pub use state::NetworkState;
pub use state::NodeInfo;

Modules§

behaviour
Combined libp2p NetworkBehaviour for BillPouch.
bootstrap
Bootstrap node list for initial WAN peer discovery.
fragment_gossip
Fragment-index gossip — distributed discovery of which Pouch holds which fragment.
kad_store
Persistence for the Kademlia routing table.
qos
Per-peer Quality-of-Service (QoS) tracking.
quality_monitor
Network quality monitor — Ping and Proof-of-Storage challenge loops.
reputation
Peer reputation system — R0..R4 tiers computed from QoS history.
state
Distributed network state maintained via gossip.

Structs§

OutgoingFragment
A single fragment that was pushed to a remote Pouch.

Enums§

NetworkCommand
Commands the daemon can send to the network task over the [mpsc] channel.

Functions§

build_swarm
Construct a fully configured libp2p [Swarm] using the Tokio runtime.
run_network_loop
Drive the P2P event loop until shutdown.

Type Aliases§

OutgoingAssignments
Map of remote Pouch peer IDs → fragments pushed to them.
StorageManagerMap
Shared map of active Pouch StorageManagers, keyed by service_id.