mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-26 00:01:33 +00:00
docs(examples): add a README to each example
Resolves #3853. Pull-Request: #3974.
This commit is contained in:
@ -18,32 +18,7 @@
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
//! A basic chat application with logs demonstrating libp2p and the gossipsub protocol
|
||||
//! combined with mDNS for the discovery of peers to gossip with.
|
||||
//!
|
||||
//! Using two terminal windows, start two instances, typing the following in each:
|
||||
//!
|
||||
//! ```sh
|
||||
//! cargo run
|
||||
//! ```
|
||||
//!
|
||||
//! Mutual mDNS discovery may take a few seconds. When each peer does discover the other
|
||||
//! it will print a message like:
|
||||
//!
|
||||
//! ```sh
|
||||
//! mDNS discovered a new peer: {peerId}
|
||||
//! ```
|
||||
//!
|
||||
//! Type a message and hit return: the message is sent and printed in the other terminal.
|
||||
//! Close with Ctrl-c.
|
||||
//!
|
||||
//! You can open more terminal windows and add more peers using the same line above.
|
||||
//!
|
||||
//! Once an additional peer is mDNS discovered it can participate in the conversation
|
||||
//! and all peers will receive messages sent from it.
|
||||
//!
|
||||
//! If a participant exits (Control-C or otherwise) the other peers will receive an mDNS expired
|
||||
//! event and remove the expired peer from the list of known peers.
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
||||
use async_std::io;
|
||||
use futures::{future::Either, prelude::*, select};
|
||||
|
Reference in New Issue
Block a user