@libp2p/kad-dht 10.0.11 → 10.0.12
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 +5 -71
- package/dist/index.min.js +20 -20
- package/dist/src/query/manager.d.ts.map +1 -1
- package/dist/src/query/manager.js +4 -20
- package/dist/src/query/manager.js.map +1 -1
- package/dist/src/query-self.d.ts.map +1 -1
- package/dist/src/query-self.js +2 -7
- package/dist/src/query-self.js.map +1 -1
- package/package.json +11 -12
- package/src/query/manager.ts +4 -17
- package/src/query-self.ts +2 -6
package/README.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# @libp2p/kad-dht <!-- omit in toc -->
|
|
2
|
-
|
|
3
1
|
[](http://libp2p.io/)
|
|
4
2
|
[](https://discuss.libp2p.io)
|
|
5
3
|
[](https://codecov.io/gh/libp2p/js-libp2p)
|
|
@@ -7,28 +5,13 @@
|
|
|
7
5
|
|
|
8
6
|
> JavaScript implementation of the Kad-DHT for libp2p
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- [Install](#install)
|
|
13
|
-
- [Browser `<script>` tag](#browser-script-tag)
|
|
14
|
-
- [Use in Node.js](#use-in-nodejs)
|
|
15
|
-
- [API](#api)
|
|
16
|
-
- [Custom secondary DHT in libp2p](#custom-secondary-dht-in-libp2p)
|
|
17
|
-
- [Peer Routing](#peer-routing)
|
|
18
|
-
- [Content Routing](#content-routing)
|
|
19
|
-
- [Peer Discovery](#peer-discovery)
|
|
20
|
-
- [Spec](#spec)
|
|
21
|
-
- [API Docs](#api-docs)
|
|
22
|
-
- [License](#license)
|
|
23
|
-
- [Contribution](#contribution)
|
|
24
|
-
|
|
25
|
-
## Install
|
|
8
|
+
# Install
|
|
26
9
|
|
|
27
10
|
```console
|
|
28
11
|
$ npm i @libp2p/kad-dht
|
|
29
12
|
```
|
|
30
13
|
|
|
31
|
-
|
|
14
|
+
## Browser `<script>` tag
|
|
32
15
|
|
|
33
16
|
Loading this module through a script tag will make it's exports available as `Libp2pKadDht` in the global namespace.
|
|
34
17
|
|
|
@@ -40,66 +23,17 @@ Loading this module through a script tag will make it's exports available as `Li
|
|
|
40
23
|
> npm i @libp2p/kad-dht
|
|
41
24
|
```
|
|
42
25
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
```js
|
|
46
|
-
import { create } from '@libp2p/kad-dht'
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## API
|
|
50
|
-
|
|
51
|
-
See <https://libp2p.github.io/js-libp2p-kad-dht> for the auto generated docs.
|
|
52
|
-
|
|
53
|
-
The libp2p-kad-dht module offers 3 APIs: Peer Routing, Content Routing and Peer Discovery.
|
|
54
|
-
|
|
55
|
-
### Custom secondary DHT in libp2p
|
|
56
|
-
|
|
57
|
-
```js
|
|
58
|
-
import { createLibp2pNode } from 'libp2p'
|
|
59
|
-
import { kadDHT } from '@libp2p/kad-dht'
|
|
60
|
-
|
|
61
|
-
const node = await createLibp2pNode({
|
|
62
|
-
services: {
|
|
63
|
-
dht: kadDHT()
|
|
64
|
-
}
|
|
65
|
-
//... other config
|
|
66
|
-
})
|
|
67
|
-
await node.start()
|
|
68
|
-
|
|
69
|
-
for await (const event of node.dht.findPeer(node.peerId)) {
|
|
70
|
-
console.info(event)
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Note that you may want to supply your own peer discovery function and datastore
|
|
75
|
-
|
|
76
|
-
### Peer Routing
|
|
77
|
-
|
|
78
|
-
[](https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-interfaces/src/peer-routing)
|
|
79
|
-
|
|
80
|
-
### Content Routing
|
|
81
|
-
|
|
82
|
-
[](https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-interfaces/src/content-routing)
|
|
83
|
-
|
|
84
|
-
### Peer Discovery
|
|
85
|
-
|
|
86
|
-
[](https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-interfaces/src/peer-discovery)
|
|
87
|
-
|
|
88
|
-
## Spec
|
|
89
|
-
|
|
90
|
-
js-libp2p-kad-dht follows the [libp2p/kad-dht spec](https://github.com/libp2p/specs/tree/master/kad-dht) and implements the algorithms described in the [IPFS DHT documentation](https://docs.ipfs.io/concepts/dht/).
|
|
91
|
-
|
|
92
|
-
## API Docs
|
|
26
|
+
# API Docs
|
|
93
27
|
|
|
94
28
|
- <https://libp2p.github.io/js-libp2p/modules/_libp2p_kad_dht.html>
|
|
95
29
|
|
|
96
|
-
|
|
30
|
+
# License
|
|
97
31
|
|
|
98
32
|
Licensed under either of
|
|
99
33
|
|
|
100
34
|
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
|
|
101
35
|
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
|
|
102
36
|
|
|
103
|
-
|
|
37
|
+
# Contribution
|
|
104
38
|
|
|
105
39
|
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
|