Skip to content

Commit 0c1ac78

Browse files
authored
src/tutorials/hole-punching: Clarify use of libp2p-lookup & server IP (#2616)
1 parent c427bb3 commit 0c1ac78

File tree

1 file changed

+38
-13
lines changed

1 file changed

+38
-13
lines changed

src/tutorials/hole_punching.rs

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,28 +67,53 @@
6767
//! ```
6868
//!
6969
//! Now let's make sure that the server is public, in other words let's make sure one can reach it
70-
//! through the Internet. From the dialing client:
70+
//! through the Internet. First, either manually replace `$RELAY_SERVER_IP` in the following
71+
//! commands or `export RELAY_SERVER_IP=ipaddr` with the appropriate relay server `ipaddr` in
72+
//! the dailing client and listening client.
73+
//!
74+
//! Now, from the dialing client:
7175
//!
7276
//! 1. Test that you can connect on Layer 3 (IP).
7377
//!
74-
//! ``` bash
75-
//! ping $RELAY_SERVER_IP
76-
//! ```
78+
//! ``` bash
79+
//! ping $RELAY_SERVER_IP
80+
//! ```
7781
//!
7882
//! 2. Test that you can connect on Layer 4 (TCP).
7983
//!
80-
//! ``` bash
81-
//! telnet $RELAY_SERVER_IP 4001
82-
//! ```
84+
//! ``` bash
85+
//! telnet $RELAY_SERVER_IP 4001
86+
//! ```
8387
//!
8488
//! 3. Test that you can connect via libp2p using [`libp2p-lookup`](https://github.com/mxinden/libp2p-lookup).
8589
//!
86-
//! ``` bash
87-
//! ## For IPv4
88-
//! libp2p-lookup direct --address /ip4/$RELAY_SERVER_IP
89-
//! ## For IPv6
90-
//! libp2p-lookup direct --address /ip6/$RELAY_SERVER_IP
91-
//! ```
90+
//! ``` bash
91+
//! ## For IPv4
92+
//! libp2p-lookup direct --address /ip4/$RELAY_SERVER_IP/tcp/4001
93+
//! ## For IPv6
94+
//! libp2p-lookup direct --address /ip6/$RELAY_SERVER_IP/tcp/4001
95+
//! ```
96+
//!
97+
//! The libp2p-lookup output should look something like:
98+
//!
99+
//! ``` bash
100+
//! $ libp2p-lookup direct --address /ip4/111.11.111.111/tcp/4001
101+
//! Lookup for peer with id PeerId("12D3KooWDpJ7As7BWAwRMfu1VU2WCqNjvq387JEYKDBj4kx6nXTN") succeeded.
102+
//!
103+
//! Protocol version: "/TODO/0.0.1"
104+
//! Agent version: "rust-libp2p/0.36.0"
105+
//! Observed address: "/ip4/22.222.222.222/tcp/39212"
106+
//! Listen addresses:
107+
//! - "/ip4/127.0.0.1/tcp/4001"
108+
//! - "/ip4/111.11.111.111/tcp/4001"
109+
//! - "/ip4/10.48.0.5/tcp/4001"
110+
//! - "/ip4/10.124.0.2/tcp/4001"
111+
//! Protocols:
112+
//! - "/libp2p/circuit/relay/0.2.0/hop"
113+
//! - "/ipfs/ping/1.0.0"
114+
//! - "/ipfs/id/1.0.0"
115+
//! - "/ipfs/id/push/1.0.0"
116+
//! ```
92117
//!
93118
//! ## Setting up the listening client
94119
//!

0 commit comments

Comments
 (0)