Implementing (part of) a BitTorrent client in Rust

Implementing (part of) a BitTorrent client in Rust

100.824 Lượt nghe
Implementing (part of) a BitTorrent client in Rust
In this stream, we're doing the "implement BitTorrent" challenge from https://app.codecrafters.io/join/bittorrent?via=jonhoo in Rust. Essentially, we're implementing a BitTorrent client from scratch by following a test-guided set of steps. This is a way of learning I really like (and encourage others to try), and after this stream I'm comfortable saying that this is also a good _implementation_ of that learning mechanism — props to CodeCrafters! It's worth noting that this is not a sponsored stream, at least not directly. I got no money to make it. CodeCrafters reached out to me after the fly.io distributed systems challenges video (https://youtu.be/gboGyccRVXI) and suggested I might be interested in trying their thing and, crucially, giving my honest opinion of what they'd built. Since I deeply believe in this learning path, and want to help those enabling it, I took them up on it! I _do_ get a referral bonus for those who choose to sign up for this through the link above after watching the video (so please use it if you do decide to sign up), but hopefully that's an informed choice after watching this :p And you can of course always just stick to their free challenges! The BitTorrent challenge is also available openly here: https://github.com/codecrafters-io/build-your-own-bittorrent Also, I managed to fix the code for the "download a piece" bit at the end, and it was indeed mostly a (set of) off-by-one errors. You can see the final changes here: https://github.com/jonhoo/codecrafters-bittorrent-rust/compare/f71ed3d223acbceaa42fea220f774f9aba8f56c9...HEAD 0:00:00 Introduction 0:03:15 Project setup 0:04:33 Decode bencoded strings 0:10:58 Decode bencoded integers 0:18:28 Decode bencoded lists 0:36:39 Decode bencoded dictionaries 0:40:42 Parse torrent file 1:24:24 Calculate info hash 1:38:55 Piece hashes 1:41:35 Discover peers 2:35:13 Peer handshake 2:52:55 Download a piece 4:07:05 Concluding thoughts Live version with chat: https://youtube.com/live/fhEHBQog-Cc?feature=share