p2p: additional example

License: MIT
Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
This commit is contained in:
Łukasz Magiera 2018-06-02 17:21:13 +02:00
parent 830ed48703
commit 9ba8bc56ee

View File

@ -273,17 +273,17 @@ The `p2p` command needs to be enabled in config:
### How to use
**Netcat example:**
First, pick a protocol name for your application. Think of the protocol name as
a port number, just significantly more user-friendly. In this example, we're
going to use `/kickass/1.0`.
**Setup:**
***Setup:***
1. A "server" node with peer ID `$SERVER_ID`
2. A "client" node.
**Netcat example:**
***On the "server" node:***
First, start your application and have it listen for TCP connections on
@ -328,6 +328,31 @@ exchange messages between netcat instances.
(note that depending on your netcat version you may need to drop the `-v` flag)
**SSH example**
**Setup:**
1. A "server" node with peer ID `$SERVER_ID` and running ssh server on the
default port.
2. A "client" node.
_you can get `$SERVER_ID` by running `ipfs id -f "<id>\n"`_
***First, on the "server" node:***
```sh
ipfs p2p forward ssh /ipfs /ip4/127.0.0.1/tcp/22
```
***Then, on "client" node:***
```sh
ipfs p2p forward ssh /ip4/127.0.0.1/tcp/2222 /ipfs/$SERVER_ID
```
You should now be able to connect to your ssh server through a libp2p connection
with `ssh [user]@127.0.0.1 -p 2222`.
### Road to being a real feature
- [ ] Needs more people to use and report on how well it works / fits use cases