From 0c1ac781a214a0cf30e5c756d43e75c99e2ed9c3 Mon Sep 17 00:00:00 2001 From: Wink Saville Date: Mon, 18 Apr 2022 05:41:25 -0700 Subject: [PATCH] src/tutorials/hole-punching: Clarify use of libp2p-lookup & server IP (#2616) --- src/tutorials/hole_punching.rs | 51 +++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/src/tutorials/hole_punching.rs b/src/tutorials/hole_punching.rs index ac2d7c35..a73d66a2 100644 --- a/src/tutorials/hole_punching.rs +++ b/src/tutorials/hole_punching.rs @@ -67,28 +67,53 @@ //! ``` //! //! Now let's make sure that the server is public, in other words let's make sure one can reach it -//! through the Internet. From the dialing client: +//! through the Internet. First, either manually replace `$RELAY_SERVER_IP` in the following +//! commands or `export RELAY_SERVER_IP=ipaddr` with the appropriate relay server `ipaddr` in +//! the dailing client and listening client. +//! +//! Now, from the dialing client: //! //! 1. Test that you can connect on Layer 3 (IP). //! -//! ``` bash -//! ping $RELAY_SERVER_IP -//! ``` +//! ``` bash +//! ping $RELAY_SERVER_IP +//! ``` //! //! 2. Test that you can connect on Layer 4 (TCP). //! -//! ``` bash -//! telnet $RELAY_SERVER_IP 4001 -//! ``` +//! ``` bash +//! telnet $RELAY_SERVER_IP 4001 +//! ``` //! //! 3. Test that you can connect via libp2p using [`libp2p-lookup`](https://github.com/mxinden/libp2p-lookup). //! -//! ``` bash -//! ## For IPv4 -//! libp2p-lookup direct --address /ip4/$RELAY_SERVER_IP -//! ## For IPv6 -//! libp2p-lookup direct --address /ip6/$RELAY_SERVER_IP -//! ``` +//! ``` bash +//! ## For IPv4 +//! libp2p-lookup direct --address /ip4/$RELAY_SERVER_IP/tcp/4001 +//! ## For IPv6 +//! libp2p-lookup direct --address /ip6/$RELAY_SERVER_IP/tcp/4001 +//! ``` +//! +//! The libp2p-lookup output should look something like: +//! +//! ``` bash +//! $ libp2p-lookup direct --address /ip4/111.11.111.111/tcp/4001 +//! Lookup for peer with id PeerId("12D3KooWDpJ7As7BWAwRMfu1VU2WCqNjvq387JEYKDBj4kx6nXTN") succeeded. +//! +//! Protocol version: "/TODO/0.0.1" +//! Agent version: "rust-libp2p/0.36.0" +//! Observed address: "/ip4/22.222.222.222/tcp/39212" +//! Listen addresses: +//! - "/ip4/127.0.0.1/tcp/4001" +//! - "/ip4/111.11.111.111/tcp/4001" +//! - "/ip4/10.48.0.5/tcp/4001" +//! - "/ip4/10.124.0.2/tcp/4001" +//! Protocols: +//! - "/libp2p/circuit/relay/0.2.0/hop" +//! - "/ipfs/ping/1.0.0" +//! - "/ipfs/id/1.0.0" +//! - "/ipfs/id/push/1.0.0" +//! ``` //! //! ## Setting up the listening client //!