p2p: additional example
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
Łukasz Magiera committed
Jun 2, 2018 at 17:21 UTC
9ba8bc56ee99065a6ebf1890fb072219e1dc5767
1 file changed
+28
-3
docs/experimental-features.md
+28
-3
@@ -273,17 +273,17 @@ The `p2p` command needs to be enabled in config:
273
274
### How to use
275
276
+**Netcat example:**
277
+
278
First, pick a protocol name for your application. Think of the protocol name as
279
a port number, just significantly more user-friendly. In this example, we're
280
going to use `/kickass/1.0`.
281
280
-**Setup:**
282
+***Setup:***
283
284
1. A "server" node with peer ID `$SERVER_ID`
285
2. A "client" node.
286
285
-**Netcat example:**
286
-
287
***On the "server" node:***
288
289
First, start your application and have it listen for TCP connections on
@@ -328,6 +328,31 @@ exchange messages between netcat instances.
328
329
(note that depending on your netcat version you may need to drop the `-v` flag)
330
331
+**SSH example**
332
+
333
+**Setup:**
334
+
335
+1. A "server" node with peer ID `$SERVER_ID` and running ssh server on the
336
+ default port.
337
+2. A "client" node.
338
+
339
+_you can get `$SERVER_ID` by running `ipfs id -f "<id>\n"`_
340
+
341
+***First, on the "server" node:***
342
+
343
+```sh
344
+ipfs p2p forward ssh /ipfs /ip4/127.0.0.1/tcp/22
345
+```
346
+
347
+***Then, on "client" node:***
348
+
349
+```sh
350
+ipfs p2p forward ssh /ip4/127.0.0.1/tcp/2222 /ipfs/$SERVER_ID
351
+```
352
+
353
+You should now be able to connect to your ssh server through a libp2p connection
354
+with `ssh [user]@127.0.0.1 -p 2222`.
355
+
356
357
### Road to being a real feature
358
- [ ] Needs more people to use and report on how well it works / fits use cases