You are browsing as a guest. Sign up (or log in) to start making projects!

Swarm

  • 1 Devlogs
  • 7 Total hours

A working Bittorrent client written in Rust

Ship #1

This one's swarm, a small BitTorrent client in Rust with no torrent libraries. I wanted to actually understand the protocol end to end.

What it does:
• parses .torrent files with its own bencode parser
• announces to the tracker over HTTP and reads the compact peer list
• speaks the peer wire protocol — handshake, bitfield, request/piece, over raw TCP
• pulls pieces block by block and verifies each against its SHA-1 before writing it to disk
• shows the swarm in a TUI: the piece grid filling in, per-peer have-bars, live speed

The SHA-1 is hand-rolled (it's what the spec uses for integrity), so the core has zero dependencies.

Hardest bit: the info-hash. You can't re-encode the parsed info dict and hash that key order/formatting can differ from the original because you have to SHA-1 the exact bytes as they sit in the file. Took me a while to spot why my hash didn't match.

  • 1 devlog
  • 7h
  • 7.11x multiplier
  • 53 Stardust
Try project → See source code →
Open comments for this post

7h 24m 14s logged

This one’s swarm, a small BitTorrent client in Rust with no torrent libraries. I wanted to actually understand the protocol end to end.

0
0
4

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…