In addition to returning a boolean (`true` for allowed, `false` for
disallowed), you can return an `Error` object to disallow and provide a
custom reason.
Fixes#85
- The expected signature for opts.filter is now:
function myFilterFn (infoHash, params, cb) {
cb(infoHash === 'blah)
}
This allows interfacing with a database and fixes#80.
Also, swarm.getSwarm() is no longer responsible for creating a Swarm
instance, only returning an instance if there is already one. Creating
a swarm happens in swarm.createSwarm(). This change only affects users
who were override swarm.getSwarm().
This PR merges webtorrent-tracker into this repo. Keeping the code in
sync between the two repos was becoming burdensome. This change should
not effect performance of the server since the webtorrent tracker is
disabled by default.
To enable the webtorrent tracker (disabled by default), do:
```js
var server = new Server({ ws: true })
```
Breaking changes:
- 'listening' event no longer emits with `port` param
- `server.port` property removed (instead, use
`server.http.address().port`)
Added features:
- expose http server as `server.http`
- expose udp server as `server.udp`
- client.destroy() - ungracefully leave the swarm
- server: added `filter` option to black/whitelist torrents
Bugfixes:
- client considers udp tracker errors to be warnings
- emit 'start', 'stop', 'update', etc. AFTER response sent
- fix udp error response action and message being `undefined`
Internal:
- remove `portfinder` dep
- add complete test for `filter` functionality
Before this fix, udp tracker urls needed to contain “/announce” or else
we would assume the tracker doesn’t support scrape. (This is correct
behavior for http trackers, but not udp)