Socket
Socket
Sign inDemoInstall

libp2p-kad-dht

Package Overview
Dependencies
Maintainers
2
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libp2p-kad-dht - npm Package Compare versions

Comparing version 0.11.0 to 0.11.1

5

CHANGELOG.md

@@ -0,1 +1,6 @@

<a name="0.11.1"></a>
## [0.11.1](https://github.com/libp2p/js-libp2p-kad-dht/compare/v0.11.0...v0.11.1) (2018-11-12)
<a name="0.11.0"></a>

@@ -2,0 +7,0 @@ # [0.11.0](https://github.com/libp2p/js-libp2p-kad-dht/compare/v0.10.6...v0.11.0) (2018-11-09)

2

package.json
{
"name": "libp2p-kad-dht",
"version": "0.11.0",
"version": "0.11.1",
"description": "JavaScript implementation of the Kad-DHT for libp2p",

@@ -5,0 +5,0 @@ "leadMaintainer": "Vasco Santos <vasco.santos@moxy.studio>",

@@ -459,2 +459,3 @@ 'use strict'

* @param {number} options.maxTimeout - how long the query should maximally run, in milliseconds (default: 60000)
* @param {number} options.maxNumProviders - maximum number of providers to find
* @param {function(Error, Array<PeerInfo>)} callback

@@ -475,8 +476,7 @@ * @returns {void}

if (!options.maxTimeout) {
options.maxTimeout = c.minute
}
options.maxTimeout = options.maxTimeout || c.minute
options.maxNumProviders = options.maxNumProviders || c.K
this._log('findProviders %s', key.toBaseEncodedString())
this._findNProviders(key, options.maxTimeout, c.K, callback)
this._findNProviders(key, options.maxTimeout, options.maxNumProviders, callback)
}

@@ -483,0 +483,0 @@

@@ -345,2 +345,33 @@ /* eslint-env mocha */

it('find providers', function (done) {
this.timeout(20 * 1000)
const val = values[0]
const tdht = new TestDHT()
tdht.spawn(3, (err, dhts) => {
expect(err).to.not.exist()
series([
(cb) => connect(dhts[0], dhts[1], cb),
(cb) => connect(dhts[1], dhts[2], cb),
(cb) => each(dhts, (dht, cb) => dht.provide(val.cid, cb), cb),
(cb) => dhts[0].findProviders(val.cid, {}, cb),
(cb) => dhts[0].findProviders(val.cid, { maxNumProviders: 2 }, cb)
], (err, res) => {
expect(err).to.not.exist()
// find providers find all the 3 providers
expect(res[3]).to.exist()
expect(res[3]).to.have.length(3)
// find providers limited to a maxium of 2 providers
expect(res[4]).to.exist()
expect(res[4]).to.have.length(2)
done()
})
})
})
it('random-walk', function (done) {

@@ -347,0 +378,0 @@ this.timeout(40 * 1000)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc