{"id":20206585,"url":"https://github.com/shresth72/tcp_rust","last_synced_at":"2026-04-18T10:36:00.077Z","repository":{"id":236977583,"uuid":"793548157","full_name":"Shresth72/TCP_rust","owner":"Shresth72","description":"Tcp Implementation in rust | RFC 793 | IPv4 | \"a lot of TODOs left\"","archived":false,"fork":false,"pushed_at":"2024-05-17T12:12:25.000Z","size":85,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-26T16:06:29.150Z","etag":null,"topics":["bash","ipv4","rust","tcp","tun-tap"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Shresth72.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-29T12:34:27.000Z","updated_at":"2024-05-17T12:12:28.000Z","dependencies_parsed_at":"2024-05-17T11:36:40.282Z","dependency_job_id":"13ede563-02c5-4a1d-9ea9-05c5d4f919df","html_url":"https://github.com/Shresth72/TCP_rust","commit_stats":null,"previous_names":["shresth72/tcp_rust"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Shresth72/TCP_rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shresth72%2FTCP_rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shresth72%2FTCP_rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shresth72%2FTCP_rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shresth72%2FTCP_rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shresth72","download_url":"https://codeload.github.com/Shresth72/TCP_rust/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shresth72%2FTCP_rust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31966187,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","ipv4","rust","tcp","tun-tap"],"created_at":"2024-11-14T05:25:01.373Z","updated_at":"2026-04-18T10:36:00.052Z","avatar_url":"https://github.com/Shresth72.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TCP Implementation in Rust\n\n## 1. Core Functionality\n\n### RFC 793: \"Transmission Control Protocol\"\n\n\u003e Usually, the user space sends network requests to the Kernel using sockets and has a pointer to the kernel memory (that represents the TCP connection) inside the Kernel. Then, the Kernel already knows how to deliver packets to the internet.\n\n\u003e However, using Sockets for implementing our own TCP might cause conflicts as Kernel already implements it's own TCP to talk to the internet.\n\n#### 1. Emulate network inside the user's space using a TUN device\n\n- Hence, using a Linux feature called TUN/TAP provides packet reception and transmission for user space program. Instead of receiving and writing packets from a physical media, it receives them from user space program and writes them to the user program respectively.\n- In this, Kernel creates a virtual space for us. So, Kernel treats the TUN interface as it's own network interface. So, any send the Kernel does turns into a receive for the user program and any write by the user program goes through the TUN, and appear to the kernel as a network IP packet.\n- TUN has it's own IP Protocol and network metadata.\n\n#### 2. Receiving and Parsing TCP Packet Header (SYN)\n\nTCP Packet Frame Format :\n\n- **Flags [2 bytes]**\n- **Proto [2 bytes]**\n  - 0x086dd Ethernet Type for IPv6 \u003cbr/\u003e\n  - 0x0800 ICMP - Protocol 1 (Ping) \u003cbr/\u003e\n  - TCP - Protocol 6 \u003cbr/\u003e\n- **Raw Protocol(IP, IPv6, etc) frame**\n\nReceiving these packets with their headers parsed performs the `SYN` action of the TCP Protocol\n\n#### n. Three Way Handshake for Connection Synchronization\n\n### RFC 1122: \"Requirements for Hosts - Communication Layers\"\n\n-\n\n### RFC 2873: \"TCP Processing of the IPv4 Precedence Field\"\n\n-\n\n### RFC 5681: \"TCP Congestion Control\"\n\n-\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshresth72%2Ftcp_rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshresth72%2Ftcp_rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshresth72%2Ftcp_rust/lists"}