This project is a minimal, custom implementation of the Transmission Control Protocol (TCP), as defined in RFC 793, operating entirely in userspace. It leverages a TUN virtual network device to process IPv4 and IPv6 packets. The purpose of this project is purely for self-education.
The run.sh
script executes the binary with sudo
to create a TUN device (see device.rs
), which requires root privileges
due to its interaction with the network stack.
./scripts/run.sh
Capture and inspect TCP packets on the tun0
interface using tcpdump
:
sudo tcpdump -i tun0 tcp -n
Use netcat
to establish a TCP connection to the server. The host portions and ports are
up to you:
nc -N 10.0.0.10 8080
or/both(as the program spawns 2 listeners):
nc -N fd00:dead:beef::10 8081
- Portions of the connection management logic are inspired by Jon Gjengset’s TCP implementation.
- Socket API design influenced by Rust's
std::net
module.