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

Move tracker options into `opts.tracker` (#649) #791

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -51,16 +51,18 @@ 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)
rtcConfig: Object, // RTCPeerConnection configuration object (default=STUN only)
tracker: Boolean, // Whether or not to enable trackers (default=true)
wrtc: Object // Custom webrtc implementation (in node, specify the [wrtc](https://www.npmjs.com/package/wrtc) or [electron-webrtc](https://github.com/mappum/electron-webrtc) package)
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 (wrtc and rtcConfig)
}
```

+ See the documentation for webrtc implementation (in node, specify the [wrtc](https://www.npmjs.com/package/wrtc)
+ or [electron-webrtc](https://github.com/mappum/electron-webrtc) package) for information on what options are available
+ via the `opts` object.

## `client.add(torrentId, [opts], [function ontorrent (torrent) {}])`

Start downloading a new torrent.
@@ -68,12 +68,14 @@ function WebTorrent (opts) {
self.listening = false
self.torrentPort = opts.torrentPort || 0
self.dhtPort = opts.dhtPort || 0
self.tracker = opts.tracker !== undefined ? opts.tracker : true
self.tracker = opts.tracker !== undefined ? opts.tracker : {}
self.torrents = []
self.maxConns = Number(opts.maxConns) || 55

self._rtcConfig = opts.rtcConfig
self._wrtc = opts.wrtc || global.WRTC // to support `webtorrent-hybrid` package
if (typeof self.tracker === 'object') {
self.tracker.rtcConfig = opts.rtcConfig
self.tracker.wrtc = opts.wrtc || global.WRTC // to support `webtorrent-hybrid` package
}

This comment has been minimized.

Copy link
@feross

feross May 8, 2016

Member

These options should be passed into the tracker constructor, not set directly on the tracker object like this.

This comment has been minimized.

Copy link
@feross

feross May 8, 2016

Member

Nevermind.


if (typeof TCPPool === 'function') {
self._tcpPool = new TCPPool(self)
@@ -292,8 +292,8 @@ Torrent.prototype._onListening = function () {
var self = this
if (self.discovery || self.destroyed) return
var trackerOpts = {
rtcConfig: self.client._rtcConfig,
wrtc: self.client._wrtc,
rtcConfig: self.client.tracker.rtcConfig,
wrtc: self.client.tracker.wrtc,
getAnnounceOpts: function () {
var opts = {
uploaded: self.uploaded,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.