finds.dev← search

// the find

jonhoo/rust-tcp

★ 562 · Rust · updated Jun 2024

A learning experience in implementing TCP in Rust

A from-scratch, in-progress TCP implementation in Rust, built live on jonhoo's YouTube streams as a way to learn both the protocol and the language at the same time. It's for developers who want to see what TCP actually looks like under the hood — state machine, sequence numbers, retransmission — rather than use another networking library.

The whole thing lives in three small files (tcp.rs, lib.rs, main.rs), so you can read the entire TCP state machine in one sitting instead of hunting through a large codebase. It's paired with hours of recorded video walking through the exact design decisions, which is rare — most 'toy implementations' give you the code with none of the reasoning. Working directly against a TUN device means you're seeing real packets from a real kernel, not a simulated harness.

This is explicitly a learning project, not a library — no crates.io publish, no semver, no guarantee the API is stable or even that edge cases of the TCP spec are handled correctly. Last push was mid-2024 and the project reads as paused rather than finished, so don't expect gaps (congestion control, proper RTT estimation) to get filled in. No tests in the tree, which is a real gap for something implementing a stateful protocol where off-by-one sequence number bugs are exactly the kind of thing you want regression coverage for.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →