Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit eebaa07

Browse files
committed
docs: changes based on robs review
1 parent 7d66a0f commit eebaa07

File tree

3 files changed

+27
-23
lines changed

3 files changed

+27
-23
lines changed

examples/circuit-relaying/README.md

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ Circuit relay consists of two logical parts - dialer/listener and relay (`HOP`).
4747
- The `relay` (`HOP`) knows how to contact a destination node (`STOP`) and create a circuit - `Relay` node
4848
- The `listener` (`STOP`) knows how to process relay requests that come from the relay (`HOP`) node - `Node B`
4949

50-
These are also the names used by circuit internally to identify the network message types.
50+
_Fun fact - the `HOP` and `STOP` names are also used internally by circuit to identify the network message types._
5151

5252
#### A few caveats (and features).
5353

5454
There are a couple of caveats and features to be aware of
5555

56-
- Currently a `Relay` will only work if it already has a connection to the node being relayed to
57-
- No `multihop` dialing is supported, although its a planed feature for upcoming releases (no date on this one)
58-
- multihop dialing is when several relays are used to establish the connection
56+
- A `Relay` will only work if it already has a connection to the `STOP` node
57+
- No `multihop` dialing is supported. Although it's a feature planed for upcoming releases (no date on this one)
58+
- Multihop dialing is when several relays are used to establish the connection
5959
- It is possible to use explicit relay addresses to connect to a node, or even to listen for connections on. See next section to learn how to do this.
6060

6161
#### A word on circuit relay addresses
@@ -78,20 +78,22 @@ We can take it a step further and encode the same information for the destinatio
7878

7979
- `/ip4/127.0.0.1/tcp/65000/ipfs/QmRelay/p2p-circuit`
8080

81-
If a node is configured with this address, it will use the specified host (`/ip4/127.0.0.1/tcp/65000/ipfs/QmRelay`) as a relay and it will be reachable over this relay. There could multiple addresses of this sort specified in the config, in which case the node is going to be reachable over all of them. This is useful if for example, the node is behind a firewall but wants to be reachable from the outside over a specific relay.
81+
If a node is configured with this address, it will use the specified host (`/ip4/127.0.0.1/tcp/65000/ipfs/QmRelay`) as a relay and it will be reachable over this relay.
82+
- There could multiple addresses of this sort specified in the config, in which case the node is going to be reachable over all of them.
83+
- This is useful if for example, the node is behind a firewall but wants to be reachable from the outside over a specific relay.
8284

83-
Other use-cases are also supported by this scheme, i.e. we can have multiple hops (circuit-relay nodes) encoded in the address, something planed for future releases.
85+
Other use-cases are also supported by this scheme, e.g. we can have multiple hops (circuit-relay nodes) encoded in the address, something planed for future releases.
8486

8587
## Step-by-step instructions
8688

8789
Here's what we are going to be doing, today:
8890

89-
- 1. Install and configure `go-ipfs` and `js-ipfs` nodes
90-
- 2. Configure and run the js or go ipfs node
91-
- 3. Configure and run the bundled example
92-
- 4. Connect the two browser nodes to the circuit relay
93-
- 5. Dial the two browser nodes using a `/p2p-circuit` address
94-
- 6. Finally, send data from one browser using the bundled example!
91+
1. Install and configure `go-ipfs` and `js-ipfs` nodes
92+
2. Configure and run the js or go ipfs node
93+
3. Configure and run the bundled example
94+
4. Connect the two browser nodes to the circuit relay
95+
5. Dial the two browser nodes using a `/p2p-circuit` address
96+
6. Finally, send data from one browser using the bundled example!
9597

9698
> We should end up with something similar to the bellow screenshot after we've gone through all the steps:
9799
@@ -129,7 +131,7 @@ This will set up your IPFS repo in your home directory.
129131

130132
#### Configure and run the js or go ipfs node
131133

132-
We can either use a `go-ipfs` or a `js-ipfs` node as a relay, we'll demonstrate how to set them up in this tutorial and we encourage you to try them both out. That said, either js or go should do the trick for the purpose of this tutorial!
134+
We can either use a `go-ipfs` or a `js-ipfs` node as a relay, we'll demonstrate how to set them up in this tutorial and we encourage you to try them both out. That said, either js or go should do the trick!
133135

