Commit Graph

105 Commits

Author SHA1 Message Date
Cas
5b8db067e4
perf: use simple-peer/lite (#475) 2023-06-16 22:50:47 +01:00
Cas
3b2dedb415
fix: replace simple-peer with maintained one (#466) 2023-05-27 18:14:52 +01:00
Cas
52f55020f3
fix: only stringify views (#467) 2023-05-27 16:41:31 +00:00
Cas
c99eb89208
fix: drop buffer (#465) 2023-05-26 17:54:30 +01:00
Cas
e6d3189edf
feat: esm (#431)
BREAKING CHANGE: ESM only

* feat: esm

* fix: linter oops
2022-12-05 23:06:54 +01:00
Alex
ad64dc3a68
feat: add proxy support for tracker clients (#356)
* Add a httpAgent options to http and websocket client trackers.

* Add a socks proxy to udp client trackers.

* Update http agent mock to node 5+

* Bugfix in socks configuration

* Use new socket to connect to the proxy relay and slice the proxy header from the message

* Add documentation for proxy

* Provide http and https agents for proxy.
Change proxy options structure and auto populate socks HTTP agents.

* Update documentation

* Check socks version for UDP proxy

* Clone proxy settings to prevent Socks instances concurrency

* Generate socks http agents on the fly (reuse is not working)

* Use clone to deepcopy socks opts

* Dont create agent for now since we cannot reuse it between requests.

* Removed unused require

* Add .gitignore

* Fix merge conflict

* Fix URL toString

* Fix new Socket constructor

Co-authored-by: Yoann Ciabaud <yoann@sonora.io>
2021-08-20 16:08:36 -05:00
Diego Rodriguez Baquero
e5994d2ebd
fix: modernize 2021-06-14 20:54:41 -05:00
Alex
8e24a8c97b fix: UDP url parsing 2021-05-20 21:38:51 +02:00
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