Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bittorrent-udp-tracker

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bittorrent-udp-tracker

udp tracker for bittorrent

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Bittorrent Udp Tracker

udp tracker implementation for bittorrent.

js-standard-style

Features

  1. implemented spcification from here and here
  2. fully tested

Installation

npm i bittorrent-udp-tracker --save

Test

npm test

Usage

var UdpTracker = require('bittorrent-udp-tracker')

var udpTracker = new UdpTracker(new Buffer('01234567890123456789'), new Buffer('12345678901234567890'), announceUrl, {'port': 1234})
udpTracker.announce(2, {
  downloaded: 0,
  left: 0,
  uploaded: 0
})

udpTracker.on('error', function (err) {
  throw new Error(err)
})

udpTracker.on('update', function (msg) {
  console.log(msg)
  udpTracker.destory()
})

update event will return json stringified object. It will have following format

{
  leechers: 12,
  seeds: 12,
  peers: ['10.12.12.12.:1234', '109.12.90.15.:1234']
}

error event will return error message.

API

  1. new UdpTracker(peerId, infoHash, opts)

    It will return instance of UdpTracker.It is also instance of EventEmitter.

    
    var udpTracker = new UdpTracker(new Buffer('01234567890123456789'), new Buffer('12345678901234567890'), announceUrl, {'port': 1234})
    
    
    • peerId: unique Id for peer (20 bytes)
    • infoHash: infoHash for torrent (20 bytes)
    • opts:
    {
      port: (16 bytes),
      _timeout: timeout for announce try in miliseconds
    }
    
  2. udpTracker.announce(event, opts)

announce event to tracker

  • event: event type to announce
  none = 0
  completed = 1
  started = 2
  stopped = 3
  • opts: announce options to send following are consider,

    • downloaded: 8 bytes long
    • left: 8 bytes long
    • uploaded: 8 byte long
  1. udpTracker.destroy()

stop sending announce request to trackers.

TODO

following things need to implement.

  • udp tracker timeout
  • announce interval handling
  • implement scraping
  • support IP6
  • implement extensions
  • authentication
  • request string

Implementation Details

  1. Time outs

bittorrent udp tracker timeout specification is implemented

  1. Announce Interval

announce response sends interval (in second) which says do not send another announce request before interval. So even you called announce we do not send announce request immediately instead we wait till interval time is over. After Interval time is over we send announce request with most recent announce request options.

  1. Stoping Tracker

As announce return interval to make new announce request.We keep making announce request. To stop tracker you have to call explicitly destory() api

Inspiration

This module Inspiration is taken from feross's bittorrent-tracker modules's file. udp-tracker.js.

Contributions

please create issue if you are having problem with module.

License

MIT

Keywords

FAQs

Package last updated on 31 Jul 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc