{
  "name": "bittorrent-tracker",
  "description": "Simple, robust, BitTorrent tracker (client & server) implementation",
  "version": "1.5.0",
  "author": {
    "name": "Feross Aboukhadijeh",
    "email": "feross@feross.org",
    "url": "http://feross.org/"
  },
  "browser": {
    "./server.js": false
  },
  "bugs": {
    "url": "https://github.com/feross/bittorrent-tracker/issues"
  },
  "dependencies": {
    "bencode": "^0.6.0",
    "bn.js": "^0.11.7",
    "buffer-equal": "0.0.1",
    "compact2string": "^1.2.0",
    "concat-stream": "^1.4.5",
    "debug": "^1.0.0",
    "extend.js": "0.0.1",
    "hat": "0.0.3",
    "inherits": "^2.0.1",
    "ip": "^0.3.0",
    "querystring": "^0.2.0",
    "run-parallel": "^1.0.0",
    "string2compact": "^1.1.1"
  },
  "devDependencies": {
    "magnet-uri": "^2.0.1",
    "parse-torrent": "^1.1.0",
    "portfinder": "^0.2.1",
    "tape": "2.x"
  },
  "homepage": "http://webtorrent.io",
  "keywords": [
    "torrent",
    "bittorrent",
    "tracker",
    "stream",
    "peer",
    "wire",
    "p2p",
    "peer-to-peer"
  ],
  "license": "MIT",
  "main": "index.js",
  "repository": {
    "type": "git",
    "url": "git://github.com/feross/bittorrent-tracker.git"
  },
  "scripts": {
    "test": "tape test/*.js",
    "start": "node server.js"
  },
  "readme": "# bittorrent-tracker [![build](https://img.shields.io/travis/feross/bittorrent-tracker.svg)](https://travis-ci.org/feross/bittorrent-tracker) [![npm](https://img.shields.io/npm/v/bittorrent-tracker.svg)](https://npmjs.org/package/bittorrent-tracker) [![npm downloads](https://img.shields.io/npm/dm/bittorrent-tracker.svg)](https://npmjs.org/package/bittorrent-tracker) [![gittip](https://img.shields.io/gittip/feross.svg)](https://www.gittip.com/feross/)\n\n#### Simple, robust, BitTorrent tracker (client & server) implementation\n\n![tracker](https://raw.githubusercontent.com/feross/bittorrent-tracker/master/img.png)\n\nNode.js implementation of a [BitTorrent tracker](https://wiki.theory.org/BitTorrentSpecification#Tracker_HTTP.2FHTTPS_Protocol), client and server.\n\nA **BitTorrent tracker** is an HTTP service which responds to GET requests from BitTorrent\nclients. The requests include metrics from clients that help the tracker keep overall\nstatistics about the torrent. The response includes a peer list that helps the client\nparticipate in the torrent.\n\nAlso see [bittorrent-dht](https://github.com/feross/bittorrent-dht). This module is used\nby [WebTorrent](http://webtorrent.io).\n\n## features\n\n- Includes client & server implementations\n- Supports HTTP & UDP trackers ([BEP 15](http://www.bittorrent.org/beps/bep_0015.html))\n- Supports tracker scrape\n\n## install\n\n```\nnpm install bittorrent-tracker\n```\n\n## usage\n\n### client\n\nTo connect to a tracker, just do this:\n\n```js\nvar Client = require('bittorrent-tracker')\nvar parseTorrent = require('parse-torrent')\nvar fs = require('fs')\n\nvar torrent = fs.readFileSync(__dirname + '/torrents/bitlove-intro.torrent')\nvar parsedTorrent = parseTorrent(torrent) // { infoHash: 'xxx', length: xx, announce: ['xx', 'xx'] }\n\nvar peerId = new Buffer('01234567890123456789')\nvar port = 6881\n\nvar client = new Client(peerId, port, parsedTorrent)\n\n// you must add an 'error' event handler!\nclient.on('error', function (err) {\n  console.log(err.message)\n  // a tracker was unavailable or sent bad data to the client. you can probably ignore it\n})\n\n// start getting peers from the tracker\nclient.start()\n\nclient.on('update', function (data) {\n  console.log('got an announce response from tracker: ' + data.announce)\n  console.log('number of seeders in the swarm: ' + data.complete)\n  console.log('number of leechers in the swarm: ' + data.incomplete)\n})\n\nclient.once('peer', function (addr) {\n  console.log('found a peer: ' + addr) // 85.10.239.191:48623\n})\n\n// announce that download has completed (and you are now a seeder)\nclient.complete()\n\n// force a tracker announce. will trigger more 'update' events and maybe more 'peer' events\nclient.update()\n\n// stop getting peers from the tracker, gracefully leave the swarm\nclient.stop()\n\n// scrape\nclient.scrape()\n\nclient.on('scrape', function (data) {\n  console.log('got a scrape response from tracker: ' + data.announce)\n  console.log('number of seeders in the swarm: ' + data.complete)\n  console.log('number of leechers in the swarm: ' + data.incomplete)\n  console.log('number of total downloads of this torrent: ' + data.incomplete)\n})\n```\n\n### server\n\nTo start a BitTorrent tracker server to track swarms of peers:\n\n```js\nvar Server = require('bittorrent-tracker').Server\n\nvar server = new Server({\n  udp: true, // enable udp server? [default=true]\n  http: true // enable http server? [default=true]\n})\n\nserver.on('error', function (err) {\n  // fatal server error!\n  console.log(err.message)\n})\n\nserver.on('warning', function (err) {\n  // client sent bad data. probably not a problem, just a buggy client.\n  console.log(err.message)\n})\n\nserver.on('listening', function () {\n  console.log('tracker server is listening!')\n})\n\n// start tracker server listening!\nserver.listen(port)\n\n// listen for individual tracker messages from peers:\n\nserver.on('start', function (addr, params) {\n  console.log('got start message from ' + addr)\n  console.log('params in the message: ' + JSON.stringify(params))\n})\n\nserver.on('complete', function (addr, params) {})\nserver.on('update', function (addr, params) {})\nserver.on('stop', function (addr, params) {})\n\n// get info hashes for all torrents in the tracker server\nObject.keys(server.torrents)\n\n// get the number of seeders for a particular torrent\nserver.torrents[infoHash].complete\n\n// get the number of leechers for a particular torrent\nserver.torrents[infoHash].incomplete\n\n// get the peers who are in a particular torrent swarm\nserver.torrents[infoHash].peers\n```\n\n## license\n\nMIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).\n",
  "readmeFilename": "README.md",
  "_id": "bittorrent-tracker@1.5.0",
  "_shasum": "2ec887a006f7f8dd2a1d87fd87f2ffcf6498126c",
  "_from": "bittorrent-tracker@^1.5.0",
  "_resolved": "https://registry.npmjs.org/bittorrent-tracker/-/bittorrent-tracker-1.5.0.tgz"
}