134136
##### Setting up a `go-ipfs` node
135137

@@ -190,7 +192,7 @@ Note that we don't have to do anything to enable the `websocket` transport as it
190192

191193
We can start the relay nodes by either doing `ipfs daemon` or `jsipfs daemon`:
192194

193-
> go ipfs
195+
**go ipfs**
194196

195197
```
196198
$ ipfs daemon
@@ -229,7 +231,7 @@ $ ipfs id
229231

230232
We can then grab the resolved multiaddr from the `Addresses` array - `/ip4/127.0.0.1/tcp/4004/ws/ipfs/Qm...`. Lets note it down somewhere and move to the next step.
231233

232-
> js ipfs
234+
**js ipfs**
233235

234236
```
235237
$ jsipfs daemon
@@ -247,7 +249,7 @@ Daemon is ready
247249

248250
Look out for an address similar to `/ip4/127.0.0.1/tcp/4003/ws/ipfs/Qm...` note it down somewhere, and lets move on to the next step.
249251

250-
### Configure and run the bundled example
252+
### 2. Configure and run the bundled example
251253

252254
Now that we have ipfs installed and initialized, lets set up the included example. This is a standard npm package, so the usual `npm install` should get us going. Lets `cd` into the `examples/circuit-relaying` directory and run:
253255

@@ -266,21 +268,23 @@ The bundled example is a simple chat app that uses another cool ipfs feature - [
266268

267269
![](./img/img1.png)
268270

269-
### Connect the two browser nodes to the circuit relay
271+
### 3. Connect the two browser nodes to the circuit relay
270272

271-
In order for our browser nodes to be able to send messages to each other, we need to first get them connected, but for that we need to use the relay, remember, browser nodes can't be dialed directly because of lack of socket support, so the relay is here to solve that.
273+
In order for our browser nodes to be able to messages each other, we need to get them connected. But do do that, we need to use a relay - browser nodes can't be connected directly because of lack of socket support.
272274

273-
Enter the `/ip4/127.0.0.1/tcp/4003/ws/ipfs/...` address noted above into the `Connect to Peer` field and hit the connect button:
275+
Remember the caveat above `Currently a Relay will only work if it already has a connection to the STOP node`? This means that we need to connect our browser nodes to the relay node first.
276+
277+
Having both browsers running side by side (as shown in the first screenshot), enter the `/ip4/127.0.0.1/tcp/4003/ws/ipfs/...` address noted above into the `Connect to Peer` field and hit the `Connect` button:
274278

275279
![](./img/img3.png)
276280

277-
After connecting to the IPFS node, we should see the peer show up under the `Peers Connected` box.
281+
After connecting to the IPFS node, we should see the relay peer show up under the `Peers Connected` box.
278282

279283
![](./img/img4.png)
280284

281-
Now lets repeat the same steps with the second tab. After that, both of our browser nodes should be connected and we can move on to the next step.
285+
Lets repeat the same steps with the second tab. Now, both of our browser nodes should be connected to the relay and we can move on to the next step.
282286

283-
### Dial the two browser nodes using a `/p2p-circuit` address
287+
### 4. Dial the two browser nodes using a `/p2p-circuit` address
284288

285289
Having both browsers running side by side (as shown in the first screenshot), lets get them connected to each other. Head out to the `Addresses` box in one of the tabs, copy the `/p2p-circuit` address and then paste it into the `Connect to Peer` box in the other tab. Repeat these steps on the second tab.
286290

@@ -290,7 +294,7 @@ Lets hit the `Connect` button on each of the tabs and we should get the two brow
290294

291295
![](./img/img6.png)
292296

293-
### Send data browser to browser.
297+
### 5. Send data browser to browser.
294298

295299
Now that we have the two browsers connected, lets try the app out. Type a few words in one of the browser windows and you should see them appear in the other as well!
296300

102 KB
Loading
118 KB
Loading

0 commit comments

Comments
 (0)