Skip to content

Commit 90beabb

Browse files
committed
p2p: additional example
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
1 parent 255f45a commit 90beabb

1 file changed

Lines changed: 28 additions & 3 deletions

File tree

docs/experimental-features.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,17 +241,17 @@ The `p2p` command needs to be enabled in config:
241241

242242
### How to use
243243

244+
**Netcat example:**
245+
244246
First, pick a protocol name for your application. Think of the protocol name as
245247
a port number, just significantly more user-friendly. In this example, we're
246248
going to use `/kickass/1.0`.
247249

248-
**Setup:**
250+
***Setup:***
249251

250252
1. A "server" node with peer ID `$SERVER_ID`
251253
2. A "client" node.
252254

253-
**Netcat example:**
254-
255255
***On the "server" node:***
256256

257257
First, start your application and have it listen for TCP connections on
@@ -296,6 +296,31 @@ exchange messages between netcat instances.
296296

297297
(note that depending on your netcat version you may need to drop the `-v` flag)
298298

299+
**SSH example**
300+
301+
**Setup:**
302+
303+
1. A "server" node with peer ID `$SERVER_ID` and running ssh server on the
304+
default port.
305+
2. A "client" node.
306+
307+
_you can get `$SERVER_ID` by running `ipfs id -f "<id>\n"`_
308+
309+
***First, on the "server" node:***
310+
311+
```sh
312+
ipfs p2p forward ssh /ipfs /ip4/127.0.0.1/tcp/22
313+
```
314+
315+
***Then, on "client" node:***
316+
317+
```sh
318+
ipfs p2p forward ssh /ip4/127.0.0.1/tcp/2222 /ipfs/$SERVER_ID
319+
```
320+
321+
You should now be able to connect to your ssh server through a libp2p connection
322+
with `ssh [user]@127.0.0.1 -p 2222`.
323+
299324

300325
### Road to being a real feature
301326
- [ ] Needs more people to use and report on how well it works / fits use cases

0 commit comments

Comments
 (0)