feat: dialProtocol and small refactor

This commit is contained in:
David Dias
2018-02-07 07:48:37 +00:00
parent cd43863db6
commit 6651401f0b
5 changed files with 144 additions and 113 deletions

20
src/content-routing.js Normal file
View File

@ -0,0 +1,20 @@
'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)
}
}
}