Re:Introduction to TCP and Sockets (2001)
by mr_toad on Wednesday July 20, 2022 @02:01AM
(#32162007)
https://en.wikipedia.org/wiki/UNIX_Network_Programming
Or maybe https://en.wikipedia.org/wiki/TCP/IP_Illustrated if you need to get down to the packet level.
This seems close to what you're asking for: https://github.com/smoltcp-rs/smoltcp
A small-ish tcp/ip stack, in rust, that can use TAP so you're down in the weeds making the packets.
Edit: perhaps not quite. Seems like this lives “on top of” TCP or UDP. I should probably read through this then look for something like a “how to implement ICMP” guide.