Enable advanced dialing requests both on `Swarm` and via `NetworkBehaviourAction`. Users can now trigger a dial with a specific set of addresses, optionally extended via `NetworkBehaviour::addresses_of_peer`. In addition the whole process is now modelled in a type safe way via the builder pattern. Example of a `NetworkBehaviour` requesting a dial to a specific peer with a set of addresses additionally extended through `NetworkBehaviour::addresses_of_peer`: ```rust NetworkBehaviourAction::Dial { opts: DialOpts::peer_id(peer_id) .condition(PeerCondition::Always) .addresses(addresses) .extend_addresses_through_behaviour() .build(), handler, } ``` Example of a user requesting a dial to an unknown peer with a single address via `Swarm`: ```rust swarm1.dial( DialOpts::unknown_peer_id() .address(addr2.clone()) .build() ) ```
Examples
A set of examples showcasing how to use rust-libp2p.
Getting started
-
Small
ping
clone, sending a ping to a peer, expecting a pong as a response. See tutorial for a step-by-step guide building the example.
Individual libp2p protocols
-
A basic chat application demonstrating libp2p and the mDNS and floodsub protocols.
-
Same as the chat example but using the Gossipsub protocol.
-
Same as the chat example but using tokio for all asynchronous tasks and I/O.
-
-
A basic key value store demonstrating libp2p and the mDNS and Kademlia protocol.
-
Demonstrates how to perform Kademlia queries on the IPFS network.
-
Implementation using the gossipsub, ping and identify protocols to implement the ipfs private swarms feature.
-
Discover peers on the same network via the MDNS protocol.
Integration into a larger application
-
Basic file sharing application with peers either providing or locating and getting files by name.
While obviously showcasing how to build a basic file sharing application with the Kademlia and Request-Response protocol, the actual goal of this example is to show how to integrate rust-libp2p into a larger application.