File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
Leverage other peers in the network to perform Peer Routing calls.
4
4
5
- Requires access to ` /api/v0/dht/findpeer ` HTTP API endpoint of the delegate node.
5
+ Requires access to ` /api/v0/dht/findpeer ` and ` /api/v0/dht/query ` HTTP API endpoints of the delegate node.
6
6
7
7
## Lead Maintainer
8
8
@@ -19,6 +19,7 @@ npm install ipfs-http-client libp2p-delegated-peer-routing
19
19
## Example
20
20
21
21
``` js
22
+ const PeerId = require (' peer-id' )
22
23
const DelegatedPeerRouting = require (' libp2p-delegated-peer-routing' )
23
24
const ipfsHttpClient = require (' ipfs-http-client' )
24
25
37
38
} catch (err) {
38
39
console .error (err)
39
40
}
41
+
42
+ const peerId = await PeerId .create ({ keyType: ' ed25519' })
43
+ for await (const { id , multiaddrs } of routing .getClosestPeers (peerId .id )) {
44
+ console .log (' found closest peer' , id, multiaddrs)
45
+ }
46
+
40
47
```
41
48
42
49
## License
You can’t perform that action at this time.
0 commit comments