mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-31 08:51:57 +00:00
docs(examples): add a README to each example
Resolves #3853. Pull-Request: #3974.
This commit is contained in:
23
examples/identify/README.md
Normal file
23
examples/identify/README.md
Normal file
@@ -0,0 +1,23 @@
|
||||
## Description
|
||||
|
||||
The example demonstrates how to create a connection between two nodes using TCP transport, authenticate with the noise protocol, and multiplex data streams with yamux.
|
||||
The library provides a behavior for identity network interactions, allowing nodes to exchange identification information securely.
|
||||
By running the example, the nodes will establish a connection, negotiate the identity protocol, and exchange identification information, which will be displayed in the console.
|
||||
|
||||
## Usage
|
||||
|
||||
1. In the first terminal window, run the following command:
|
||||
```sh
|
||||
cargo run
|
||||
```
|
||||
This will print the peer ID (`PeerId`) and the listening addresses, e.g., `Listening on "/ip4/127.0.0.1/tcp/24915"`
|
||||
|
||||
2. In the second terminal window, start a new instance of the example with the following command:
|
||||
```sh
|
||||
cargo run -- /ip4/127.0.0.1/tcp/24915
|
||||
```
|
||||
The two nodes establish a connection, negotiate the identity protocol, and send each other identification information, which is then printed to the console.
|
||||
|
||||
## Conclusion
|
||||
|
||||
The included identity example demonstrates how to establish connections and exchange identification information between nodes using the library's protocols and behaviors.
|
@@ -18,23 +18,7 @@
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
//! identify example
|
||||
//!
|
||||
//! In the first terminal window, run:
|
||||
//!
|
||||
//! ```sh
|
||||
//! cargo run
|
||||
//! ```
|
||||
//! It will print the [`PeerId`] and the listening addresses, e.g. `Listening on
|
||||
//! "/ip4/127.0.0.1/tcp/24915"`
|
||||
//!
|
||||
//! In the second terminal window, start a new instance of the example with:
|
||||
//!
|
||||
//! ```sh
|
||||
//! cargo run -- /ip4/127.0.0.1/tcp/24915
|
||||
//! ```
|
||||
//! The two nodes establish a connection, negotiate the identify protocol
|
||||
//! and will send each other identify info which is then printed to the console.
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
||||
use futures::prelude::*;
|
||||
use libp2p::{
|
||||
|
Reference in New Issue
Block a user