ARUNexe/RustBitTorrent

A bit torrent client implementation in Rust lang

Rust

0

0 commits

updated Oct 6, 2026

See the code

See what people are saying

SourceMessageScoreDate

BitTorrent client in Rust (r/rust)

I recently finished the core implementation of a BitTorrent downloader in Rust, mainly as a way to understand how the protocol and asynchronous networking work under the hood and to get a good understanding of rust. GitHub:…

1

Oct 6, 2026

README

RustBitTorrent

A minimal BitTorrent client written in Rust. It reads a .torrent file, requests peers from its tracker, and downloads pieces over TCP.

Features

  • Bencode decoding for torrent metadata and tracker responses
  • Tracker announce and peer discovery
  • BitTorrent peer handshake and basic message handling
  • Piece selection, block requests, and SHA-1 piece verification
  • Concurrent peer handling, piece scheduling and shared download state
  • Asynchronous file storage

How it works

  1. Reads a torrent file path from the command line (defaults to the bundled sample torrent).
  2. Decodes the metadata and calculates the info hash and piece count.
  3. Announces to the tracker and parses the returned peer list.
  4. Connects to peers, completes the handshake, and requests blocks for available pieces.
  5. Verifies each complete piece against the torrent's SHA-1 hashes, then writes verified data at its file offset.

Run

cargo run -- path/to/file.torrent

Without a path, the client uses test_torrent_files/ContinuousTimeBayesianNetworkReasoningandLearningEngine.torrent.

Current Limitations

  1. Seeding is not implemented
  2. Resume support is not implemented
  3. Multi-file torrents are not currently supported

ARUNexe/RustBitTorrent

A bit torrent client implementation in Rust lang

Rust

0

0 commits

updated Oct 6, 2026

See the code

See what people are saying

SourceMessageScoreDate

BitTorrent client in Rust (r/rust)

I recently finished the core implementation of a BitTorrent downloader in Rust, mainly as a way to understand how the protocol and asynchronous networking work under the hood and to get a good understanding of rust. GitHub:…

1

Oct 6, 2026

README

RustBitTorrent

A minimal BitTorrent client written in Rust. It reads a .torrent file, requests peers from its tracker, and downloads pieces over TCP.

Features

  • Bencode decoding for torrent metadata and tracker responses
  • Tracker announce and peer discovery
  • BitTorrent peer handshake and basic message handling
  • Piece selection, block requests, and SHA-1 piece verification
  • Concurrent peer handling, piece scheduling and shared download state
  • Asynchronous file storage

How it works

  1. Reads a torrent file path from the command line (defaults to the bundled sample torrent).
  2. Decodes the metadata and calculates the info hash and piece count.
  3. Announces to the tracker and parses the returned peer list.
  4. Connects to peers, completes the handshake, and requests blocks for available pieces.
  5. Verifies each complete piece against the torrent's SHA-1 hashes, then writes verified data at its file offset.

Run

cargo run -- path/to/file.torrent

Without a path, the client uses test_torrent_files/ContinuousTimeBayesianNetworkReasoningandLearningEngine.torrent.

Current Limitations

  1. Seeding is not implemented
  2. Resume support is not implemented
  3. Multi-file torrents are not currently supported