Giter VIP home page Giter VIP logo

bittorrent-tracker's Introduction


WebTorrent
WebTorrent

The streaming torrent client. For node.js and the web.

discord ci npm version npm downloads Standard - JavaScript Style Guide

Sponsored by    Socket - JavaScript open source supply chain security    Wormhole

WebTorrent is a streaming torrent client for node.js and the browser. YEP, THAT'S RIGHT. THE BROWSER. It's written completely in JavaScript – the language of the web – so the same code works in both runtimes.

In node.js, this module is a simple torrent client, using TCP and UDP to talk to other torrent clients.

In the browser, WebTorrent uses WebRTC (data channels) for peer-to-peer transport. It can be used without browser plugins, extensions, or installations. It's Just JavaScript™. Note: WebTorrent does not support UDP/TCP peers in browser.

Simply include the webtorrent.min.js script on your page to start fetching files over WebRTC using the BitTorrent protocol, or import WebTorrent from 'webtorrent' with browserify or webpack. See demo apps and code examples below.

jsdelivr download count

To make BitTorrent work over WebRTC (which is the only P2P transport that works on the web) we made some protocol changes. Therefore, a browser-based WebTorrent client or "web peer" can only connect to other clients that support WebTorrent/WebRTC.

To seed files to web peers, use a client that supports WebTorrent, e.g. WebTorrent Desktop, a desktop client with a familiar UI that can connect to web peers, webtorrent-hybrid, a command line program, or Instant.io, a website. Established torrent clients like Vuze have already added WebTorrent support so they can connect to both normal and web peers. We hope other clients will follow.

Network

