{"id":13599937,"url":"https://github.com/teru01/toytcp","last_synced_at":"2026-01-17T04:03:48.210Z","repository":{"id":46235288,"uuid":"322473638","full_name":"teru01/toytcp","owner":"teru01","description":"Toy TCP implementation with Rust （技術書典10「Rustで始めるTCP自作入門」ソースコード）","archived":false,"fork":false,"pushed_at":"2020-12-27T14:27:14.000Z","size":7373,"stargazers_count":98,"open_issues_count":0,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-02T17:40:00.054Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/teru01.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}},"created_at":"2020-12-18T03:04:26.000Z","updated_at":"2024-08-01T09:27:52.000Z","dependencies_parsed_at":"2022-09-14T21:41:09.055Z","dependency_job_id":null,"html_url":"https://github.com/teru01/toytcp","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/teru01%2Ftoytcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teru01%2Ftoytcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teru01%2Ftoytcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teru01%2Ftoytcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teru01","download_url":"https://codeload.github.com/teru01/toytcp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223442770,"owners_count":17145831,"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":[],"created_at":"2024-08-01T17:01:20.085Z","updated_at":"2026-01-17T04:03:48.186Z","avatar_url":"https://github.com/teru01.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# toytcp\n\ntoy tcp implementation\n\n# setup\n\n```\n$ cd toytcp\n$ chmod +x setup.sh\n$ ./setup.sh\n```\n\nThe following virtual network environment will be created. Only Linux is supported for now.\n\n![](./network.png)\n\nIn order to avoid conflicts with the kernel's protocol stack, all packets with the RST flag are set to be discarded by iptables.\n\n\n# build \u0026 run \n\n```\n$ cargo build --examples\n```\n\n## echo-server \u0026 client\n\nserver\n```\n$ sudo ip netns exec host1 ./target/debug/examples/echoserver 10.0.0.1 30000\n```\n\nclient\n```\n$ sudo ip netns exec host2 sudo ./target/debug/examples/echoclient 10.0.0.1 30000\n```\n\n## file upload\n\nserver\n```\n$ sudo ip netns exec host2 ./target/debug/examples/fileserver 10.0.1.1 40000 \u003csave file name\u003e\n```\n\nclient\n```\n$ sudo ip netns exec host1 ./target/debug/examples/fileclient 10.0.1.1 40000 sample.jpg\n```\n\n## simulate packet loss\n\n### Discard 0.1% of packets\n\n```\n$ sudo ip netns exec router tc qdisc add dev router-veth2 root netem loss 0.1%\n```\n\nRemember to turn off the settings when you're done experimenting.\n\n```\nsudo ip netns exec host2 tc qdisc del dev host2-veth1 root\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteru01%2Ftoytcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteru01%2Ftoytcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteru01%2Ftoytcp/lists"}