{"id":13599884,"url":"https://github.com/ykskb/rust-user-net","last_synced_at":"2025-04-10T17:32:49.487Z","repository":{"id":118831259,"uuid":"523739853","full_name":"ykskb/rust-user-net","owner":"ykskb","description":"User-space network protocol stack written in Rust","archived":false,"fork":false,"pushed_at":"2022-11-21T11:01:21.000Z","size":5757,"stargazers_count":63,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-07T01:39:39.572Z","etag":null,"topics":["protocols","rust","tcp-ip"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ykskb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-08-11T13:46:22.000Z","updated_at":"2024-10-11T14:43:30.000Z","dependencies_parsed_at":"2024-01-14T04:45:02.149Z","dependency_job_id":"5df75c33-31f2-48cd-be6e-7d11af5658ab","html_url":"https://github.com/ykskb/rust-user-net","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ykskb%2Frust-user-net","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ykskb%2Frust-user-net/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ykskb%2Frust-user-net/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ykskb%2Frust-user-net/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ykskb","download_url":"https://codeload.github.com/ykskb/rust-user-net/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248261995,"owners_count":21074229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["protocols","rust","tcp-ip"],"created_at":"2024-08-01T17:01:15.809Z","updated_at":"2025-04-10T17:32:48.855Z","avatar_url":"https://github.com/ykskb.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# rust-user-net\n\nUser-space network protocol stack written in Rust for study / experiment purpose\n\nTalks Ethernet / ARP / IP / ICMP / UDP / TCP through TAP device on Linux.\n\n\u003cimg src=\"./docs/images/google-example.gif\" width=\"600px\" /\u003e\n\nThis project is by and large a Rust port of [microps](https://github.com/pandax381/microps) project written in C. Many thanks to [the owner](https://github.com/pandax381) for awesome codes and shared [decks](https://drive.google.com/drive/folders/1k2vymbC3vUk5CTJbay4LLEdZ9HemIpZe?usp=share_link) (Japanese).\n\n### High-level View\n\n\u003cimg src=\"./docs/images/overview.png\" width=\"400px\" /\u003e\n\n### Setup and Usage\n\n- Built and tested on Ubuntu 22.04\n\n```sh\ncd rust-user-net\n\n# Build\ncargo build\n\n# TAP device setup (will be reset on reboot)\n./set_tap.sh\n\n# If you want rust-user-net to connect to Internet:\n# Output interface name is assumed to be `wlp0s20f3`.\n# Please update it if it's different in your machine.\n./set_forward.sh\n\n# Show help\n./rust-user-net -h\n./rust-user-net tcp -h\n./rust-user-net tcp send -h\n```\n\n### Example\n\nHTTP (TCP: 80) request to `http://www.google.com`:\n\n```sh\n# Send command sends a request and gets into receive loop\nrust-user-net tcp send 142.250.4.138 80 'GET / HTTP/1.1\\r\\nHost: www.google.com\\r\\n\\r\\n'\n```\n\n### Local Tests with netcat\n\n```sh\n# TCP\n\n# Test send command:\n# nc listens for TCP active open (3-way handshake) from rust-user-net\nnc -nv -l 10007\nrust-user-net tcp send 192.0.2.1 10007 \"TCP TEST DATA\"\n\n# Test receive command:\n# nc connects and sends data to rust-user-net (192.0.2.2:7) \nrust-user-net tcp receive 0.0.0.0 7\nnc -nv 192.0.2.2 7 # -n: no name resolution\n\n# UDP\n\n# Test send command:\n# nc listens for UDP data from rust-user-net\nnc -u -l 10007\nrust-user-net udp send 192.0.2.1 10007 \"UDP TEST DATA\"\n\n# Test receive command:\n# nc sends UDP data to rust-user-net (192.0.2.2:7)\nrust-user-net udp receive 0.0.0.0 7\nnc -u 192.0.2.2 7 # -u: UDP mode\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fykskb%2Frust-user-net","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fykskb%2Frust-user-net","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fykskb%2Frust-user-net/lists"}