Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to disable BEP19 web seeds #911

Merged
merged 4 commits into from Sep 17, 2016
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Next

Option to disable BEP19 web seeds

  • Loading branch information
dcposch committed Sep 15, 2016
commit 5bdc78c49c898bf0e35cdf8c3845a4e9017c9c23
@@ -51,11 +51,12 @@ If `opts` is specified, then the default options (shown below) will be overridde

```js
{
dht: Boolean|Object, // Enable DHT (default=true), or options object for DHT
maxConns: Number, // Max number of connections per torrent (default=55)
nodeId: String|Buffer, // DHT protocol node ID (default=randomly generated)
peerId: String|Buffer, // Wire protocol peer ID (default=randomly generated)
tracker: Boolean|Object // Enable trackers (default=true), or options object for Tracker
tracker: Boolean|Object, // Enable trackers (default=true), or options object for Tracker
dht: Boolean|Object, // Enable DHT (default=true), or options object for DHT
webSeeds: Boolean // Enable BEP19 web seeds (default=true)

This comment has been minimized.

Copy link
@feross

feross Sep 17, 2016

Member

This would have been better as singular, webSeed IMO since we didn't name the other option trackers. No worries, I'll change it along with the other breaking API changes in v1.0.

This comment has been minimized.

Copy link
@dcposch

dcposch Sep 18, 2016

Author Contributor

I wanted to match webConns. The other options, tracker and dht, both take an object, this one just takes true or false.

I think it's fine but have no strong opinion, if you want to change it in 1.0 that's cool too

}
```

@@ -139,6 +139,9 @@ function WebTorrent (opts) {
self.dht = false
}

// Enable or disable BEP19 (Web Seeds). Enabled by default:
self.enableWebSeeds = opts.webSeeds !== false

if (typeof loadIPSet === 'function' && opts.blocklist != null) {
loadIPSet(opts.blocklist, {
headers: {
@@ -471,9 +471,11 @@ Torrent.prototype._onMetadata = function (metadata) {
self.metadata = self.torrentFile

// add web seed urls (BEP19)
self.urlList.forEach(function (url) {
self.addWebSeed(url)
})
if (self.client.enableWebSeeds) {
self.urlList.forEach(function (url) {
self.addWebSeed(url)
})
}

// start off selecting the entire torrent with low priority
if (self.pieces.length !== 0) {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.