{"_id":"hyperdht","_rev":"480702","name":"hyperdht","description":"A DHT that supports peer discovery and distributed hole punching","dist-tags":{"latest":"1.3.2"},"maintainers":[{"name":"mafintosh","email":""}],"time":{"modified":"2021-08-05T09:35:00.000Z","created":"2016-09-15T15:42:11.265Z","1.3.2":"2018-09-18T21:56:17.269Z","1.3.1":"2018-09-18T00:44:35.590Z","1.3.0":"2017-04-22T10:35:32.965Z","1.2.0":"2017-02-05T05:49:58.348Z","1.1.0":"2017-02-05T05:13:15.139Z","1.0.0":"2017-02-05T05:05:02.943Z","0.0.0":"2016-09-15T15:42:11.265Z"},"users":{},"author":{"name":"Mathias Buus","url":"@mafintosh"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/hyperdht.git"},"versions":{"1.3.2":{"name":"hyperdht","version":"1.3.2","description":"A DHT that supports peer discovery and distributed hole punching","main":"index.js","dependencies":{"buffer-equals":"^1.0.4","dht-rpc":"^3.0.1","inherits":"^2.0.3","ipv4-peers":"^1.1.1","minimist":"^1.2.0","protocol-buffers":"^3.2.1","unordered-set":"^2.0.0"},"devDependencies":{"standard":"^8.0.0"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/hyperdht.git"},"scripts":{"test":"standard"},"bin":{"hyperdht":"./bin.js"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/hyperdht/issues"},"homepage":"https://github.com/mafintosh/hyperdht","gitHead":"fcbae09f1495046c3cad6732b5de54073f3bfb83","_id":"hyperdht@1.3.2","_npmVersion":"6.2.0","_nodeVersion":"10.9.0","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"fdd7f0a66c1963bb431f35100f844c580cd98be5","size":5709,"noattachment":false,"key":"/hyperdht/-/hyperdht-1.3.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/hyperdht/download/hyperdht-1.3.2.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hyperdht_1.3.2_1537307777050_0.41039706705069245"},"_hasShrinkwrap":false,"publish_time":1537307777269,"_cnpm_publish_time":1537307777269},"1.3.1":{"name":"hyperdht","version":"1.3.1","description":"A DHT that supports peer discovery and distributed hole punching","main":"index.js","dependencies":{"buffer-equals":"^1.0.4","dht-rpc":"^2.3.0","inherits":"^2.0.3","ipv4-peers":"^1.1.1","minimist":"^1.2.0","protocol-buffers":"^3.2.1","unordered-set":"^2.0.0"},"devDependencies":{"standard":"^8.0.0"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/hyperdht.git"},"scripts":{"test":"standard"},"bin":{"hyperdht":"./bin.js"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/hyperdht/issues"},"homepage":"https://github.com/mafintosh/hyperdht","gitHead":"fe1ed1f3b2d04271335fc316e0bb19c1f8b582f4","_id":"hyperdht@1.3.1","_npmVersion":"6.2.0","_nodeVersion":"10.9.0","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"f907e7ce20872ec057484a09d3d3c6fc56137a21","size":5710,"noattachment":false,"key":"/hyperdht/-/hyperdht-1.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/hyperdht/download/hyperdht-1.3.1.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hyperdht_1.3.1_1537231475459_0.05054887952448883"},"_hasShrinkwrap":false,"publish_time":1537231475590,"_cnpm_publish_time":1537231475590},"1.3.0":{"name":"hyperdht","version":"1.3.0","description":"A DHT that supports peer discovery and distributed hole punching","main":"index.js","dependencies":{"buffer-equals":"^1.0.4","dht-rpc":"^2.3.0","inherits":"^2.0.3","ipv4-peers":"^1.1.1","minimist":"^1.2.0","protocol-buffers":"^3.2.1","unordered-set":"^2.0.0"},"devDependencies":{"standard":"^8.0.0"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/hyperdht.git"},"scripts":{"test":"standard"},"bin":{"hyperdht":"./bin.js"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/hyperdht/issues"},"homepage":"https://github.com/mafintosh/hyperdht","gitHead":"c440f3d759ff219351e0013e3c575ecdb7501715","_id":"hyperdht@1.3.0","_shasum":"5b91a0e8ba77c117c5f34387e5c7e31e3d632ecc","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"5b91a0e8ba77c117c5f34387e5c7e31e3d632ecc","size":5543,"noattachment":false,"key":"/hyperdht/-/hyperdht-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/hyperdht/download/hyperdht-1.3.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/hyperdht-1.3.0.tgz_1492857331112_0.32416189392097294"},"directories":{},"publish_time":1492857332965,"_cnpm_publish_time":1492857332965,"_hasShrinkwrap":false},"1.2.0":{"name":"hyperdht","version":"1.2.0","description":"A DHT that supports peer discovery and distributed hole punching","main":"index.js","dependencies":{"buffer-equals":"^1.0.4","dht-rpc":"^2.3.0","inherits":"^2.0.3","ipv4-peers":"^1.1.1","minimist":"^1.2.0","protocol-buffers":"^3.2.1","unordered-set":"^2.0.0"},"devDependencies":{"standard":"^8.0.0"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/hyperdht.git"},"scripts":{"test":"standard"},"bin":{"hyperdht":"./bin.js"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/hyperdht/issues"},"homepage":"https://github.com/mafintosh/hyperdht","gitHead":"8fbdf828ff649f9d0435627df1ac10b3fcde2be7","_id":"hyperdht@1.2.0","_shasum":"85e8e0ccd7624f9ac28e410e3c37db7a165e8824","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"85e8e0ccd7624f9ac28e410e3c37db7a165e8824","size":5508,"noattachment":false,"key":"/hyperdht/-/hyperdht-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/hyperdht/download/hyperdht-1.2.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/hyperdht-1.2.0.tgz_1486273796407_0.36596730002202094"},"directories":{},"publish_time":1486273798348,"_cnpm_publish_time":1486273798348,"_hasShrinkwrap":false},"1.1.0":{"name":"hyperdht","version":"1.1.0","description":"A DHT that supports peer discovery and distributed hole punching","main":"index.js","dependencies":{"buffer-equals":"^1.0.4","dht-rpc":"^2.2.0","inherits":"^2.0.3","ipv4-peers":"^1.1.1","minimist":"^1.2.0","protocol-buffers":"^3.2.1","unordered-set":"^2.0.0"},"devDependencies":{"standard":"^8.0.0"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/hyperdht.git"},"scripts":{"test":"standard"},"bin":{"hyperdht":"./bin.js"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/hyperdht/issues"},"homepage":"https://github.com/mafintosh/hyperdht","gitHead":"438d01fb93bb9b7f53a6e8c8eaaf070d52118345","_id":"hyperdht@1.1.0","_shasum":"4e3e732a74082e1a97fa872e60d23f988c0d1a7c","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"4e3e732a74082e1a97fa872e60d23f988c0d1a7c","size":5395,"noattachment":false,"key":"/hyperdht/-/hyperdht-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/hyperdht/download/hyperdht-1.1.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/hyperdht-1.1.0.tgz_1486271594894_0.0289267695043236"},"directories":{},"publish_time":1486271595139,"_cnpm_publish_time":1486271595139,"_hasShrinkwrap":false},"1.0.0":{"name":"hyperdht","version":"1.0.0","description":"A DHT that supports peer discovery and distributed hole punching","main":"index.js","dependencies":{"buffer-equals":"^1.0.4","dht-rpc":"^2.2.0","inherits":"^2.0.3","ipv4-peers":"^1.1.1","minimist":"^1.2.0","protocol-buffers":"^3.2.1","unordered-set":"^2.0.0"},"devDependencies":{"standard":"^8.0.0"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/hyperdht.git"},"scripts":{"test":"standard"},"bin":{"hyperdht":"./bin.js"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/hyperdht/issues"},"homepage":"https://github.com/mafintosh/hyperdht","gitHead":"2a104d54c2b950885a9e94b09c0198e8b543cb89","_id":"hyperdht@1.0.0","_shasum":"894907fa6bad188b082982d9cc3c9324d85c9f75","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.9.5","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"894907fa6bad188b082982d9cc3c9324d85c9f75","size":5312,"noattachment":false,"key":"/hyperdht/-/hyperdht-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/hyperdht/download/hyperdht-1.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/hyperdht-1.0.0.tgz_1486271101024_0.39437607675790787"},"directories":{},"publish_time":1486271102943,"_cnpm_publish_time":1486271102943,"_hasShrinkwrap":false},"0.0.0":{"name":"hyperdht","version":"0.0.0","description":"WIP dht based on kademlia, with a focus on extensibility + modularity","main":"index.js","dependencies":{"inherits":"^2.0.3","ipv4-peers":"^1.1.1","k-bucket":"^3.2.1","protocol-buffers":"^3.1.6"},"devDependencies":{"standard":"^8.0.0"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/hyperdht.git"},"scripts":{"test":"standard"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/hyperdht/issues"},"homepage":"https://github.com/mafintosh/hyperdht","gitHead":"8b7592a2a1d6f466cf9ef2cab91201988a04162b","_id":"hyperdht@0.0.0","_shasum":"2677342cf54801703f96380cb8c66514a5856188","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.4.3","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"2677342cf54801703f96380cb8c66514a5856188","size":5151,"noattachment":false,"key":"/hyperdht/-/hyperdht-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/hyperdht/download/hyperdht-0.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/hyperdht-0.0.0.tgz_1473954129892_0.4549643495120108"},"directories":{},"publish_time":1473954131265,"_cnpm_publish_time":1473954131265,"_hasShrinkwrap":false}},"readme":"# hyperdht\n\nA DHT that supports peer discovery and distributed hole punching\n\n```\nnpm install hyperdht\n```\n\n## Usage\n\nFirst run a bootstrap node\n\n``` sh\nnpm install -g dht-rpc-bootstrap\ndht-rpc-bootstrap --port=10000\n```\n\n``` js\nvar hyperdht = require('hyperdht')\n\nvar a = hyperdht({\n  bootstrap: ['localhost:10000']\n})\n\nvar b = hyperdht({\n  bootstrap: ['localhost:10000']\n})\n\na.ready(function () {\n  // announce on a 32 byte key\n  var key = new Buffer('01234567012345670123456701234567')\n\n  b.announce(key, {port: 10000}, function (err) {\n    if (err) throw err\n\n    var stream = a.lookup(key)\n\n    stream.on('data', function (data) {\n      console.log('found peers:', data)\n    })\n  })\n})\n```\n\n## Usage\n\n#### `var dht = hyperdht([options])`\n\nCreate a new dht. Options are passed to the [dht-rpc](https://github.com/mafintosh/dht-rpc) constructor\n\n#### `var stream = dht.announce(key, [options], [callback])`\n\nAnnounce that you are listening on a key. Options include\n\n``` js\n{\n  port: 10000, // port you are listening. If omitted the udp sockets port is used\n  localAddress: {\n    host: '192.168.1.2', // announce that you are listening on a local address also\n    port: 8888\n  }\n}\n```\n\nThe returned stream will emit peers as they are discovered during the announce face.\nThe data events look like this\n\n``` js\n{\n  node: {\n    host: '10.4.2.4', // dht node's host\n    port: 42424 // dht node's port\n  },\n  peers: [{\n    host: '4.41.3.4', // a peer host\n    port: 4244, // a peer port\n  }],\n  localPeers: [{\n    host: '192.168.3.4', // a local peer host\n    port: 4244, // a local peer port\n  }]\n}\n```\n\nLocal peers will only contain addresses that share the first two parts of your local address (`192.168` in the example).\nBoth `peers` and `localPeers` will *not* contain your own address.\n\nIf you provide the callback the stream will be buffers and an array of results is passed.\nNote that you should keep announcing yourself at regular intervals (fx every 4-5min)\n\n#### `var stream = dht.lookup(key, [options], [callback])`\n\nFind peers but do not announce. Accepts the same options as `announce` and returns a similar stream.\n\n#### `dht.unannounce(key, [options], [callback])`\n\nRemove yourself from the DHT. Pass the same options as you used to announce yourself.\n\n#### `dht.ping(peer, callback)`\n\nPing a another DHT peer. Useful if you want to see if you can connect to a node without holepunching.\n\n#### `dht.holepunch(peer, node, callback)`\n\nUDP holepunch to another peer. Pass the same node as was returned in the announce/lookup stream\nfor the peer.\n\n#### `dht.ready(callback)`\n\nWait for the dht to be fully bootstrapped. You do not need to call this before annnouncing / querying.\n\n#### `dht.destroy(callback)`\n\nDestroy the dht and stop listening.\n\n#### `dht.bootstrap([callback])`\n\nRe-bootstrap the DHT. Call this at regular intervals if you do not announce/lookup any keys.\n\n#### `dht.listen(port, callback)`\n\nExplicitly listen on a port. If you do not call this a random port will be chosen for you.\n\n## Command line tool\n\nThere is a command line tool available as well which is useful if you want to run a long lived dht node on a server or similar.\n\n``` sh\nnpm install -g hyperdht\nhyperdht --help\n```\n\nTo run a node simply pass it the addresses of your bootstrap servers\n\n``` sh\nhyperdht --bootstrap=localhost:10000 --bootstrap=localhost:10001\n```\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/mafintosh/hyperdht","bugs":{"url":"https://github.com/mafintosh/hyperdht/issues"},"license":"MIT"}