Features

  • Torrent client for node.js & the browser (same npm package!)
  • Insanely fast
  • Download multiple torrents simultaneously, efficiently
  • Pure Javascript (no native dependencies)
  • Exposes files as streams
    • Fetches pieces from the network on-demand so seeking is supported (even before torrent is finished)
    • Seamlessly switches between sequential and rarest-first piece selection strategy
  • Supports advanced torrent client features
  • Comprehensive test suite (runs completely offline, so it's reliable and fast)
  • Check all the supported BEPs here

Browser/WebRTC environment features

  • WebRTC data channels for lightweight peer-to-peer communication with no plugins
  • No silos. WebTorrent is a P2P network for the entire web. WebTorrent clients running on one domain can connect to clients on any other domain.
  • Stream video torrents into a <video> tag (webm, mkv, mp4, ogv, mov, etc (AV1, H264, HEVC*, VP8, VP9, AAC, FLAC, MP3, OPUS, Vorbis, etc))
  • Supports Chrome, Firefox, Opera and Safari.

Install

To install WebTorrent for use in node or the browser with import WebTorrent from 'webtorrent', run:

npm install webtorrent

To install a webtorrent command line program, run:

npm install webtorrent-cli -g

To install a WebTorrent desktop application for Mac, Windows, or Linux, see WebTorrent Desktop.

Ways to help

Who is using WebTorrent today?

Lots of folks!

WebTorrent API Documentation

Read the full API Documentation.

Usage

WebTorrent is the first BitTorrent client that works in the browser, using open web standards (no plugins, just HTML5 and WebRTC)! It's easy to get started!

In the browser

Downloading a file is simple:
import WebTorrent from 'webtorrent'

const client = new WebTorrent()
const magnetURI = '...'

client.add(magnetURI, torrent => {
  // Got torrent metadata!
  console.log('Client is downloading:', torrent.infoHash)

  for (const file of torrent.files) {
    document.body.append(file.name)
  }
})
Seeding a file is simple, too:
import dragDrop from 'drag-drop'
import WebTorrent from 'webtorrent'

const client = new WebTorrent()

// When user drops files on the browser, create a new torrent and start seeding it!
dragDrop('body', files => {
  client.seed(files, torrent => {
    console.log('Client is seeding:', torrent.infoHash)
  })
})

There are more examples in docs/get-started.md.

Browserify

WebTorrent works great with browserify, an npm package that lets you use node-style require() to organize your browser code and load modules installed by npm (as seen in the previous examples).

Webpack

WebTorrent also works with webpack, another module bundler. However, webpack requires extra configuration which you can find in the webpack bundle config used by webtorrent.

Or, you can just use the pre-built version via import WebTorrent from 'webtorrent/dist/webtorrent.min.js' and skip the webpack configuration.

Script tag

WebTorrent is also available as a standalone script (webtorrent.min.js) which exposes WebTorrent on the window object, so it can be used with just a script tag:

<script type='module'>
  import WebTorrent from 'webtorrent.min.js'
</script>

The WebTorrent script is also hosted on fast, reliable CDN infrastructure (Cloudflare and MaxCDN) for easy inclusion on your site:

<script type='module'>
  import WebTorrent from 'https://esm.sh/webtorrent'
</script>
Chrome App

If you want to use WebTorrent in a Chrome App, you can include the following script:

<script type='module'>
  import WebTorrent from 'webtorrent.chromeapp.js'
</script>

Be sure to enable the chrome.sockets.udp and chrome.sockets.tcp permissions!

In Node.js

WebTorrent also works in node.js, using the same npm package! It's mad science!

NOTE: To connect to "web peers" (browsers) in addition to normal BitTorrent peers, use webtorrent-hybrid which includes WebRTC support for node.

As a command line app

WebTorrent is also available as a command line app. Here's how to use it:

$ npm install webtorrent-cli -g
$ webtorrent --help

To download a torrent:

$ webtorrent magnet_uri

To stream a torrent to a device like AirPlay or Chromecast, just pass a flag:

$ webtorrent magnet_uri --airplay

There are many supported streaming options:

--airplay               Apple TV
--chromecast            Chromecast
--mplayer               MPlayer
--mpv                   MPV
--omx [jack]            omx [default: hdmi]
--vlc                   VLC
--xbmc                  XBMC
--stdout                standard out [implies --quiet]

In addition to magnet uris, WebTorrent supports many ways to specify a torrent.

Talks about WebTorrent

Modules

Most of the active development is happening inside of small npm packages which are used by WebTorrent.

The Node Way™

"When applications are done well, they are just the really application-specific, brackish residue that can't be so easily abstracted away. All the nice, reusable components sublimate away onto github and npm where everybody can collaborate to advance the commons." — substack from "how I write modules"

node.js is shiny

Modules

These are the main modules that make up WebTorrent:

module tests version description
webtorrent torrent client (this module)
bittorrent-dht distributed hash table client
bittorrent-peerid identify client name/version
bittorrent-protocol bittorrent protocol stream
bittorrent-tracker bittorrent tracker server/client
bittorrent-lsd bittorrent local service discovery
create-torrent create .torrent files
magnet-uri parse magnet uris
parse-torrent parse torrent identifiers
torrent-discovery find peers via dht, tracker, and lsd
ut_metadata metadata for magnet uris (protocol extension)
ut_pex peer discovery (protocol extension)

Enable debug logs

In node, enable debug logs by setting the DEBUG environment variable to the name of the module you want to debug (e.g. bittorrent-protocol, or * to print all logs).

DEBUG=* webtorrent

In the browser, enable debug logs by running this in the developer console:

localStorage.setItem('debug', '*')

Disable by running this:

localStorage.removeItem('debug')

License

MIT. Copyright (c) Feross Aboukhadijeh and WebTorrent, LLC.

bittorrent-tracker's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bittorrent-tracker's Issues

update event from peer that is not in swarm node.js bittorrent tracker error

As specified here i am installing it with node.js and then server.js implemented like bleow

var Server = require('bittorrent-tracker').Server

var server = new Server({
udp: true, // enable udp server? [default=true]
http: true // enable http server? [default=true]
})

server.on('error', function (err) {
// fatal server error!

console.log(err.message)
})

server.on('warning', function (err) {
// client sent bad data. probably not a problem, just a buggy client.
console.log(err.message)
})

server.on('listening', function (port) {
console.log('tracker server is now listening on ' + port)
})

// start tracker server listening!
server.listen(6882)

// listen for individual tracker messages from peers:

server.on('start', function (addr) {
console.log('got start message from ' + addr)
})

server.on('complete', function (addr) {})
server.on('update', function (addr) {})
server.on('stop', function (addr) {})

// get info hashes for all torrents in the tracker server
Object.keys(server.torrents)

// get the number of seeders for a particular torrent
//server.torrents[infoHash].complete

// get the number of leechers for a particular torrent
//server.torrents[infoHash].incomplete

// get the peers who are in a particular torrent swarm
//server.torrents[infoHash].peers

Here as i am not get infoHash , I have commented this out in order to run server . With this in place i am not getting consistant behavior for torrents and getting this error for some of the torrents already created with tracker as current server with given port.

Please let me know how to resolve the error and make downloading of torrent consistent.

Negative amount of leechers

Hey guys,
On some of the torrents on my tracker I see a negative amount of leechers. This seems to happen on torrents where one or more clients already have the files when adding a torrent, means:

(amount of seeders) = (amount of leechers) * -1 

As soon as a new leecher joins the pool, the amount of leechers goes up, but is still not correct then (at least on those torrents with negative leecher count).

My torrent object looks like so in the moment:

'55600bbcb00fd923dee589655f74900f5abxxxx': { peers: [Object], complete: 2, incomplete: -2 },
 fe0a979f104964e69e8bbc8bcff5bde120d2xxxx: { peers: [Object], complete: 2, incomplete: -1 },
 d3939d09f0a259c5be1cd31cd06499901ca2xxxx: { peers: [Object], complete: 1, incomplete: 0 },

The first torrent has two seeders and no leecher in reality. The Second torrent has two seeders and one leecher. The third torrent seems to be all right, one seeder, no negative leecher and no leecher at all.

Any ideas on this?

webtorrent client in browser does not connect to local bittorrent-tracker (Opcode -1)

I'm trying to create a torrent from Chrome 42 and use a websocket tracker on wss://localhost:8000 as the announce target. The options I'm passing into webtorrent.client.seed look like this:

{
  "name": "mt-data.zip",
  "announceList": [
    [
      "wss://localhost:8000"
    ]
  ]
}

but the my console shows

WebSocket connection to 'wss://localhost:8000/' failed: Error in connection establishment: net::ERR_CONNECTION_CLOSED
Uncaught Error: connection error to wss://localhost:8000

On localhost:8000 I've tried running bittorrent-tracker --ws and my own index.js server startup based on bin/cmd.js but I always get the same error. (I've also tired 127.0.0.1 instad of localhost?)

