mtorrent - a BitTorrent client in Rust
Hi everyone!
I'd like to share my BitTorrent client in Rust: https://github.com/DanglingPointer/mtorrent/
It's a full-fledged Tokio-based client with focus on performance and low memory and CPU footprint (I'm an ex-C++ developer). It supports many features like magnet links, DHT, PE, PEX, uTP etc (the full list can be found on GitHub). There is a CLI executable and a simple cross-platform GUI. Here's a list of all components:
- mtorrent: High-level library crate, https://docs.rs/mtorrent/0.4.3/mtorrent/ Contains functions to download a torrent, launch a DHT node, and a few utilities. Primarily useful if you're writing a GUI and need a full backend.
- mtorrent-core: Low-level library crate, https://crates.io/crates/mtorrent-core A collection of basic types for building asynchronous Tokio-based BitTorrent clients. The most suitable part to use as a library if you're building your own BitTorrent client. Contains implementations of all the necessary protocols (peer wire protocol, tracker protocol etc).
- mtorrnet-dht: Implementation of DHT (Distributed Hash Table) with high-level interface, https://crates.io/crates/mtorrent-dht A complete DHT engine. Doesn't expose low-level primitives like the DHT message types, but is convenient to use in any application that wants to launch a DHT node as part of it.
- mtorrent-utils: library containing some shared utilities, https://crates.io/crates/mtorrent-utils It is used by all other crates as a dependency. Some of the utilities are BitTorrent-specific, others are generic.
- mtorrent-cli: cross-platform CLI executable, https://crates.io/crates/mtorrent-cli Simple CLI for downloading one torrent at a time. Precompiled releases available on GitHub.
- mtorrent-gui: cross-platform GUI based on Tauri, https://github.com/DanglingPointer/mtorrent-gui Simple GUI that allows downloading multiple torrents simultaneously. The releases section on GitHub contains installers for Windows and Debian-based Linux.
The use of AI in this project is limited to unit tests and javascript code for the GUI.
Most of the library code requires Tokio and needs to run inside a LocalRuntime or LocalSet. The executables use tokio_unstable with multiple LocalRuntimes.
I've been using this regularly on my Ubuntu during the last couple of years and happy with its performance and reliability. I've also occasionally tested it on Windows.
For a blog post on the history of this project and the challenges I encountered in the process, see https://mikhailv.substack.com/p/the-story-of-mtorrent
Will be happy to implement more features if needed, and/or fix any bugs. Also feel free to contribute :)