@libp2p/kad-dht 12.0.7 → 12.0.8
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 +23 -4
- package/dist/index.min.js +3 -3
- package/dist/src/index.d.ts +6 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -4
- package/dist/src/index.js.map +1 -1
- package/package.json +19 -18
- package/src/index.ts +6 -4
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# @libp2p/kad-dht
|
|
2
|
+
|
|
1
3
|
[](http://libp2p.io/)
|
|
2
4
|
[](https://discuss.libp2p.io)
|
|
3
5
|
[](https://codecov.io/gh/libp2p/js-libp2p)
|
|
@@ -7,6 +9,21 @@
|
|
|
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
|
This module implements the [libp2p Kademlia spec](https://github.com/libp2p/specs/blob/master/kad-dht/README.md) in TypeScript.
|
|
11
28
|
|
|
12
29
|
The Kademlia DHT allow for several operations such as finding peers, searching for providers of DHT records, etc.
|
|
@@ -20,12 +37,14 @@ import { peerIdFromString } from '@libp2p/peer-id'
|
|
|
20
37
|
|
|
21
38
|
const node = await createLibp2p({
|
|
22
39
|
services: {
|
|
23
|
-
dht: kadDHT(
|
|
40
|
+
dht: kadDHT({
|
|
41
|
+
// DHT options
|
|
42
|
+
})
|
|
24
43
|
}
|
|
25
44
|
})
|
|
26
45
|
|
|
27
46
|
const peerId = peerIdFromString('QmFoo')
|
|
28
|
-
const peerInfo = await
|
|
47
|
+
const peerInfo = await node.peerRouting.findPeer(peerId)
|
|
29
48
|
|
|
30
49
|
console.info(peerInfo) // peer id, multiaddrs
|
|
31
50
|
```
|
|
@@ -51,7 +70,7 @@ const node = await createLibp2p({
|
|
|
51
70
|
})
|
|
52
71
|
|
|
53
72
|
const peerId = peerIdFromString('QmFoo')
|
|
54
|
-
const peerInfo = await
|
|
73
|
+
const peerInfo = await node.peerRouting.findPeer(peerId)
|
|
55
74
|
|
|
56
75
|
console.info(peerInfo) // peer id, multiaddrs
|
|
57
76
|
```
|
|
@@ -78,7 +97,7 @@ const node = await createLibp2p({
|
|
|
78
97
|
})
|
|
79
98
|
|
|
80
99
|
const peerId = peerIdFromString('QmFoo')
|
|
81
|
-
const peerInfo = await
|
|
100
|
+
const peerInfo = await node.peerRouting.findPeer(peerId)
|
|
82
101
|
|
|
83
102
|
console.info(peerInfo) // peer id, multiaddrs
|
|
84
103
|
```
|