Looking into the websocket connection from the network inspector I see that the connection attempt doesn't reach the "101 upgrade state" that it does if the announce url is tracker.webtorrent.io, instead the only data shown in the frames inpector is (Opcode -1)

Have you seen these symptoms of misconfiguration before?

i have no idea what i'm doing

can't bind only to one IP

i get error if i add any ip to "server.listen(7000, "IP");"

events.js:171
throw TypeError('listener must be a function');
^
TypeError: listener must be a function
at TypeError ()
at Server.EventEmitter.once (events.js:171:11)
at Server.listen (/home/shift/node_modules/bittorrent-tracker/server.js:112:25)
at Object. (/home/shift/node_tracker/start.js:42:8)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)

Add api docs for client and server

Currently, README.md just has example usage. We should add full API docs because there are several public methods that are available but not shown in the examples. For instance, server.getSwarm().

onFilter returning error details rather than global "disallowed info_hash"

Since filter function has become async and receives a callback, perhaps it'll be good to have functionality for standard callback(err, res) form which allows for errors to be passed through, for customised error reasons.

It'll be more usable than just having "disallowed info_hash" for every reason for failure.

info_hash and peer_id is coming encrypted

We are planning to use bittorrent-tracker and extend functionality to save torrent details and user details in mongodb database.

However, when we are checking peer_id and info_hash it is giving improper values. It looks like either those values are garbled or encrypted.

info_hash and peer_id are specified here http://23.102.65.126:81/Capture.png

Invalid info_hash error on tracker server

Right out of the box I am having issues.

I download the .zip from here and extract.

install dependencies, create a simple tracker(not client) with the sample code.

it runs, says server is listening on port 1337

but no matter what, all torrents I try to track give invalid info_hash.

I have googled all over and I have found the reason why but nor a solution.

Utorrent sends the infohash as below
%BF k %EA %EF %B6 2 %F1 %87 %D4 %BE A %84 %B4 %03 %CB x9 %01 %EC %A6

and the actual infohash is as below(without spaces)
BF 6B EA EF B6 32 F1 87 D4 BE 41 84 B4 03 CB 78 39 01 EC A6

This is due to the way it should be encoded(as per specification)

Note that all binary data in the URL (particularly info_hash and peer_id) must be properly escaped. This means any byte not in the set 0-9, a-z, A-Z, '.', '-', '_' and '~', must be encoded using the "%nn" format, where nn is the hexadecimal value of the byte. (See RFC1738 for details.)
For a 20-byte hash of \x12\x34\x56\x78\x9a\xbc\xde\xf1\x23\x45\x67\x89\xab\xcd\xef\x12\x34\x56\x78\x9a,
The right encoded form is %124Vx%9A%BC%DE%F1%23Eg%89%AB%CD%EF%124Vx%9A

