bt-tracker-server
Simple, robust, BitTorrent tracker (server) implementation
Node.js implementation of a BitTorrent tracker, client and server.
A BitTorrent tracker is a web service which responds to requests from BitTorrent clients. The requests include metrics from clients that help the tracker keep overall statistics about the torrent. The response includes a peer list that helps the client participate in the torrent swarm.
features
- Includes server implementations
- Supports all mainstream tracker types:
- HTTP trackers
- UDP trackers (BEP 15)
- WebTorrent trackers (BEP forthcoming)
- Supports ipv4 & ipv6
- Supports tracker "scrape" extension
- Robust and well-tested
- Comprehensive test suite (runs entirely offline, so it's reliable)
- Used by popular clients: WebTorrent, peerflix, and playback
- Tracker statistics available via web interface at
/stats
or JSON data at/stats.json
Also see bittorrent-dht.
Tracker stats
install
npm install bt-tracker-server
usage
server
To start a BitTorrent tracker server to track swarms of peers:
var Server = var server = udp: true // enable udp server? [default=true] http: true // enable http server? [default=true] ws: true // enable websocket server? [default=true] stats: true // enable web-based statistics? [default=true] { // Blacklist/whitelist function for allowing/disallowing torrents. If this option is // omitted, all torrents are allowed. It is possible to interface with a database or // external system before deciding to allow/deny, because this function is async. // It is possible to block by peer id (whitelisting torrent clients) or by secret // key (private trackers). Full access to the original HTTP/UDP request parameters // are available in `params`. // This example only allows one torrent. var allowed = infoHash === 'aaa67059ed6bd08362da625b3ae77f6f4a075aaa' if allowed // If the callback is passed `null`, the torrent will be allowed. else // If the callback is passed an `Error` object, the torrent will be disallowed // and the error's `message` property will be given as the reason. } // Internal http, udp, and websocket servers exposed as public properties.serverhttpserverudpserverws server server server // start tracker server listening! Use 0 to listen on a random free port.server // listen for individual tracker messages from peers: server serverserverserver // get info hashes for all torrents in the tracker serverObject // get the number of seeders for a particular torrentservertorrentsinfoHashcomplete // get the number of leechers for a particular torrentservertorrentsinfoHashincomplete // get the peers who are in a particular torrent swarmservertorrentsinfoHashpeers
The http server will handle requests for the following paths: /announce
, /scrape
. Requests for other paths will not be handled.
command line
$ npm install -g bt-tracker-server
Easily start a tracker server:
$ bt-tracker-serverhttp server listening on 8000udp server listening on 8000ws server listening on 8000
Lots of options:
$ bt-tracker-server --help bt-tracker-server - Start a bittorrent tracker server Usage: bt-tracker-server [OPTIONS] If no --http, --udp, or --ws option is supplied, all tracker types will be started. Options: -p, --port [number] change the port [default: 8000] --trust-proxy trust 'x-forwarded-for' header from reverse proxy --interval client announce interval [default: 600000] --http enable http server --udp enable udp server --ws enable websocket server -q, --quiet only show error output -s, --silent show no output -v, --version print the current version
license
MIT. Copyright (c) Feross Aboukhadijeh and WebTorrent, LLC.