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

torrent-discovery

Package Overview
Dependencies
Maintainers
7
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

torrent-discovery - npm Package Compare versions

Comparing version 9.3.0 to 9.4.0

35

index.js

@@ -7,2 +7,3 @@ /*! torrent-discovery. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */

const Tracker = require('bittorrent-tracker/client')
const LSD = require('bittorrent-lsd')

@@ -51,2 +52,5 @@ class Discovery extends EventEmitter {

}
this._onLSDPeer = (peer, infoHash) => {
this.emit('peer', peer, 'lsd')
}

@@ -85,2 +89,8 @@ const createDHT = (port, opts) => {

}
if (opts.lsd === false || typeof LSD !== 'function') {
this.lsd = null
} else {
this.lsd = this._createLSD()
}
}

@@ -139,2 +149,11 @@

if (this.lsd) {
this.lsd.removeListener('warning', this._onWarning)
this.lsd.removeListener('error', this._onError)
this.lsd.removeListener('peer', this._onLSDPeer)
tasks.push(cb => {
this.lsd.destroy(cb)
})
}
parallel(tasks, cb)

@@ -145,2 +164,3 @@

this.tracker = null
this.lsd = null
this._announce = null

@@ -190,4 +210,19 @@ }

}
_createLSD () {
const opts = Object.assign({}, {
infoHash: this.infoHash,
peerId: this.peerId,
port: this._port
})
const lsd = new LSD(opts)
lsd.on('warning', this._onWarning)
lsd.on('error', this._onError)
lsd.on('peer', this._onLSDPeer)
lsd.start()
return lsd
}
}
module.exports = Discovery

7

package.json
{
"name": "torrent-discovery",
"description": "Discover BitTorrent and WebTorrent peers",
"version": "9.3.0",
"version": "9.4.0",
"author": {

@@ -11,3 +11,4 @@ "name": "WebTorrent LLC",

"browser": {
"bittorrent-dht/client": false
"bittorrent-dht/client": false,
"bittorrent-lsd": false
},

@@ -21,2 +22,3 @@ "chromeapp": {},

"bittorrent-tracker": "^9.0.0",
"bittorrent-lsd": "^1.0.0",
"debug": "^4.0.0",

@@ -38,2 +40,3 @@ "run-parallel": "^1.1.2"

"dht",
"lsd",
"trackers",

@@ -40,0 +43,0 @@ "find peers",

@@ -14,5 +14,4 @@ # torrent-discovery [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]

This module bundles [bittorrent-dht](https://www.npmjs.com/package/bittorrent-dht) and
[bittorrent-tracker](https://www.npmjs.com/package/bittorrent-tracker) clients and exposes a
single API for discovering BitTorrent peers via both discovery methods.
This module bundles [bittorrent-dht](https://www.npmjs.com/package/bittorrent-dht),
[bittorrent-tracker](https://www.npmjs.com/package/bittorrent-tracker), and [bittorrent-lsd](https://www.npmjs.com/package/bittorrent-lsd) clients and exposes a single API for discovering BitTorrent peers via both discovery methods.

@@ -22,3 +21,3 @@ ## features

- simple API
- find peers from trackers and the DHT
- find peers from trackers, DHT, and LSD
- automatically announces, so other peers can discover us

@@ -59,8 +58,8 @@ - can start finding peers with just an info hash, before full metadata is available

tracker: true, // use trackers? optionally, this can be an `opts` object
lsd: true // use lsd?
}
```
See the documentation for [bittorrent-dht](https://www.npmjs.com/package/bittorrent-dht) and
[bittorrent-tracker](https://www.npmjs.com/package/bittorrent-tracker) for information on what
options are available via the `opts` object.
See the documentation for [bittorrent-dht](https://www.npmjs.com/package/bittorrent-dht),
[bittorrent-tracker](https://www.npmjs.com/package/bittorrent-tracker) and [bittorrant-lsd](https://www.npmjs.com/package/bittorrent-lsd) for information on what options are available via the `opts` object.

@@ -91,3 +90,3 @@ **This module automatically handles announcing on intervals, for maximum peer discovery.**

Destroy and cleanup the DHT and tracker instances.
Destroy and cleanup the DHT, tracker, and LSD instances.

@@ -98,3 +97,3 @@ ### events

Emitted whenever a new peer is discovered. Source is either 'tracker' or 'dht' based on peer source.
Emitted whenever a new peer is discovered. Source is either `'tracker'`, `'dht'`, or `'lsd'` based on peer source.

@@ -113,8 +112,9 @@ **In node**, `peer` is a string in the form `ip:port`, e.g. `12.34.56.78:4000`.

Emitted when there is a non-fatal DHT or tracker error, like an inaccessible tracker
server. Useful for logging. This is non-fatal.
Emitted when there is a **non-fatal** DHT, tracker, or LSD error. For example, an
inaccessible tracker server would be considered a warning. Useful for logging.
### `discovery.on('error', err => {})`
Emitted when there is a fatal, unrecoverable DHT or tracker error.
Emitted when there is a fatal, DHT, tracker, or LSD error. This is unrecoverable
and the `discovery` object will be destroyed if this event is emitted.

@@ -121,0 +121,0 @@ ## license

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