Commit Graph

103 Commits

Author SHA1 Message Date
Feross Aboukhadijeh
15a35cedd9 add test: no "update" events after destroy() 2016-09-16 07:49:49 -07:00
Feross Aboukhadijeh
55eda0ed93 Run all tests 2016-08-05 18:41:25 -07:00
Feross Aboukhadijeh
59bba81c5a Fix Client.scrape returns no error on invalid URL
Fix #167.
2016-08-05 18:23:43 -07:00
Feross Aboukhadijeh
a59a3069b5 Fix webtorrent version parsing 2016-07-29 18:18:32 -07:00
Yoann Ciabaud
f76b27c12a Merge pull request #160 from yciabaud/lru-pruning
Limit peers in tracker server with LRU based cache fixes #4
2016-07-19 19:50:25 +02:00
Feross Aboukhadijeh
cc783392c4 fixes for standard v8 2016-07-13 13:54:19 -07:00
Yoann Ciabaud
2ac65725a1 Merge pull request #158 from yciabaud/stats-clients
Add stats on clients based on peerIds
2016-06-23 15:08:23 +02:00
Yoann Ciabaud
29fcf30cb4 Use correct HTTP header to work with JSON on GET 2016-06-13 00:34:26 +02:00
Yoann Ciabaud
d51a77b028 Update lru package to 3.0.0 and set peersCacheLength to 1K as default 2016-06-10 10:00:19 +02:00
Yoann Ciabaud
1dbc95cbdc Add pruning to server tests.
Issue #4
2016-06-09 01:28:49 +02:00
Yoann Ciabaud
ca522c0c4b Prune old peers in server with lru based cache. Issue #4 2016-06-08 23:57:01 +02:00
Yoann Ciabaud
f8c7de5213 Add stats on clients based on peerIds 2016-06-07 14:34:38 +02:00
Yoann Ciabaud
d7a651f360 Fixes for PR #155 2016-06-07 10:49:27 +02:00
Feross Aboukhadijeh
52aacc1db0 Merge pull request #156 from yciabaud/scrape-test
Restore scrape test for websocket tracker now it is is supported
2016-06-04 23:09:20 -07:00
Yoann Ciabaud
54782bc7e0 Restore scrape test for websocket tracker now it is is supported 2016-06-04 15:50:46 +02:00
Feross Aboukhadijeh
2959c2cea6 Use safe-buffer
Use the new Buffer APIs from Node v6 for added security. For example,
`Buffer.from()` will throw if passed a number, unlike `Buffer()` which
allocated UNINITIALIZED memory in that case.

Use the `safe-buffer` package for compatibility with previous versions
of
Node.js, including v4.x, v0.12, and v0.10.

https://github.com/feross/safe-buffer
2016-05-29 23:12:23 -07:00
Feross Aboukhadijeh
5e8fefc7d1 disable stalling websocket server tests 2016-03-31 23:35:26 -07:00
Feross Aboukhadijeh
9a48e1c10a Add failing test for #141 2016-03-31 21:48:21 -07:00
Feross Aboukhadijeh
2966165a8f BREAKING: Client() takes single opts object now
To use the client, you used to pass in four arguments:

`new Client(peerId, port, parsedTorrent, opts)`

Now, passing in the torrent is no longer required, just the `announce`
and `infoHash` properties. This decouples this package from
`parse-torrent`.

All options get passed in together now:

new Client({
infoHash: '', // hex string or Buffer
peerId: '', // hex string or Buffer
announce: [], // list of tracker server urls
port: 6881 // torrent client port, (in browser, optional)
})

All the normal optional arguments (rtcConfig, wrtc, etc.) can still be
passed in with the rest of these options.

Fixes #118. Fixes #115.

Added ws tests for scrape.
2016-03-31 21:37:51 -07:00
Feross Aboukhadijeh
d3a7c94f36 fix tests 2016-03-26 20:29:05 -07:00
Feross Aboukhadijeh
b5687c6a3b Revert "Re-enabled wrtc server tests, using SIGKILL to ensure Electron daemon gets killed"
This reverts commit 7369b6b900.
2016-03-26 19:46:15 -07:00
Matt Bell
7369b6b900 Re-enabled wrtc server tests, using SIGKILL to ensure Electron daemon gets killed 2016-03-25 00:34:37 -07:00
Feross Aboukhadijeh
5c5f986a54 disable websocket server tests 2016-03-24 05:09:21 -07:00
Feross Aboukhadijeh
0b7edf84a7 try to make wrtc test reliable on node v5 2016-03-24 01:35:19 -07:00
Feross Aboukhadijeh
d079171044 Fixes for PR #129 2016-03-16 17:58:47 -07:00
Yoann Ciabaud
c2115fbf7f Adds unit testing for websocket server 2016-03-16 17:33:06 -07:00
Feross Aboukhadijeh
e336f1a070 test: use webtorrent-fixtures 2016-03-16 12:22:33 -07:00
Yoann Ciabaud
eb3cefec35 Use type from server to filter peers to offer 2016-03-13 15:51:08 +01:00
Feross Aboukhadijeh
48d1f38e63 test/server: use common.createServer 2016-02-29 18:09:04 -08:00
Feross Aboukhadijeh
4207d80f28 test/scrape: use common.createServer 2016-02-29 17:55:31 -08:00
Feross Aboukhadijeh
3342c20b6b test: add test for ws tracker for filter tests 2016-02-29 17:39:03 -08:00
Feross Aboukhadijeh
2abab6c653 test: test http/ws trackers in magnet test 2016-02-29 17:15:03 -08:00
Feross Aboukhadijeh
fe4a6720b7 test: make large torrent test more thorough 2016-02-29 17:14:47 -08:00
Feross Aboukhadijeh
012b31553b test: add large torrent tests for ws tracker 2016-02-29 17:11:02 -08:00
Feross Aboukhadijeh
e15125ca80 test: add tests for getAnnounceOpts (#107) 2016-02-29 17:02:55 -08:00
Feross Aboukhadijeh
7893d5c5bf remove failing ws test 2016-02-29 17:02:36 -08:00
Feross Aboukhadijeh
7a0fe31ba5 add websocket tracker tests 2016-02-29 14:48:23 -08:00
Feross Aboukhadijeh
1e919c44cb changes for simple-get 2.0.0 2016-02-14 00:31:44 -08:00
Feross Aboukhadijeh
87d3189420 standard 6 prep 2016-02-05 14:08:46 -08:00
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