From 2157052794967dddb64bc792814000cbbd9a5613 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Thu, 21 Sep 2023 11:10:24 +1000 Subject: [PATCH] examples: employ consistent naming Resolves: #4459. Pull-Request: #4533. --- Cargo.lock | 12 ++++++------ Cargo.toml | 4 ++-- examples/README.md | 4 ++-- examples/{chat-example => chat}/Cargo.toml | 0 examples/{chat-example => chat}/README.md | 0 examples/{chat-example => chat}/src/main.rs | 0 examples/dcutr/Cargo.toml | 2 +- examples/distributed-key-value-store/Cargo.toml | 2 +- examples/file-sharing/Cargo.toml | 2 +- examples/identify/Cargo.toml | 2 +- examples/ipfs-kad/Cargo.toml | 2 +- examples/ipfs-private/Cargo.toml | 2 +- examples/{ping-example => ping}/Cargo.toml | 0 examples/{ping-example => ping}/README.md | 0 examples/{ping-example => ping}/src/main.rs | 0 libp2p/src/tutorials/hole_punching.rs | 8 ++++---- 16 files changed, 20 insertions(+), 20 deletions(-) rename examples/{chat-example => chat}/Cargo.toml (100%) rename examples/{chat-example => chat}/README.md (100%) rename examples/{chat-example => chat}/src/main.rs (100%) rename examples/{ping-example => ping}/Cargo.toml (100%) rename examples/{ping-example => ping}/README.md (100%) rename examples/{ping-example => ping}/src/main.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index e4db408a8f5..96d9696995e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1227,7 +1227,7 @@ dependencies = [ ] [[package]] -name = "dcutr" +name = "dcutr-example" version = "0.1.0" dependencies = [ "clap", @@ -1316,7 +1316,7 @@ dependencies = [ ] [[package]] -name = "distributed-key-value-store" +name = "distributed-key-value-store-example" version = "0.1.0" dependencies = [ "async-std", @@ -1528,7 +1528,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0870c84016d4b481be5c9f323c24f65e31e901ae618f0e80f4308fb00de1d2d" [[package]] -name = "file-sharing" +name = "file-sharing-example" version = "0.1.0" dependencies = [ "async-std", @@ -2061,7 +2061,7 @@ dependencies = [ ] [[package]] -name = "identify" +name = "identify-example" version = "0.1.0" dependencies = [ "async-std", @@ -2249,7 +2249,7 @@ dependencies = [ ] [[package]] -name = "ipfs-kad" +name = "ipfs-kad-example" version = "0.1.0" dependencies = [ "async-std", @@ -2260,7 +2260,7 @@ dependencies = [ ] [[package]] -name = "ipfs-private" +name = "ipfs-private-example" version = "0.1.0" dependencies = [ "async-std", diff --git a/Cargo.toml b/Cargo.toml index 0cf485e803d..9b703d9c4ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = [ "core", "examples/autonat", "examples/browser-webrtc", - "examples/chat-example", + "examples/chat", "examples/dcutr", "examples/distributed-key-value-store", "examples/file-sharing", @@ -11,7 +11,7 @@ members = [ "examples/ipfs-kad", "examples/ipfs-private", "examples/metrics", - "examples/ping-example", + "examples/ping", "examples/relay-server", "examples/rendezvous", "examples/upnp", diff --git a/examples/README.md b/examples/README.md index a8a07be0cbf..28e085587b7 100644 --- a/examples/README.md +++ b/examples/README.md @@ -7,7 +7,7 @@ A set of examples showcasing how to use rust-libp2p. ## Individual libp2p features -- [Chat](./chat-example) A basic chat application demonstrating libp2p and the mDNS and Gossipsub protocols. +- [Chat](./chat) A basic chat application demonstrating libp2p and the mDNS and Gossipsub protocols. - [Distributed key-value store](./distributed-key-value-store) A basic key value store demonstrating libp2p and the mDNS and Kademlia protocol. - [File sharing application](./file-sharing) Basic file sharing application with peers either providing or locating and getting files by name. @@ -20,6 +20,6 @@ A set of examples showcasing how to use rust-libp2p. - [IPFS Private](./ipfs-private) Implementation using the gossipsub, ping and identify protocols to implement the ipfs private swarms feature. -- [Ping](./ping-example) Small `ping` clone, sending a ping to a peer, expecting a pong as a response. See [tutorial](../src/tutorials/ping.rs) for a step-by-step guide building the example. +- [Ping](./ping) Small `ping` clone, sending a ping to a peer, expecting a pong as a response. See [tutorial](../src/tutorials/ping.rs) for a step-by-step guide building the example. - [Rendezvous](./rendezvous) Rendezvous Protocol. See [specs](https://github.com/libp2p/specs/blob/master/rendezvous/README.md). diff --git a/examples/chat-example/Cargo.toml b/examples/chat/Cargo.toml similarity index 100% rename from examples/chat-example/Cargo.toml rename to examples/chat/Cargo.toml diff --git a/examples/chat-example/README.md b/examples/chat/README.md similarity index 100% rename from examples/chat-example/README.md rename to examples/chat/README.md diff --git a/examples/chat-example/src/main.rs b/examples/chat/src/main.rs similarity index 100% rename from examples/chat-example/src/main.rs rename to examples/chat/src/main.rs diff --git a/examples/dcutr/Cargo.toml b/examples/dcutr/Cargo.toml index dd30a51c7a2..852083d0977 100644 --- a/examples/dcutr/Cargo.toml +++ b/examples/dcutr/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "dcutr" +name = "dcutr-example" version = "0.1.0" edition = "2021" publish = false diff --git a/examples/distributed-key-value-store/Cargo.toml b/examples/distributed-key-value-store/Cargo.toml index f8e0fd2339d..d128d6bbc51 100644 --- a/examples/distributed-key-value-store/Cargo.toml +++ b/examples/distributed-key-value-store/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "distributed-key-value-store" +name = "distributed-key-value-store-example" version = "0.1.0" edition = "2021" publish = false diff --git a/examples/file-sharing/Cargo.toml b/examples/file-sharing/Cargo.toml index 555a8e9c188..03745aacb00 100644 --- a/examples/file-sharing/Cargo.toml +++ b/examples/file-sharing/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "file-sharing" +name = "file-sharing-example" version = "0.1.0" edition = "2021" publish = false diff --git a/examples/identify/Cargo.toml b/examples/identify/Cargo.toml index 0fba5a0b3b8..fb14aeba4a5 100644 --- a/examples/identify/Cargo.toml +++ b/examples/identify/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "identify" +name = "identify-example" version = "0.1.0" edition = "2021" publish = false diff --git a/examples/ipfs-kad/Cargo.toml b/examples/ipfs-kad/Cargo.toml index 94587a90fbd..0526060eaa6 100644 --- a/examples/ipfs-kad/Cargo.toml +++ b/examples/ipfs-kad/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ipfs-kad" +name = "ipfs-kad-example" version = "0.1.0" edition = "2021" publish = false diff --git a/examples/ipfs-private/Cargo.toml b/examples/ipfs-private/Cargo.toml index 7871e5c41f5..278611e6aa1 100644 --- a/examples/ipfs-private/Cargo.toml +++ b/examples/ipfs-private/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ipfs-private" +name = "ipfs-private-example" version = "0.1.0" edition = "2021" publish = false diff --git a/examples/ping-example/Cargo.toml b/examples/ping/Cargo.toml similarity index 100% rename from examples/ping-example/Cargo.toml rename to examples/ping/Cargo.toml diff --git a/examples/ping-example/README.md b/examples/ping/README.md similarity index 100% rename from examples/ping-example/README.md rename to examples/ping/README.md diff --git a/examples/ping-example/src/main.rs b/examples/ping/src/main.rs similarity index 100% rename from examples/ping-example/src/main.rs rename to examples/ping/src/main.rs diff --git a/libp2p/src/tutorials/hole_punching.rs b/libp2p/src/tutorials/hole_punching.rs index c184274bbb0..5fd74fe754e 100644 --- a/libp2p/src/tutorials/hole_punching.rs +++ b/libp2p/src/tutorials/hole_punching.rs @@ -122,16 +122,16 @@ //! //! ``` bash //! ## Inside the rust-libp2p repository. -//! cargo build --bin dcutr +//! cargo build --bin dcutr-example //! ``` //! -//! You can find the binary at `target/debug/dcutr`. In case you built it locally, copy +//! You can find the binary at `target/debug/dcutr-example`. In case you built it locally, copy //! it to your listening client machine. //! //! On the listening client machine: //! //! ``` bash -//! RUST_LOG=info ./dcutr --secret-key-seed 1 --mode listen --relay-address /ip4/$RELAY_SERVER_IP/tcp/4001/p2p/12D3KooWDpJ7As7BWAwRMfu1VU2WCqNjvq387JEYKDBj4kx6nXTN +//! RUST_LOG=info ./dcutr-example --secret-key-seed 1 --mode listen --relay-address /ip4/$RELAY_SERVER_IP/tcp/4001/p2p/12D3KooWDpJ7As7BWAwRMfu1VU2WCqNjvq387JEYKDBj4kx6nXTN //! //! [2022-05-11T10:38:52Z INFO client] Local peer id: PeerId("XXX") //! [2022-05-11T10:38:52Z INFO client] Listening on "/ip4/127.0.0.1/tcp/44703" @@ -153,7 +153,7 @@ //! ## Connecting to the listening client from the dialing client //! //! ``` bash -//! RUST_LOG=info ./dcutr --secret-key-seed 2 --mode dial --relay-address /ip4/$RELAY_SERVER_IP/tcp/4001/p2p/12D3KooWDpJ7As7BWAwRMfu1VU2WCqNjvq387JEYKDBj4kx6nXTN --remote-peer-id 12D3KooWPjceQrSwdWXPyLLeABRXmuqt69Rg3sBYbU1Nft9HyQ6X +//! RUST_LOG=info ./dcutr-example --secret-key-seed 2 --mode dial --relay-address /ip4/$RELAY_SERVER_IP/tcp/4001/p2p/12D3KooWDpJ7As7BWAwRMfu1VU2WCqNjvq387JEYKDBj4kx6nXTN --remote-peer-id 12D3KooWPjceQrSwdWXPyLLeABRXmuqt69Rg3sBYbU1Nft9HyQ6X //! ``` //! //! You should see the following logs appear: