Commit Graph

46 Commits

Author SHA1 Message Date
Feross Aboukhadijeh
fb751d7c96 Re-enable ws server tests (websocket tracker) 2017-01-29 16:25:16 -08: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
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
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
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
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
9db28c2fad massive cleanup 2015-07-29 01:47:09 -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
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
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
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
01286e2ee7 listen() without port picks random port 2014-08-16 19:05:56 -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
0a51e59bd0 better test error messages 2014-07-10 21:00:02 -07:00
Feross Aboukhadijeh
15a6f3c715 require('bittorrent-tracker') returns Client 2014-06-07 15:15:00 -07:00
Feross Aboukhadijeh
14034c2848 wait for server close before next test 2014-05-23 20:43:45 -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
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
Aliaksei Sapach
dfd235d387 fixed test plan 2014-05-18 19:41:42 +03:00
Aliaksei Sapach
55120f5c48 added a failing test 2014-05-18 19:15:20 +03:00
Feross Aboukhadijeh
e5e0fa9e27 minor style cleanup 2014-05-11 17:32:57 -07:00
fisch0920
5064a05dde added client and server support for scrape messages in addition to announce messages (tcp and udp) 2014-05-09 02:38:41 -04:00
Feross Aboukhadijeh
dfd5149d6b fix #11 - support torrents with 64-bit file sizes 2014-04-18 23:28:59 -07:00
Feross Aboukhadijeh
60b7f8dd09 add more thorough server tests 2014-04-18 23:00:40 -07:00
Feross Aboukhadijeh
31b82e0a2b add bittorrent tracker server implementation! 2014-03-27 00:17:49 -07:00