Commit Graph

97 Commits

Author SHA1 Message Date
Feross Aboukhadijeh
d8bb9c53f7 Use queueMicrotask on client 2021-02-09 21:38:01 -08:00
Feross Aboukhadijeh
eb69f8d7ab standard 2020-10-21 13:47:38 -10:00
KayleePop
0c459aff78 use native Set instead of uniq library 2020-03-15 16:24:44 -05:00
Feross Aboukhadijeh
da70afd3b3 add additional info in debug logs 2019-08-11 14:32:15 -07:00
Feross Aboukhadijeh
d6751dac41 remove safe-buffer 2019-08-06 17:58:05 -07:00
Feross Aboukhadijeh
93b41391a9 BREAKING: drop Node 8 support 2019-08-05 14:54:20 -07:00
Feross Aboukhadijeh
1a075bd159 standard 2019-07-05 14:36:14 -07:00
Feross Aboukhadijeh
c37aac7277 'url.parse' was deprecated since v11.0.0. Use 'url.URL' constructor instead 2019-07-04 21:41:39 -07:00
Alex
5c90b2b6ac Add validation for tracker port 2019-04-06 00:10:20 +02:00
Jimmy Wärting
447423fc46 modernize client and index using lebab
- Uses class, const let, etc
- Removed self variable
- Creating a new Client without `new` keyword don’t work anymore
- Replaced inherits with class extends
2018-10-03 12:09:02 +02:00
Jimmy Wärting
65b2bdc804 removed xtend 2018-10-02 15:09:02 +02:00
Feross Aboukhadijeh
3ec7aace26 Ensure infoHash is lowercase 2018-04-20 18:23:48 -07:00
Feross Aboukhadijeh
056a83d1b5 feross -> webtorrent 2017-04-14 12:50:19 -07:00
Feross Aboukhadijeh
1dd1cc32da Revert "client: socketPool should not be shared across clients"
This reverts commit 3f3db7deb1.
2017-02-28 15:41:52 -08:00
Feross Aboukhadijeh
3f3db7deb1 client: socketPool should not be shared across clients
Caught this issue because of the new eviction tests. Essentially, this
change moves the socketPool into the client instance instead of a
reused variable at the module level.

When a client sends stop (or is evicted) the server will close the
websocket connection if that client is not in any other swarms (based
on peerId). However, if we are using a single socket for multiple
clients (as was the case before this commit), then other clients will
have their sockets unintentionally closed by the server.
2017-02-08 13:20:41 -08:00
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