Skip to content
0:00 / 0:00

#bittorrent#codecrafters#tokio

Implementing (part of) a BitTorrent client in Rust

Jon Gjengset

111K subscribers • 7 videos on Hallway

YouTube

Advanced. Deep dive for people who know the field.

115K views3 years ago2 recommendations

Programming languagesSystems programmingRustNetworking and protocolsConcurrency and parallelism

Jon Gjengset builds a BitTorrent client from scratch in Rust, demonstrating network programming, parsing, and idiomatic error handling.

In this stream, we're doing the "implement BitTorrent" challenge from 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 (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: 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: github.com/jonhoo/codecrafters-bittorrent-rust/compare/f71ed… Introduction Project setup Decode bencoded strings Decode bencoded integers Decode bencoded lists Decode bencoded dictionaries Parse torrent file Calculate info hash Piece hashes Discover peers Peer handshake Download a piece Concluding thoughts Live version with chat: youtube.com/live/fhEHBQog-Cc?feature=share

Why it's here

2 people recommend this

What people say. Recommended as an excellent, comprehensive live-coding stream for learning Rust and network protocol implementation.

sarupbanskotaon Hacker News • Recommends

On “Show HN: I built a guided Build your own DNS Server challenge”

(CodeCrafters team here). Out of curiosity, is there a reason why you prefer video format vs. interactive? e.g out of habit, when I'm having a meal, I like watching "course videos" or streams occasionally. Is yours similar? P.S. Jon Gjengset did a comprehensive stream going through the Build your own BitTorrent challenge link to this video , if you're interested in Rust

joshkaon Hacker News • Recommends

On “Show HN: Rqbit – bittorent CLI and desktop app written in Rust”

Take a watch of Jon Gjengset's vids on this (there's a codecrafters challenge for building out a bittorent protocol that he's going through). - link to this video - link

Jonhooon Hacker News • Mentions

On “Build Your Own BitTorrent”

Oh hey, that's me! A better link is link to this video which has chapter marks and has the power outage in the middle spliced away :p

zoogenyon Hacker News • Mentions

On “"Useless Ruby sugar": Pattern matching (Pt. 1)”

…be ideal in Go. I often end up with the classic pattern: if value, err := someFunc(); !err { // value is useable } // handle err And I would just really, really like if Go would let me: if value, err := someFunc(); err != nil { // handle err } // value is useable But, I suppose due to Go block scoping `value` is only valid within the if block. 1. link to this video…

methouon Hacker News • Mentions

On “CodeCrafters CEO adds his paid service as a next step after finishing Rustlings”

…t "Post a file", lack of beefy & fun stuff like for example HTTP 1.1 Pipelining I believe the value (the fun) it would provide me would be about the same level of Ace Combat 7 (I paid ~40$US), and the complexity is less than Bauder's Gate(69$SG). I would pay roughly US$40 for all of the content altogether at this moment. edit: added a link -- 0: link to this video…