A blazingly fast BitTorrent client written in Rust
Download torrents and magnet links from the command line with ease
π Quick Start β’ π Documentation β’ π€ Contributing
|
Parse and decode bencoded values and torrent metadata
|
Peer discovery and protocol handshakes
|
|
Flexible download options for pieces and complete files
|
Complete magnet link support
|
|
High-performance asynchronous operations
|
|
- Rust (latest stable version recommended)
# Clone the repository
git clone https://github.com/nayiswftw/Rusbit.git
cd rusbit-cli
# Build in release mode for optimal performance
cargo build --releaseThe binary will be available at target/release/rusbit-cli.
./target/release/rusbit-cli --versionDownload a torrent file:
rusbit-cli download -o myfile.txt sample.torrentDownload via magnet link:
rusbit-cli magnet-download -o myfile.txt "magnet:?xt=urn:btih:c5fb9894bdaba464811b088d806bdd611ba490af&dn=magnet3.gif&tr=http%3A%2F%2Fbittorrent-test-tracker.codecrafters.io%2Fannounce"Get torrent information:
rusbit-cli info sample.torrent- -v, --verbose: Enable verbose logging
- -p, --progress: Show progress bar during downloads
- -h, --help: Display help information
- -V, --version: Display version information
rusbit-cli decode "<bencoded-string>"rusbit-cli info <torrent-file>rusbit-cli peers <torrent-file>rusbit-cli handshake <torrent-file> <peer-address>rusbit-cli download-piece -o <output-file> <torrent-file> <piece-index>rusbit-cli download -o <output-file> <torrent-file>π Magnet Link Operations
rusbit-cli magnet-parse "<magnet-link>"rusbit-cli magnet-handshake "<magnet-link>"rusbit-cli magnet-info "<magnet-link>"rusbit-cli magnet-download-piece -o <output-file> "<magnet-link>" <piece-index>rusbit-cli magnet-download -o <output-file> "<magnet-link>"rusbit-cli download -o ubuntu.iso ubuntu.torrentrusbit-cli --verbose magnet-download -o movie.mp4 "magnet:?xt=urn:btih:...&dn=Movie&tr=..."rusbit-cli info sample.torrentOutput:
Tracker URL: http://bittorrent-test-tracker.codecrafters.io/announce
File Name: sample.txt
File Length: 92063 bytes
Piece Length: 32768 bytes
Info Hash: 2d88a4bf3...
Piece Hashes:
Piece 0: 1c8f1...
Piece 1: 8e4f5...
Piece 2: 3b2a7...
Total Pieces: 3
rusbit-cli --progress download -o ubuntu.iso ubuntu.torrentrusbit-cli --progress magnet-download -o movie.mp4 "magnet:?xt=urn:btih:...&dn=Movie&tr=..."On first run, Rusbit creates a rusbit.toml configuration file with default settings. You can modify this file to customize:
- Peer ID prefix: Customize your client identification
- Listen port: Port for incoming peer connections
- Maximum connections: Limit concurrent peer connections
- Piece timeout: Timeout for piece downloads (seconds)
- Request timeout: Timeout for peer requests (seconds)
- Maximum retries: Number of retry attempts for failed operations
- Download directory: Default output directory
Example rusbit.toml:
π Example Configuration
peer_id_prefix = "-RB0001-"
listen_port = 6881
max_connections = 50
piece_timeout = 30
request_timeout = 10
max_retries = 3
download_directory = "."β Connection timeouts
- Check your internet connection - Try different torrent files or magnet links - Adjust timeout settings in `rusbit.toml`π Low download speeds
- Ensure multiple peers are available - Check firewall settings - Try running with verbose logging: `rusbit-cli --verbose ...` - Use the progress bar to monitor download status: `rusbit-cli --progress ...`π¨ Build failures
- Ensure you have the latest Rust stable version - Update dependencies: `cargo update` - Clean and rebuild: `cargo clean && cargo build`- Open an issue on GitHub
- Check existing issues for similar problems
- Provide verbose logs when reporting bugs
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and add tests
- Run tests:
cargo test - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
# Clone and build
git clone https://github.com/nayiswftw/Rusbit.git
cd rusbit-cli
cargo build
# Run tests
cargo test
# Run with sample data
cargo run -- info sample.torrentThis project is licensed under the MIT License - see the LICENSE file for details.
Made with β€οΈ in Rust