mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-04-04 08:41:05 +00:00
21 lines
433 B
JavaScript
21 lines
433 B
JavaScript
|
'use strict'
|
||
|
|
||
|
module.exports = (node) => {
|
||
|
return {
|
||
|
findProviders: (key, timeout, callback) => {
|
||
|
if (!node._dht) {
|
||
|
return callback(new Error('DHT is not available'))
|
||
|
}
|
||
|
|
||
|
node._dht.findProviders(key, timeout, callback)
|
||
|
},
|
||
|
provide: (key, callback) => {
|
||
|
if (!node._dht) {
|
||
|
return callback(new Error('DHT is not available'))
|
||
|
}
|
||
|
|
||
|
node._dht.provide(key, callback)
|
||
|
}
|
||
|
}
|
||
|
}
|