- design of this client is based on the BitTorrent v1.0 spec
- the client is written in Rust and only uses core
stdlibfor networking, i.e. notokioorasync- this was for a personal challenge to handle any asynchronous I/O using only
stdlib
- this was for a personal challenge to handle any asynchronous I/O using only
- custom
httpclient from scratch to sendGETrequests to the tracker - peer that performs the full BitTorrent peer wire protocol
- piece/block assembler and writer to disk
- central session orchestrator for concurrently handling downloads from multiple peers using a piece queue and handles validating pieces
cargo run --release -- \
--torrent <path/to/file.torrent> \
--output <path/to/output/file> \
--compact 1 \
--port 6881 \
--verboseI got the torrent from Debian's official site which can be found here.
Note that what lies in the current directory is the latest version of Debian, which at the time of writing is 12.10.0.
Also note that the list of peers that the tracker returns for this torrent are mostly IPv6 addresses, so the client
may not work as expected if you don't have IPv6 support on your network.
The page includes the following:
SHA256SUMSSHA256SUMS.signSHA512SUMSSHA512SUMS.signdebian-12.10.0-arm64-netinst.iso.torrent
To download all the files (you don't need to as you can eyeball the hash), you can use the following command:
wget https://cdimage.debian.org/debian-cd/current/arm64/bt-cd/SHA256SUMS \
https://cdimage.debian.org/debian-cd/current/arm64/bt-cd/SHA256SUMS.sign \
https://cdimage.debian.org/debian-cd/current/arm64/bt-cd/SHA512SUMS \
https://cdimage.debian.org/debian-cd/current/arm64/bt-cd/SHA512SUMS.sign \
https://cdimage.debian.org/debian-cd/current/arm64/bt-cd/debian-12.10.0-arm64-netinst.iso.torrentIf you downloaded a file (via the BT client), assuming it is named debian-12.10.0-arm64-netinst.iso, you can verify the hash of both
the *.torrent and *.iso files (assuming they're all in the same directory) using the following command:
sha512sum -c SHA512SUMS # or sums256 -c SHA256SUMSwhich should output something like:
debian-12.10.0-arm64-netinst.iso: OK
debian-12.10.0-arm64-netinst.iso.torrent: OK