You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: update relay example to use current terminology (#203)
Updates the example to reflect current terminology.
Replace references to "auto relay" to just "relay address"
Adds section about configuring auto-tls as an alternative to
manually setting up nginx/SSL
@@ -159,32 +159,37 @@ This should print out something similar to the following:
159
159
```sh
160
160
Node started with id QmerrWofKF358JE6gv3z74cEAyL7z1KqhuUoVfGEynqjRm
161
161
Connected to the HOP relay QmWDn2LY8nannvSWJzruUYoLZ4vV83vfCBwd8DipvdgQc3
162
-
Advertising with a relay address of /ip4/192.168.1.120/tcp/61592/ws/p2p/QmWDn2LY8nannvSWJzruUYoLZ4vV83vfCBwd8DipvdgQc3/p2p-circuit/p2p/QmerrWofKF358JE6gv3z74cEAyL7z1KqhuUoVfGEynqjRm
162
+
Listening on a relay address of /ip4/192.168.1.120/tcp/61592/ws/p2p/QmWDn2LY8nannvSWJzruUYoLZ4vV83vfCBwd8DipvdgQc3/p2p-circuit/p2p/QmerrWofKF358JE6gv3z74cEAyL7z1KqhuUoVfGEynqjRm
163
163
```
164
164
165
-
Per the address, it is possible to verify that the auto relay node is listening
166
-
on the circuit relay node address.
165
+
Per the listening address, it is possible to verify that the listener node is
166
+
indeed listening on the circuit relay node address.
167
167
168
168
Instead of dialing this relay manually, you could set up this node with the
169
-
Bootstrap module and provide it in the bootstrap list. Moreover, you can use
170
-
other `peer-discovery` modules to discover peers in the network and the node
171
-
will automatically bind to the relays that support HOP until reaching the
172
-
maximum number of listeners.
169
+
`@libp2p/bootstrap` module and provide it in the bootstrap list.
170
+
171
+
Alternatively, you can use other `peer-discovery` modules such as
172
+
`@libp2p/kad-dht` which allow your node to perform a random walk of the network
173
+
to discover peers running the Circuit Relay HOP protocol and the node will
174
+
automatically bind to these relays until reaching the maximum number of
175
+
listeners defined by how many `/p2p-circuit` entries in the `address.listen`
176
+
array (usually one is sufficient).
173
177
174
178
## 3. Set up a dialer node for testing connectivity
175
179
176
180
Now that you have a relay node and a node bound to that relay, you can test
Connected to the auto relay node via /ip4/192.168.1.120/tcp/61592/ws/p2p/QmWDn2LY8nannvSWJzruUYoLZ4vV83vfCBwd8DipvdgQc3/p2p-circuit/p2p/QmerrWofKF358JE6gv3z74cEAyL7z1KqhuUoVfGEynqjRm
222
+
Connected to the listening node via /ip4/192.168.1.120/tcp/61592/ws/p2p/QmWDn2LY8nannvSWJzruUYoLZ4vV83vfCBwd8DipvdgQc3/p2p-circuit/p2p/QmerrWofKF358JE6gv3z74cEAyL7z1KqhuUoVfGEynqjRm
215
223
```
216
224
217
225
As you can see from the output, the remote address of the established connection
@@ -223,12 +231,20 @@ Before moving into production, there are a few things that you should take into
223
231
account.
224
232
225
233
A relay node should not advertise its private address in a real world scenario,
226
-
as the node would not be reachable by others. You should provide an array of
227
-
public addresses in the libp2p `addresses.announce` option. If you are using
228
-
websockets, bear in mind that due to browser’s security policies you cannot
229
-
establish unencrypted connection from secure context. The simplest solution is
230
-
to setup SSL with nginx and proxy to the node and setup a domain name for the
231
-
certificate.
234
+
as the node would not be reachable by others.
235
+
236
+
If you are using websockets, bear in mind that due to browser’s security
237
+
policies you cannot establish unencrypted connection from secure context.
238
+
239
+
One solution is to setup TLS with nginx and proxy to the node and setup
240
+
a domain name for the certificate. You can then provide an list of public
241
+
addresses in the libp2p `addresses.announce` config option.
242
+
243
+
Alternatively you can use the public [AutoTLS service](https://blog.libp2p.io/autotls/)
244
+
(provided by [Interplanetary Shipyard](https://blog.ipfs.tech/shipyard-hello-world/))
245
+
to automatically provision a TLS certificate and accompanying domain name - see
246
+
the [js-libp2p-example-auto-tls](https://github.com/libp2p/js-libp2p-example-auto-tls)
0 commit comments