2.0.0 • Published 7 months ago

dht-size-up v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 months ago

dht-size-up

Estimate the size of a DHT using find_node queries.

npm install dht-size-up

Usage

const size = require('dht-size-up')
const dht = require('dht-rpc')

var bootstrap = dht({ ephemeral: true })
bootstrap.listen(10001)

createNodes(1000)

function createNodes (n) {
  dht({ bootstrap: ['localhost:10001'] })
    .on('ready', function () {
      if (n === 0) return size(bootstrap, console.log)
      return createNodes(--n)
    })
}

API

size(dht, n = 1000, cb)

Returns an estimate of the size of the DHT or an error to the callback cb. dht should be node capable of performing _find_node queries to the network. n is the number of trials to perform, default is 1000.

License

MIT

2.0.0

7 months ago

1.1.0

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago

0.0.0

4 years ago