Any advice as to how to solve this?

Your help would be appreciated

Tests fail on Travis

This is happening because the tests rely on connecting to external services and I think that Travis is getting rate-limited by the UDP tracker servers / they are blocking UDP traffic.

Once #9 is implemented, then we can change the tests to just use local tracker servers!

Support scrape without info_hash specified

"The scrape URL may be supplemented by the optional parameter info_hash, a 20-byte value as described above. This restricts the tracker's report to that particular torrent. Otherwise stats for all torrents that the tracker is managing are returned. Software authors are strongly encouraged to use the info_hash parameter when at all possible, to reduce the load and bandwidth of the tracker."

https://wiki.theory.org/BitTorrentSpecification

Running a tracker on raspberry pi

When I execute the following command:

pi@raspberrypi ~/dht-tracker/node_modules/.bin $ ./bittorrent-tracker -p 6881

it throws:

ERROR: bind EAFNOSUPPORT
ERROR: listen EAFNOSUPPORT

But in windows it is running fine.

Seeding a torrent that uses both ws and udp on the same tracker crashes the tracker

I can't reproduce this using tracker.webtorrent.io since I can't seem to connect using udp. However, when running a local tracker with this client code:

var torrent = client.seed(filePath, {
    announceList: [['udp://mytracker:8000',
                    'ws://mytracker:8000']]
});

Crashes the tracker with

