Commit Graph

64 Commits

Author SHA1 Message Date
Feross Aboukhadijeh
b5096e91c3 Support async createSwarm() and getSwarm()
Fix #95.

Make server.getSwarm() and server.createSwarm() into async functions
that take a callback.
2016-01-03 19:50:23 +01:00
Feross Aboukhadijeh
15147880a2 test: remove sample trackers 2015-12-28 21:26:29 +01:00
Feross Aboukhadijeh
959ddbd5f3 fix test for setInterval() change 2015-12-05 00:06:23 -08:00
Feross Aboukhadijeh
38a80093a1 Fix UDP scrape returning invalid info hashes (Fix #97) 2015-12-02 15:35:42 -08:00
Feross Aboukhadijeh
9db28c2fad massive cleanup 2015-07-29 01:47:09 -07:00
Feross Aboukhadijeh
c3abef72ce tracker should not modify opts object, it's passed to all trackers 2015-07-27 15:19:18 -07:00
Feross Aboukhadijeh
89b3fb3086 support custom filter error messages
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
2015-07-08 10:13:52 -07:00
Feross Aboukhadijeh
bf5b9f289a BREAKING: opts.filter function is async; add createSwarm
- 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().
2015-07-04 17:13:07 -07:00
Feross Aboukhadijeh
37f95b4b54 small cleanup 2015-07-04 17:10:41 -07:00
Feross Aboukhadijeh
02c92fd2ba randomize the peers that are given out 2015-05-19 04:32:09 -07:00
Feross Aboukhadijeh
f285c9dd3c client.stop() no longer calls client.destroy()
You must call client.destroy() manually to clean up resources
2015-05-16 23:24:20 -07:00
Feross Aboukhadijeh
1cc5a511bd udp server: support multiple info_hash scrape
Fixes #33
2015-05-01 17:36:07 -07:00
Feross Aboukhadijeh
03bed33457 add webtorrent (websocket) tracker server
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 })
```
2015-03-27 16:19:06 +13:00
Feross Aboukhadijeh
d759456d7a test: speed up 2015-03-24 01:02:10 -07:00
Feross Aboukhadijeh
6ac9ae6a6e perf: don't dynamically add new properties to peer objects 2015-02-02 15:20:15 -08:00
Feross Aboukhadijeh
82e6792a6b BREAKING CHANGES
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
2015-01-29 14:59:08 -08:00
Sidd Sridharan
55079798c5 white/blacklist implemented (#44) + docs/tests updated 2015-01-29 12:24:17 -08:00
Feross Aboukhadijeh
ebb86f728f JavaScript Standard Style
https://github.com/feross/standard
2015-01-26 18:16:01 -08:00
Feross Aboukhadijeh
94feea69e2 Support http tracker redirects, gzip/deflate 2015-01-22 14:23:53 -08:00
Feross Aboukhadijeh
69211515c2 encode special characters @*/+ in http tracker urls
Fixes https://github.com/feross/webtorrent/issues/196
2014-12-17 21:18:46 -08:00
Astro
d79bf92db0 server: ipv6 support 2014-12-13 00:12:47 +01:00
Feross Aboukhadijeh
79068a49cf Use hex info_hash and peer_id throughout 2014-12-12 02:02:11 -08:00
Astro
aea3c44c08 server: expose getSwarm()
drops capability to pass a *hex* infoHash
2014-12-09 23:18:47 +01:00
Astro
28189a0b12 server tests: fix serverType in announceUrl 2014-12-05 02:41:57 +01:00
Astro
f77015c046 server tests: run udp tests with udp 2014-12-04 17:38:03 +01:00
Feross Aboukhadijeh
32b622aa51 cleanup tests 2014-11-26 20:18:56 +08:00
Feross Aboukhadijeh
01286e2ee7 listen() without port picks random port 2014-08-16 19:05:56 -07:00
Feross Aboukhadijeh
9e22aa40f1 cleanup tests 2014-07-23 19:16:23 -07:00
Feross Aboukhadijeh
e6de7a2f54 add tests for scraping a udp tracker (fix #34) 2014-07-21 22:58:13 -07:00
Feross Aboukhadijeh
231ff5709c correctly detect UDP tracker scrape support
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)
2014-07-20 04:34:32 -07:00
Feross Aboukhadijeh
be875c40af Fix serious client+server encoding error (fix #32) 2014-07-12 18:44:41 -07:00
Feross Aboukhadijeh
8b9dfb55b8 add test for announce with numwant 2014-07-11 03:50:48 -07:00
Feross Aboukhadijeh
7b5cd6bb7f unify client http + udp test suites 2014-07-11 03:50:35 -07:00
Feross Aboukhadijeh
5037cb3e32 unify server http + udp test suites 2014-07-11 03:49:45 -07:00
Feross Aboukhadijeh
b4928f001a Server perf: Use binary info_hash strings (fix #29) 2014-07-10 22:05:56 -07:00
Feross Aboukhadijeh
1681474f0e fail client tests on warning 2014-07-10 21:58:19 -07:00
Feross Aboukhadijeh
539f1bf65d add single scrape, multi scrape, all scrape tests 2014-07-10 21:30:30 -07:00
Feross Aboukhadijeh
0a51e59bd0 better test error messages 2014-07-10 21:00:02 -07:00
Feross Aboukhadijeh
bf1d382c7a http tracker server: error on missing params 2014-07-10 19:59:33 -07:00
Feross Aboukhadijeh
15a6f3c715 require('bittorrent-tracker') returns Client 2014-06-07 15:15:00 -07:00
Feross Aboukhadijeh
62be68979b ALL TESTS WORK OFFLINE
Fixes #18
2014-05-23 21:17:31 -07:00
Feross Aboukhadijeh
2aea063b8c make client tests work offline
for #18
2014-05-23 21:14:19 -07:00
Feross Aboukhadijeh
dc6f355391 make magnet test work offline
for #18
2014-05-23 21:02:53 -07:00
Feross Aboukhadijeh
14034c2848 wait for server close before next test 2014-05-23 20:43:45 -07:00
Feross Aboukhadijeh
954b3af78e make large torrent test not depend on the network
for #18
2014-05-23 20:35:29 -07:00
Feross Aboukhadijeh
b3d4acbb46 simplify server tests 2014-05-23 20:35:01 -07:00
Feross Aboukhadijeh
eddef2f197 print out warning messages in tests 2014-05-23 18:03:50 -07:00
Feross Aboukhadijeh
f6d020128c add failing udp server test 2014-05-23 18:01:51 -07:00
Feross Aboukhadijeh
d1aca7c3d4 disable udp tracker for http server test 2014-05-23 18:01:42 -07:00
Feross Aboukhadijeh
67be6227c0 cleanup server test 2014-05-18 18:35:12 -07:00