build_swarm

Function build_swarm 

Source
pub fn build_swarm(keypair: Keypair) -> Result<Swarm<BillPouchBehaviour>>
Expand description

Construct a fully configured libp2p [Swarm] using the Tokio runtime.

The transport stack is: TCP → Noise (encryption) → Yamux (multiplexing) + a relay-circuit transport for NAT traversal. The behaviour stack is: gossipsub + Kademlia + Identify + mDNS + AutoNAT + relay client.

§Errors

Returns an error if any behaviour or transport component fails to initialise (typically a key encoding issue or an OS-level socket error).