p2p: update docs after refactor
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
Łukasz Magiera committed
May 26, 2018 at 16:15 UTC
e4db7f7a481d80b8112ca14b9382d93dd1873fef
1 file changed
+22
-4
docs/experimental-features.md
+22
-4
@@ -275,7 +275,7 @@ The `p2p` command needs to be enabled in config:
275
276
First, pick a protocol name for your application. Think of the protocol name as
277
a port number, just significantly more user-friendly. In this example, we're
278
-going to use `/p2p/kickass/1.0`.
278
+going to use `/kickass/1.0`.
279
280
**Setup:**
281
@@ -289,7 +289,7 @@ First, start your application and have it listen on `$APP_PORT`.
289
Then, configure the p2p listener by running:
290
291
```sh
292
-> ipfs p2p listener open /p2p/kickass/1.0 /ip4/127.0.0.1/tcp/$APP_PORT
292
+> ipfs p2p forward /kickass/1.0 /ipfs /ip4/127.0.0.1/tcp/$APP_PORT
293
```
294
295
This will configure IPFS to forward all incoming `/p2p/kickass/1.0` streams to
@@ -303,10 +303,28 @@ First, configure the p2p dialer to forward all inbound connections on
303
node.
304
305
```sh
306
-> ipfs p2p stream dial $SERVER_ID /p2p/kickass/1.0 /ip4/127.0.0.1/tcp/$SOME_PORT
306
+> ipfs p2p forward /kickass/1.0 /ip4/127.0.0.1/tcp/$SOME_PORT /ipfs/$SERVER_ID
307
```
308
309
-Next, have your application open a connection to `127.0.0.1:$SOME_PORT`. This connection will be forwarded to the service running on `127.0.0.1:$APP_PORT` on the remote machine.
309
+Next, have your application open a connection to `127.0.0.1:$SOME_PORT`. This
310
+connection will be forwarded to the service running on `127.0.0.1:$APP_PORT` on
311
+the remote machine. You can test it with netcat:
312
+
313
+**On "server" node:**
314
+```sh
315
+> nc -v -l -p $APP_PORT
316
+```
317
+
318
+**On "client" node:**
319
+```sh
320
+> nc -v 127.0.0.1 $SOME_PORT
321
+```
322
+
323
+You should now see that a connection has been established and be able to
324
+exchange messages between netcat instances.
325
+
326
+(note that depending on your netcat version you may need to drop the `-v` flag)
327
+
328
329
### Road to being a real feature
330
- [ ] Needs more people to use and report on how well it works / fits use cases