Crates.io | gnostr-bits |
lib.rs | gnostr-bits |
version | 0.0.2 |
source | src |
created_at | 2024-02-07 18:20:03.897011 |
updated_at | 2024-02-09 20:20:25.552937 |
description | A bittorrent service for gnostr. |
homepage | |
repository | https://github.com/gnostr-org/gnostr-bits |
max_upload_size | |
id | 1130803 |
size | 106,627 |
rqbit is a bittorrent client written in Rust. Has HTTP API and Web UI, and can be used as a library.
Also has a desktop app built with Tauri (on Windows and OSX).
Assuming you are downloading to ~/Downloads.
rqbit server start ~/Downloads
Assuming you are downloading to ~/Downloads. If the server is already started, -o ~/Downloads
can be omitted.
rqbit download -o ~/Downloads 'magnet:?....' [https?://url/to/.torrent] [/path/to/local/file.torrent]
Access with http://localhost:3030/web/. It looks similar to Desktop app, see screenshot below.
The desktop app is a thin wrapper on top of the Web UI frontend.
Download it in Releases.
As you can see from the Desktop app screenshot, it's fast. Anecdotally from a few reports, it's faster than other clients they've tried, at least with their default settings.
Memory usage for the server is usually within a few tens of megabytes, which makes it great for e.g. RaspberryPI.
CPU is spent mostly on SHA1 checksumming.
There are pre-built binaries in Releases. If someone wants to put rqbit into e.g. homebrew, PRs welcome :)
If you have rust toolchain installed, this should work:
cargo install rqbit
Just a regular Rust binary build process.
cargo build --release
Increase verbosity. Possible values: trace, debug, info, warn, error.
Will print the contents of the torrent file or the magnet link.
If you want to resume downloading a file that already exists, you'll need to add this option.
This will increase the default peer connect timeout. The default one is 2 seconds, and it's sometimes not enough.
Use a regex here to select files by their names.
PRs are very welcome.
By default it listens on http://127.0.0.1:3030.
curl -s 'http://127.0.0.1:3030/'
{
"apis": {
"GET /": "list all available APIs",
"GET /dht/stats": "DHT stats",
"GET /dht/table": "DHT routing table",
"GET /torrents": "List torrents (default torrent is 0)",
"GET /torrents/{index}": "Torrent details",
"GET /torrents/{index}/haves": "The bitfield of have pieces",
"GET /torrents/{index}/peer_stats": "Per peer stats",
"GET /torrents/{index}/stats/v1": "Torrent stats",
"GET /web/": "Web UI",
"POST /rust_log": "Set RUST_LOG to this post launch (for debugging)",
"POST /torrents": "Add a torrent here. magnet: or http:// or a local file.",
"POST /torrents/{index}/delete": "Forget about the torrent, remove the files",
"POST /torrents/{index}/forget": "Forget about the torrent, keep the files",
"POST /torrents/{index}/pause": "Pause torrent",
"POST /torrents/{index}/start": "Resume torrent"
},
"server": "rqbit"
}
curl -d 'magnet:?...' http://127.0.0.1:3030/torrents
OR
curl -d 'http://.../file.torrent' http://127.0.0.1:3030/torrents
OR
curl --data-binary @/tmp/xubuntu-23.04-minimal-amd64.iso.torrent http://127.0.0.1:3030/torrents
Supported query parameters, all optional:
First of all, I love Rust. The project was created purely for the fun of the process of writing code in Rust.
I was not satisfied with my regular bittorrent client, and was wondering how much work would it be to create a new one from scratch, and it got where it is, starting from bencode protocol implemenation, then peer protocol, etc, etc.