39
39
40
40
| Name | Type | Description |
41
41
| ---- | ---- | ----------- |
42
- | peerId | [ PeerID] [ ] or [ CID ] [ ] | The Peer ID of the node to find |
42
+ | peerId | [ PeerID] [ ] | The Peer ID of the node to find |
43
43
44
44
### Options
45
45
@@ -61,7 +61,7 @@ An optional object which may have the following keys:
61
61
``` JavaScript
62
62
const info = await ipfs .dht .findPeer (' QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt' )
63
63
64
- console .log (info .id )
64
+ console .log (info .id . toString () )
65
65
/*
66
66
QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt
67
67
*/
@@ -191,15 +191,15 @@ Prints objects like:
191
191
192
192
{
193
193
extra: 'dial backoff',
194
- id: 'QmWtewmnzJiQevJPSmG9s8aC7yRfK2WXTCdRc1pCbDFu6z',
194
+ id: PeerId( 'QmWtewmnzJiQevJPSmG9s8aC7yRfK2WXTCdRc1pCbDFu6z') ,
195
195
responses: [
196
196
{
197
197
addrs: [
198
198
Multiaddr(/ip4/127.0.0.1/tcp/4001),
199
199
Multiaddr(/ip4/172.20.0.3/tcp/4001),
200
200
Multiaddr(/ip4/35.178.190.196/tcp/1024)
201
201
],
202
- id: 'QmRz5Nth4jTFuJJKcjyb6uwvrhxWbruRvamKY2PJxwJKw8'
202
+ id: PeerId( 'QmRz5Nth4jTFuJJKcjyb6uwvrhxWbruRvamKY2PJxwJKw8')
203
203
}
204
204
],
205
205
type: 1
@@ -258,15 +258,15 @@ Prints objects like:
258
258
259
259
{
260
260
extra: 'dial backoff',
261
- id: 'QmWtewmnzJiQevJPSmG9s8aC7yRfK2WXTCdRc1pCbDFu6z',
261
+ id: PeerId( 'QmWtewmnzJiQevJPSmG9s8aC7yRfK2WXTCdRc1pCbDFu6z') ,
262
262
responses: [
263
263
{
264
264
addrs: [
265
265
Multiaddr(/ip4/127.0.0.1/tcp/4001),
266
266
Multiaddr(/ip4/172.20.0.3/tcp/4001),
267
267
Multiaddr(/ip4/35.178.190.196/tcp/1024)
268
268
],
269
- id: 'QmRz5Nth4jTFuJJKcjyb6uwvrhxWbruRvamKY2PJxwJKw8'
269
+ id: PeerId( 'QmRz5Nth4jTFuJJKcjyb6uwvrhxWbruRvamKY2PJxwJKw8')
270
270
}
271
271
],
272
272
type: 1
@@ -288,7 +288,7 @@ A great source of [examples][] can be found in the tests for this API.
288
288
289
289
## ` ipfs.dht.query(peerId, [options]) `
290
290
291
- > Find the closest Peer IDs to a given Peer ID by querying the DHT.
291
+ > Find the closest Peer IDs to a given Peer ID or CID by querying the DHT.
292
292
293
293
### Parameters
294
294
@@ -331,7 +331,7 @@ Prints objects like:
331
331
Multiaddr(/ip4/172.20.0.3/tcp/4001),
332
332
Multiaddr(/ip4/35.178.190.196/tcp/1024)
333
333
],
334
- id: 'QmRz5Nth4jTFuJJKcjyb6uwvrhxWbruRvamKY2PJxwJKw8'
334
+ id: PeerId( 'QmRz5Nth4jTFuJJKcjyb6uwvrhxWbruRvamKY2PJxwJKw8')
335
335
}
336
336
],
337
337
type: 1
@@ -345,6 +345,6 @@ https://github.com/libp2p/go-libp2p-core/blob/6e566d10f4a5447317a66d64c7459954b9
345
345
A great source of [ examples] [ ] can be found in the tests for this API.
346
346
347
347
[ examples ] : https://github.com/ipfs/js-ipfs/blob/master/packages/interface-ipfs-core/src/dht
348
- [ peerid ] : https://www.npmjs.com/package /peer-id
349
- [ cid ] : https://www.npmjs.com/package/cids
348
+ [ peerid ] : https://docs.libp2p.io/concepts /peer-id/
349
+ [ cid ] : https://docs.ipfs.io/concepts/content-addressing
350
350
[ AbortSignal ] : https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
0 commit comments