rqbit
repository·main·Indexed 23 days ago
https://github.com/ikatson/rqbitA high-performance BitTorrent client written in Rust featuring a robust HTTP API, Web UI, and desktop application. It includes librqbit, a fully featured torrent downloading library, and a specialized bencode crate for serialization and deserialization of Bencode-encoded data. The project also provides rqbit-log-to-postgres for efficiently loading JSON logs into a PostgreSQL database.
What's inside rqbit
- librqbit is a fully featured, easy-to-use BitTorrent downloading library written in Rust. It serves as the core engine for the rqbit application. For detailed API references, refer to the official documentation on docs.rs.
Configure the Parent Height Chain for Virtuoso
mainreact-virtuosorequires a parent container with an explicit height to function correctly. If the parent height is not defined, the list may not render.To ensure the virtualization container fills the available space, follow this CSS/Tailwind chain:
- Root elements (
html,body): Setheight: 100%. - App container: Use
h-screen flex flex-col. - Content area: Use
flex-1 min-h-0(orgrow min-h-0). - Virtuoso container: Use
flex-1 min-h-0.
Critical Note: The
min-h-0class is essential for flex children. Without it, flex items have an implicitmin-height: auto, which prevents them from shrinking below the size of their content, breaking the virtualization layout./* Required CSS chain example */ html, body: height: 100% └─ App container: h-screen flex flex-col └─ Content area: flex-1 min-h-0 └─ Virtuoso container: flex-1 min-h-0- Root elements (
Stream torrent files via HTTP
mainrqbit supports streaming torrent files (e.g., for video playback in VLC) with seeking support via HTTP Range headers. The server prioritizes pieces needed for the current stream position.
Streaming URL format:
http://IP:3030/torrents/<torrent_id>/stream/<file_id>Understand the Live Torrent State Architecture
mainThe live torrent state is managed through a coordinated system of data structures that track piece and chunk progress. The architecture ensures that every piece exists in exactly one of four disjoint states:
- COMPLETED:
have[piece] = true(verified) - IN_FLIGHT:
inflight.contains(piece)(being downloaded) - QUEUED:
queue_pieces[piece] = true(needed, waiting) - NOT_NEEDED: None of the above (deprioritized)
State coordination is handled by
PieceTracker, which wrapsChunkTrackerand managesinflightpieces to maintain these invariants during downloads, peer deaths, and checksum failures.- COMPLETED:
Access the Web UI and Desktop App
mainWeb UI
Once the server is running, access the Web UI at:
http://localhost:3030/web/Desktop App
The desktop app is a thin wrapper around the Web UI.
- macOS/Windows: Download from Releases.
- Linux: Build manually using
cargo tauri build.
cargo tauri buildEnable mDNS advertising
mainTo make the Web UI accessible via
http://rqbit.local:3030/web/on your local network, enable mDNS. This requires listening on a non-loopback address (like0.0.0.0):rqbit --enable-mdns --http-api-listen-addr 0.0.0.0:3030 server start ...Install rqbit
mainYou can install
rqbitusing several methods depending on your environment:- Homebrew (macOS/Linux):
brew install rqbit - Cargo (Rust toolchain):
cargo install rqbit - Docker: Use the official image
ikatson/rqbitfrom Docker Hub. - Pre-built binaries: Available in the Releases section.
brew install rqbit # or cargo install rqbit- Homebrew (macOS/Linux):
Quick start: Start the rqbit server
mainTo start the
rqbitserver and specify a download directory (e.g.,~/Downloads), use theserver startcommand:rqbit server start ~/DownloadsTo watch a specific folder for new
.torrentfiles, use the--watch-folderoption:rqbit server start --watch-folder [path] /download/pathEnable UPnP Media Server
mainTo advertise managed torrents to your LAN (e.g., for smart TVs) without transcoding, start the server with the
--enable-upnp-serverflag:rqbit --enable-upnp-server server start ...Develop the Web UI
mainTo develop the Web UI, you must first start the backend server and then run the Web UI development command.
- Start the server:
make devserver - Run Web UI dev:
make webui-dev
make devserver make webui-dev- Start the server:
Implement Virtualized Table View
mainFor table layouts, each row should be wrapped in its own
<table>element to maintain column alignment with the fixed header. This avoids complex layout issues within the virtualized container.Each
TorrentTableRowshould usetable-fixedand explicit cell widths to ensure columns line up across different rows.// TorrentTable.tsx const itemContent = useCallback( (index: number) => { const torrent = filteredTorrents![index]; return ( <TorrentTableRow torrent={torrent} isSelected={selectedTorrentIds.has(torrent.id)} onRowClick={handleRowClick} onCheckboxChange={toggleSelection} /> ); }, [filteredTorrents, selectedTorrentIds, handleRowClick, toggleSelection] ); return ( <div className="flex flex-col h-full"> {/* Fixed header */} <table className="w-full table-fixed"> <thead>...</thead> </table> {/* Virtualized body */} <div className="flex-1 min-h-0"> <Virtuoso totalCount={filteredTorrents?.length ?? 0} itemContent={itemContent} /> </div> </div> );// TorrentTableRow.tsx return ( <table className="w-full table-fixed"> <tbody > <tr className="h-[40px]"> <td className="w-8 align-middle">...</td> <td className="w-12 align-middle">...</td> {/* ... more cells with explicit widths */} </tr> </tbody> </table> );Configure Socks proxy support
mainUse the
--socks-urlflag to route traffic through a SOCKS proxy:rqbit --socks-url socks5://[username:password]@host:port ...