Skip to content

Commit 018a571

Browse files
committed
docs: update readme
1 parent 13a7996 commit 018a571

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

README.md

+19-5
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,12 @@ const MulticastDNS = require('libp2p-mdns')
116116
const DHT = require('libp2p-kad-dht')
117117
const defaultsDeep = require('@nodeutils/defaults-deep')
118118
const Protector = require('libp2p-pnet')
119+
const DelegatedPeerRouter = require('libp2p-delegated-peer-routing')
120+
const DelegatedContentRouter = require('libp2p-delegated-content-routing')
119121

120122
class Node extends libp2p {
121123
constructor (_options) {
124+
const peerInfo = _options.peerInfo
122125
const defaults = {
123126
// The libp2p modules for this libp2p bundle
124127
modules: {
@@ -133,8 +136,16 @@ class Node extends libp2p {
133136
connEncryption: [
134137
SECIO
135138
],
136-
// Encryption for private networks. Needs additional private key to work
139+
/** Encryption for private networks. Needs additional private key to work **/
137140
// connProtector: new Protector(/*protector specific opts*/),
141+
/** Enable custom content routers, such as delegated routing **/
142+
// contentRouting: [
143+
// new DelegatedContentRouter(peerInfo.id)
144+
// ],
145+
/** Enable custom peer routers, such as delegated routing **/
146+
// peerRouting: [
147+
// new DelegatedPeerRouter()
148+
// ],
138149
peerDiscovery: [
139150
MulticastDNS
140151
],
@@ -229,16 +240,17 @@ Required keys in the `options` object:
229240

230241
`callback` is a function with the following `function (err) {}` signature, where `err` is an Error in case stopping the node fails.
231242

232-
#### `libp2p.peerRouting.findPeer(id, callback)`
243+
#### `libp2p.peerRouting.findPeer(id, timeout, callback)`
233244

234245
> Looks up for multiaddrs of a peer in the DHT
235246
236247
- `id`: instance of [PeerId][]
248+
- `timeout`: Number milliseconds
237249

238250
#### `libp2p.contentRouting.findProviders(key, timeout, callback)`
239251

240252
- `key`: Buffer
241-
- `timeout`: Number miliseconds
253+
- `timeout`: Number milliseconds
242254

243255
#### `libp2p.contentRouting.provide(key, callback)`
244256

@@ -306,14 +318,16 @@ Required keys in the `options` object:
306318
- `key`: Buffer
307319
- `value`: Buffer
308320

309-
#### `libp2p.dht.get(key, callback)`
321+
#### `libp2p.dht.get(key, maxTimeout, callback)`
310322

311323
- `key`: Buffer
324+
- `maxTimeout`: Number milliseconds
312325

313-
#### `libp2p.dht.getMany(key, nVals, callback)`
326+
#### `libp2p.dht.getMany(key, nVals, maxTimeout, callback)`
314327

315328
- `key`: Buffer
316329
- `nVals`: Number
330+
- `maxTimeout`: Number milliseconds
317331

318332
[PeerInfo]: https://github.com/libp2p/js-peer-info
319333
[PeerId]: https://github.com/libp2p/js-peer-id

0 commit comments

Comments
 (0)