/usr/local/lib/node_modules/bittorrent-tracker/server.js:314
        peer.socket.send(JSON.stringify({
                   ^
TypeError: Cannot read property 'send' of undefined
    at /usr/local/lib/node_modules/bittorrent-tracker/server.js:314:20
    at Array.forEach (native)
    at /usr/local/lib/node_modules/bittorrent-tracker/server.js:313:13
    at /usr/local/lib/node_modules/bittorrent-tracker/server.js:398:5
    at Swarm.announce (/usr/local/lib/node_modules/bittorrent-tracker/lib/swarm.js:23:5)
    at Server._onAnnounce (/usr/local/lib/node_modules/bittorrent-tracker/server.js:366:9)
    at Server._onRequest (/usr/local/lib/node_modules/bittorrent-tracker/server.js:353:10)
    at Server._onWebSocketRequest (/usr/local/lib/node_modules/bittorrent-tracker/server.js:289:8)
    at WebSocket.emit (events.js:110:17)
    at Receiver.ontext (/usr/local/lib/node_modules/bittorrent-tracker/node_modules/ws/lib/WebSocket.js:797:10)

Server code only checks for available TCP port

Line 103 of server.js calls on portfinder to find a port, then opens this port via onPort(). Currently portfinder only finds available TCP ports, therefore it will return an available TCP port, while onPort() would open that UDP port.

Doesnt not bind to IPv6 addresses when http disabled (UDP Only)

When running this:

bittorrent-tracker -p 80 --http false -q

Seems that the tracker only binds to the IPv4 addresses (0.0.0.0) which is fine but does not bind to IPv6 address ([::])

root@box:~# lsof -i :80
COMMAND   PID USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
node    32129 root   10u  IPv4 1580383      0t0  UDP *:http

Here you can see on IPv4 its listening ok:

root@box:~#  nmap -sU -p 123.123.123.123

Starting Nmap 6.00 ( http://nmap.org ) at 2015-05-02 07:33 MSK
Nmap scan report for 123.123.123.123
Host is up.
PORT   STATE         SERVICE
80/udp open|filtered http

Nmap done: 1 IP address (1 host up) scanned in 2.19 seconds

and for IPv6 udp port is closed:

root@box:~# nmap -6 -sU 2a00:dead::beef -p 80

Starting Nmap 6.00 ( http://nmap.org ) at 2015-05-02 07:33 MSK
Nmap scan report for 2a00:dead::beef
Host is up (0.000050s latency).
PORT   STATE  SERVICE
80/udp closed http

Nmap done: 1 IP address (1 host up) scanned in 0.08 seconds

[Req] configurable query path for /announce & /scrape and more options

I found it's hardcoded in server.js

if (s[0] === '/announce') {
..
} else if (s[0] === '/scrape') {
..
error('only /announce and /scrape are valid endpoints')

I think it will be more flexible let user to config the announce path such as to '/', and optionally disable scrapping.

Feature: Statistics

A feature request.

Would love to see some form of statistics from this tracker.
I assume some HTTP endpoint (unrelated to if --http is true or false) return JSON would be best.

Stats that I would personally love to see:

  • Total Peers count (separated on IPv4 and IPv6 peers)
  • Total Seeds count (separated on IPv4 and IPv6 seeds)
  • Total Torrent count
  • Connections per min (separated on IPv4 and IPv6 connections)
  • Scrapes per min (separated on IPv4 and IPv6 Scrapes)

Just a thought, would be pretty awesome if the tracker operator can display these sort of stats graphed over time.

Support trackers form magnet links

Magnet links may have trackers list, but they do no have "length" prop as usual ".torrent" files, so I gues this code may cause bugs

https://github.com/feross/bittorrent-tracker/blob/master/index.js#L395

self._torrentLength = torrent.length

example of magnet link with trackers
magnet:?xt=urn:btih:2b545d70644ade8ccaedca8a20c9253616fc0644&dn=RJD2+-+The+Colossus&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.istole.it%3A6969&tr=udp%3A%2F%2Ftracker-ccc.de%3A6969&tr=udp%3A%2F%2Fopen.demonii.com%3A1337

Async filter function (to interface with database)

This is from tracker's point of view.

I am attempting to extend the usage of filter function by e.g. using a database to query whether the torrent has valid infoHash or not, as well as any other params that needs to be checked.

Database queries, as being network requests, are async in nature, and they don't return a value but a callback to do further processing.

Filter function requires a return value (a boolean).

Is there any way that you can think of to easily do both? As I can see it, there's no way to do this cleanly. Using async module or whatnot isn't going to cut it as it's not the order of the processing, but rather inability to return a value from a callback to original caller (which doesn't make sense anyway).

Support additional list of trackers

I want to use more trackers than those which comes from torrent file or magnet link.

For example I have list of trackers
["udp://tracker.openbittorrent.com:80", 'udp://tracker.ccc.de:80', 'udp://tracker.istole.it:80', "udp://tracker.publicbt.com:80"]; which I want to use for each magnet link (I expect them will not contain any trackers) used in app.

Just api improvement.
Maybe opts.trackers and merging to array will be enought

Additional information sent over an announce

I would like to run a tracker than can track additional torrent information (its name, etc.) rather than just its infohash. Looking over the source code for UDP requests and parsing them, I cannot find a straightforward way to just add an additional option to the UDP message, and have it converted to a string by the server. Where in the source code would you recommend that I check?

whitelist/filtering of torrent info hashes

It would be nice to be able to dynamically control which torrents the tracker tracks...maybe with an api like below?

var Server = require('bittorrent-tracker').Server

var server = new Server({
  udp: true, // enable udp server? [default=true]
  http: true // enable http server? [default=true]
  filter: function (hash) {
    return hash === 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
  }
});

Improve announce interface

Currently setIntervals happen inside this package, but it has no way to know what upload/download numbers to report to the tracker.

Perhaps this should just be the responsibility of the user? There's already a client.update() function.

Error: value is out of bounds

First of all, thank you so much for your awesome activity on the tracker project I want to start using this software for an open tracker project we have going which is getting a ton of traffic

Here is the current error I am getting after running the tracker for ~1min:

root@box:~# bittorrent-tracker -p 80 -q

/usr/lib/node_modules/bittorrent-tracker/lib/swarm.js:0
(function (exports, require, module, __filename, __dirname) { module.exports =
^
RangeError: Maximum call stack size exceeded

Also at some I get this:

root@box:~# bittorrent-tracker -p 80 -q

buffer.js:705
    throw TypeError('value is out of bounds');
    ^
TypeError: value is out of bounds
    at TypeError (<anonymous>)
    at checkInt (buffer.js:705:11)
    at Buffer.writeUInt32BE (buffer.js:748:5)
    at Object.toUInt32 (/usr/lib/node_modules/bittorrent-tracker/lib/common-node.js:29:7)
    at makeUdpPacket (/usr/lib/node_modules/bittorrent-tracker/server.js:435:16)
    at /usr/lib/node_modules/bittorrent-tracker/server.js:222:15
    at /usr/lib/node_modules/bittorrent-tracker/server.js:374:5
    at Swarm.announce (/usr/lib/node_modules/bittorrent-tracker/lib/swarm.js:24:5)
    at Server._onAnnounce (/usr/lib/node_modules/bittorrent-tracker/server.js:342:9)
    at Server._onRequest (/usr/lib/node_modules/bittorrent-tracker/server.js:329:10)

Please do let me know if there is anything more I can do to help debug these issues

Thanks

Unhandled error: buf length isn't multiple of compact IP/PORTs (6 bytes)

Greetings!

After updating to v2.6.0 from v2.0.0 I came across with [Error: buf length isn't multiple of compact IP/PORTs (6 bytes)] several times and I don't recall that error before. Although I wasn't really paying too much attention.

Error: buf length isn't multiple of compact IP/PORTs (6 bytes)
    at Function.compact2string.multi (/home/on-black-sails/cluster1/node_modules/bittorrent-tracker/node_modules/compact2string/index.js:12:11)
    at Tracker._handleResponse (/home/on-black-sails/cluster1/node_modules/bittorrent-tracker/client.js:481:22)
    at /home/on-black-sails/cluster1/node_modules/bittorrent-tracker/client.js:277:37
    at ConcatStream.<anonymous> (/home/on-black-sails/cluster1/node_modules/bittorrent-tracker/node_modules/concat-stream/index.js:32:43)
    at ConcatStream.emit (events.js:117:20)
    at finishMaybe (/home/on-black-sails/cluster1/node_modules/bittorrent-tracker/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:460:14)
    at afterWrite (/home/on-black-sails/cluster1/node_modules/bittorrent-tracker/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:340:3)
    at /home/on-black-sails/cluster1/node_modules/bittorrent-tracker/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:327:9
    at process._tickDomainCallback (node.js:463:13)

Should be handled here
Thrown by compact2string.multi:

compact2string.multi = function  (buf) {

  if(buf.length % 6 !== 0)
    throw new Error("buf length isn't multiple of compact IP/PORTs (6 bytes)");

  var output = [];
  for (var i = 0; i <= buf.length - 1; i = i + 6) {
    output.push(compact2string(buf.slice(i, i + 6)));
  }

  return output;
};

Thank you & Great job! =)

Expose addr instead of param on complete/update/stop

Instead of only exposing addr, I think it'd be more flexible to expose the entire params (at server.js:225, line that does self.emit(common.EVENT_NAMES[params.event], params.addr)) so you can do more intricate processing.

Specifically, peer_id and announce url would be exposed rather than addr alone, and would make handling individual downloaders and torrents a lot neater for applications that need that level of complexity.

I am aware of this possibly breaking API since other modules rely on it; is there a decent solution to expose it?

toUInt32 on sizes bigger than 32 bit integers

Trying to download a torrent with a file of a big size (4.7 GB) results in
TypeError: value is out of bounds
at TypeError ()
at checkInt (buffer.js:784:11)
at Buffer.writeUInt32BE (buffer.js:848:5)
at toUInt32 (/home/thermatk/dev/thermorrent/node_modules/peerflix/node_modules/torrent-stream/node_modules/bittorrent-tracker/index.js:489:7)
at announce (/home/thermatk/dev/thermorrent/node_modules/peerflix/node_modules/torrent-stream/node_modules/bittorrent-tracker/index.js:229:20)
at Socket.eval (/home/thermatk/dev/thermorrent/node_modules/peerflix/node_modules/torrent-stream/node_modules/bittorrent-tracker/index.js:179:9)
at Socket.EventEmitter.emit (events.js:98:17)
at UDP.onMessage (dgram.js:437:8)

There is something in the code around about 64-bit? Is it possible to fix by converting to 64 bit integers? Something should be done :)

Port should be > 0 and < 65536

Getting this error from time to time:

root@box:~# bittorrent-tracker -p 80 -q

dgram.js:269
    throw new RangeError('Port should be > 0 and < 65536');
    ^
RangeError: Port should be > 0 and < 65536
    at Socket.send (dgram.js:269:11)
    at /usr/lib/node_modules/bittorrent-tracker/server.js:222:14
    at Server._onRequest (/usr/lib/node_modules/bittorrent-tracker/server.js:321:5)
    at Server.onUdpRequest (/usr/lib/node_modules/bittorrent-tracker/server.js:208:8)
    at Socket.emit (events.js:98:17)
    at UDP.onMessage (dgram.js:441:8)

Proxy support

Hi,

My ISP is blocking my announces to tracker's http and udp... After a quick read of the code, it looks like bittorent-tracker would be the first one to be updated in order to support poxies.

Would it be possible to modify requestHttp and requestUdp for them to use proxy options that could be set in opts ?
Like in libtorrent-rasterbar, those options could be type(http,https, sock4, sock5), hostname, port, username and password.
Of course, requestUdp will only use sock5 proxies.

Thank you very much for your work !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.