Commit Graph

82 Commits

Author SHA1 Message Date
Feross Aboukhadijeh
9cf2dffa67 debug: better debug names 2017-01-20 18:34:33 -08:00
Feross Aboukhadijeh
c4f4f012dd Add fixes and tests for PR #179 2017-01-16 15:43:47 -08:00
Feross Aboukhadijeh
cb8c324ebe Support lazy 'wrtc' module initialization
For: https://github.com/feross/webtorrent-hybrid/issues/46
2016-10-03 23:42:02 -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
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
2ee240ea16 Fix low-risk uninitialized memory buffer issue 2016-05-25 13:49:19 -07:00
Feross Aboukhadijeh
c648f2e5e6 Better WebRTC detection
Before, any environment with a `window` would be detected as supporting
WebRTC.
2016-05-13 16:49:12 -07:00
Feross Aboukhadijeh
0d9ee4c93a Allow {wrtc: false} to disable WebRTC support 2016-05-13 16:49:12 -07:00
Feross Aboukhadijeh
06f86a0733 Fix getAnnounceOpts function leak 2016-04-21 03:15:55 -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
ede2119f78 Fixes for PR #128 2016-03-15 21:41:10 -07:00
Diego Rodríguez Baquero
0133c96d22 Remove unneeded parenthesis 2016-03-15 00:18:18 -03:00
Diego Rodríguez Baquero
3d84d44abc Don't add insecure trackers on a https site
https://github.com/feross/webtorrent/issues/67#issuecomment-189853184
2016-03-15 00:16:25 -03:00
Feross Aboukhadijeh
3485f2275b update documentation for #107 2016-02-29 18:16:08 -08:00
Feross Aboukhadijeh
e15125ca80 test: add tests for getAnnounceOpts (#107) 2016-02-29 17:02:55 -08:00
Feross Aboukhadijeh
b34fc100a1 fixes for PR #107 2016-02-29 12:34:06 -08:00
Yoann Ciabaud
f1669a506e Provide a way to give updated announce opts via callback on setInterval 2016-02-03 08:28:38 +01:00
Feross Aboukhadijeh
177171b82c expose client.peerId and client.peerIdBuffer 2015-12-02 22:33:15 -08:00
Feross Aboukhadijeh
d344537766 expose client.infoHash and client.infoHashBuffer 2015-12-02 15:46:41 -08:00
Feross Aboukhadijeh
e9322a32d6 code style 2015-12-02 15:31:20 -08:00
Aram Drevekenin
ab3482fc4f Changed infoHash to always be hex 2015-11-29 16:02:29 +02:00
Feross Aboukhadijeh
9db28c2fad massive cleanup 2015-07-29 01:47:09 -07:00
Feross Aboukhadijeh
3746c05d79 restructure folders 2015-07-29 00:26:44 -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
5b79d42dcd client: destroy callback isn't called until after cleanup 2015-07-16 18:33:50 -07:00
Feross Aboukhadijeh
907691b914 jsdoc 2015-07-09 15:39:40 -07:00
Feross Aboukhadijeh
0b75c1ef26 client.destroy takes a callback 2015-07-08 10:14:11 -07:00
Feross Aboukhadijeh
8e29227003 emit 'warning' for unsupported tracker protocol 2015-05-29 14:24:28 -07:00
Feross Aboukhadijeh
e4d413d83b fix regression: convert buffer to string 2015-05-24 16:43:30 +02:00
Feross Aboukhadijeh
c1bbade6d7 cache infohash and peerid 2015-05-20 06:45:59 -07:00
Feross Aboukhadijeh
bb145cce14 ws client: ignore offers/answers from self 2015-05-20 06:40:25 -07:00
Feross Aboukhadijeh
8788d75737 udp/ws clients: add destroy functions
Fixes #75
2015-05-16 23:25:34 -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
c048f1b2a9 cleanup self._trackers 2015-05-16 22:55:01 -07:00
Feross Aboukhadijeh
153402ae85 don't modify passed in torrent object 2015-05-16 22:54:45 -07:00
Feross Aboukhadijeh
938c025ed9 remove wrtc dependency
For #303
2015-05-03 17:21:08 -07:00
Feross Aboukhadijeh
d56dd26950 standard 2015-05-03 14:00:51 -07:00
Feross Aboukhadijeh
1cc5a511bd udp server: support multiple info_hash scrape
Fixes #33
2015-05-01 17:36:07 -07:00
Feross Aboukhadijeh
a5d0975dfa Do not crash when wrtc dep is missing 2015-04-20 16:38:59 -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
1ff5769054 add support for webtorrent (websocket) trackers 2015-03-24 01:52:35 -07:00
Feross Aboukhadijeh
f575cfc3c9 major client refactor - each tracker type into its own file
in preparation of adding a new websocket tracker type, for webtorrent
2015-03-24 01:01:49 -07:00
Feross Aboukhadijeh
67daf78c2d style 2015-03-09 20:19:27 -07:00
zckevin
8ee64c05f8 [Client] Fix question mark in announceUrl 2015-03-09 12:40:35 +08:00
Feross Aboukhadijeh
72922a64e4 fix regression in 3.0.1 2015-01-31 15:25:37 -08:00
Feross Aboukhadijeh
287cd873bc remove extend.js 2015-01-31 15:04:16 -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
Feross Aboukhadijeh
a6f14037ff style 2015-01-28 18:09:23 -08:00
Feross Aboukhadijeh
ebb86f728f JavaScript Standard Style
https://github.com/feross/standard
2015-01-26 18:16:01 -08:00
Feross Aboukhadijeh
d562f14e06 fix debug usage 2015-01-23 22:42:05 -08:00