bt-tracker-client
Simple, robust, BitTorrent tracker (client) 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 client 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
Also see bittorrent-dht.
install
npm install bt-tracker-client
usage
client
To connect to a tracker, just do this:
var Client = var requiredOpts = infoHash: '012345678901234567890' // hex string or Buffer peerId: '01234567890123456789' // hex string or Buffer announce: // list of tracker server urls port: 6881 // torrent client port, (in browser, optional) var optionalOpts = { // Provide a callback that will be called whenever announce() is called // internally (on timer), or by the user return uploaded: 0 downloaded: 0 left: 0 customParam: 'blah' // custom parameters supported } // RTCPeerConnection config object (only used in browser) rtcConfig: {} // User-Agent header for http requests userAgent: '' // Custom webrtc impl, useful in node to specify [wrtc](https://npmjs.com/package/wrtc) wrtc: {} var client = requiredOpts client client // start getting peers from the trackerclientstart client client // announce that download has completed (and you are now a seeder)clientcomplete // force a tracker announce. will trigger more 'update' events and maybe more 'peer' eventsclient // provide parameters to the trackerclient // stop getting peers from the tracker, gracefully leave the swarmclient // ungracefully leave the swarm (without sending final 'stop' message)client // scrapeclient client
multi scrape
Scraping multiple torrent info is possible with a static Client.scrape
method:
var Client = Client
license
MIT. Copyright (c) Feross Aboukhadijeh and WebTorrent, LLC.