@libp2p/autonat-v2 0.0.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -18
- package/dist/index.min.js.map +2 -2
- package/dist/typedoc-urls.json +8 -0
- package/package.json +11 -9
package/README.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# @libp2p/autonat
|
|
2
|
-
|
|
3
1
|
# @libp2p/autonat-v2
|
|
4
2
|
|
|
5
3
|
[](http://libp2p.io/)
|
|
@@ -7,7 +5,7 @@
|
|
|
7
5
|
[](https://codecov.io/gh/libp2p/js-libp2p)
|
|
8
6
|
[](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amain)
|
|
9
7
|
|
|
10
|
-
> Implementation of the
|
|
8
|
+
> Implementation of the AutoNAT Protocol v2
|
|
11
9
|
|
|
12
10
|
# About
|
|
13
11
|
|
|
@@ -26,31 +24,22 @@ repo and examine the changes made.
|
|
|
26
24
|
|
|
27
25
|
-->
|
|
28
26
|
|
|
29
|
-
The
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
The service dials randomly selected peers with a request to verify it's external addresses.
|
|
33
|
-
The request includes a list of public multiaddrs (addressManager.getObservedAddrs()).
|
|
34
|
-
The remote peers dial that list and respond with the results.
|
|
35
|
-
|
|
36
|
-
The AutoNAT service uses those responses to either:
|
|
37
|
-
|
|
38
|
-
- addressManager.confirmObservedAddr(addr)
|
|
39
|
-
- addressManager.removeObservedAddr(addr)
|
|
27
|
+
The AutoNATv2 service implements the [AutoNAT v2 protocol](https://github.com/libp2p/specs/blob/master/autonat/autonat-v2.md)
|
|
28
|
+
to confirm whether addresses the node is listening on are dialable by remote
|
|
29
|
+
peers.
|
|
40
30
|
|
|
41
|
-
|
|
42
|
-
at addressManager.getObservedAddrs()
|
|
31
|
+
It does not implement NAT hole punching.
|
|
43
32
|
|
|
44
33
|
## Example
|
|
45
34
|
|
|
46
35
|
```typescript
|
|
47
36
|
import { createLibp2p } from 'libp2p'
|
|
48
|
-
import {
|
|
37
|
+
import { autoNATv2 } from '@libp2p/autonat-v2'
|
|
49
38
|
|
|
50
39
|
const node = await createLibp2p({
|
|
51
40
|
// ...other options
|
|
52
41
|
services: {
|
|
53
|
-
autoNAT:
|
|
42
|
+
autoNAT: autoNATv2()
|
|
54
43
|
}
|
|
55
44
|
})
|
|
56
45
|
```
|