@libp2p/circuit-relay-v2 1.0.15 → 1.0.16
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +26 -4
- package/dist/index.min.js +3 -3
- package/dist/src/index.d.ts +9 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -4
- package/dist/src/index.js.map +1 -1
- package/package.json +15 -14
- package/src/index.ts +9 -4
package/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# @libp2p/circuit-relay-v2
|
2
|
+
|
1
3
|
[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
|
2
4
|
[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)
|
3
5
|
[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p)
|
@@ -7,10 +9,27 @@
|
|
7
9
|
|
8
10
|
# About
|
9
11
|
|
12
|
+
<!--
|
13
|
+
|
14
|
+
!IMPORTANT!
|
15
|
+
|
16
|
+
Everything in this README between "# About" and "# Install" is automatically
|
17
|
+
generated and will be overwritten the next time the doc generator is run.
|
18
|
+
|
19
|
+
To make changes to this section, please update the @packageDocumentation section
|
20
|
+
of src/index.js or src/index.ts
|
21
|
+
|
22
|
+
To experiment with formatting, please run "npm run docs" from the root of this
|
23
|
+
repo and examine the changes made.
|
24
|
+
|
25
|
+
-->
|
26
|
+
|
10
27
|
The `circuitRelayTransport` allows libp2p to dial and listen on [Circuit Relay](https://docs.libp2p.io/concepts/nat/circuit-relay/)
|
11
28
|
addresses.
|
12
29
|
|
13
|
-
## Example
|
30
|
+
## Example - Use as a transport
|
31
|
+
|
32
|
+
Configuring a transport will let you dial other circuit relay addresses.
|
14
33
|
|
15
34
|
```typescript
|
16
35
|
import { createLibp2p } from 'libp2p'
|
@@ -26,16 +45,19 @@ const node = await createLibp2p({
|
|
26
45
|
The `circuitRelayServer` function allows libp2p to function as a [Circuit Relay](https://docs.libp2p.io/concepts/nat/circuit-relay/)
|
27
46
|
server. This will not work in browsers.
|
28
47
|
|
29
|
-
## Example
|
48
|
+
## Example - Use as a server
|
49
|
+
|
50
|
+
Configuring a server will let you function as a network relay for other
|
51
|
+
nodes.
|
30
52
|
|
31
53
|
```typescript
|
32
54
|
import { createLibp2p } from 'libp2p'
|
33
55
|
import { circuitRelayServer } from '@libp2p/circuit-relay-v2'
|
34
56
|
|
35
57
|
const node = await createLibp2p({
|
36
|
-
services:
|
58
|
+
services: {
|
37
59
|
circuitRelay: circuitRelayServer()
|
38
|
-
|
60
|
+
}
|
39
61
|
})
|
40
62
|
```
|
41
63
|
|