diff options
author | Alex <alxmorais8@msn.com> | 2021-07-24 01:05:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-24 01:05:25 +0300 |
commit | 39bb33c3cf694cdee45378ea4b30c66c93576d2a (patch) | |
tree | 654d454bbcc6bba1deab2195ccf6bcbc2bbe4f60 /docs | |
parent | 524618edde211a2ce2c9d1e40f68a091699442fd (diff) |
feat: add speed limit to client (#2062)
* Add speed limit to client
* Fix standard
* Update docs/api.md
* Add changes from PR feedback
Co-authored-by: Kadu Diógenes <kadu@fnix.com.br>
Co-authored-by: Ivan Gorbanev <ivang@van.work>
Co-authored-by: ultimate-tester <jordimueters@hotmail.com>
Co-authored-by: Julen Garcia Leunda <hicom150@gmail.com>
Co-authored-by: Niklas Johansson <niklas.y.johansson@se.abb.com>
Co-authored-by: ThaUnknown <kapi.skowronek@gmail.com>
Co-authored-by: Diego RodrÃguez Baquero <github@diegorbaquero.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/api.md | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/docs/api.md b/docs/api.md index bbd3b3e..321d50f 100644 --- a/docs/api.md +++ b/docs/api.md @@ -60,8 +60,11 @@ If `opts` is specified, then the default options (shown below) will be overridde dht: Boolean|Object, // Enable DHT (default=true), or options object for DHT lsd: Boolean, // Enable BEP14 local service discovery (default=true) webSeeds: Boolean, // Enable BEP19 web seeds (default=true) + utp: Boolean, // Enable BEP29 uTorrent transport protocol (default=true) blocklist: Array|String, // List of IP's to block utp: Boolean, // Enable BEP29 uTorrent transport protocol (default=true) + downloadLimit: Number, // Max download speed (bytes/sec) over all torrents (default=-1) + uploadLimit: Number, // Max upload speed (bytes/sec) over all torrents (default=-1) } ``` @@ -74,6 +77,11 @@ For possible values of `opts.tracker` see the For possible values of `opts.blocklist` see the [`load-ip-set` documentation](https://github.com/webtorrent/load-ip-set#usage). +For `downloadLimit` and `uploadLimit` the possible values can be: + - `> 0`. The client will set the throttle at that speed + - `0`. The client will block any data from being downloaded or uploaded + - `-1`. The client will is disable the throttling and use the whole bandwidth available + ## `client.add(torrentId, [opts], [function ontorrent (torrent) {}])` Start downloading a new torrent. @@ -216,6 +224,19 @@ Total download progress for all **active** torrents, from 0 to 1. Aggregate "seed ratio" for all torrents (uploaded / downloaded). +## `client.throttleDownload(rate)` + +Sets the maximum speed at which the client downloads the torrents, in bytes/sec. + +`rate` must be bigger or equal than zero, or `-1` to disable the download throttle and +use the whole bandwidth of the connection. + +## `client.throttleUpload(rate)` + +Sets the maximum speed at which the client uploads the torrents, in bytes/sec. + +`rate` must be bigger or equal than zero, or `-1` to disable the upload throttle and +use the whole bandwidth of the connection. # Torrent API @@ -760,4 +781,4 @@ Peer's remote port. Only exists for tcp/utp peers. ## `wire.destroy()` -Close the connection with the peer. This however doesn't prevent the peer from simply re-connecting.
\ No newline at end of file +Close the connection with the peer. This however doesn't prevent the peer from simply re-connecting. |