{"id":13797469,"url":"https://github.com/0xekez/tcp-proxy","last_synced_at":"2025-12-30T01:22:26.868Z","repository":{"id":70998076,"uuid":"382210646","full_name":"0xekez/tcp-proxy","owner":"0xekez","description":"A TCP proxy in 30 lines of Rust.","archived":false,"fork":false,"pushed_at":"2021-07-12T16:24:06.000Z","size":7,"stargazers_count":49,"open_issues_count":1,"forks_count":9,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-19T03:14:19.335Z","etag":null,"topics":["network","proxy","rust","tcp"],"latest_commit_sha":null,"homepage":"https://zmedley.com/tcp-proxy.html","language":"Shell","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/0xekez.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}},"created_at":"2021-07-02T02:38:43.000Z","updated_at":"2024-03-27T13:09:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"0e16997c-ec43-4636-9fd9-827b766ca688","html_url":"https://github.com/0xekez/tcp-proxy","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/0xekez%2Ftcp-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xekez%2Ftcp-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xekez%2Ftcp-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xekez%2Ftcp-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xekez","download_url":"https://codeload.github.com/0xekez/tcp-proxy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213073352,"owners_count":15533578,"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":["network","proxy","rust","tcp"],"created_at":"2024-08-04T00:00:21.593Z","updated_at":"2025-12-30T01:22:26.842Z","avatar_url":"https://github.com/0xekez.png","language":"Shell","funding_links":[],"categories":["App","Shell"],"sub_categories":[],"readme":"# Proxy\n\nA simple Rust TCP proxy. Intended to be educational - [don't use this](https://github.com/tokio-rs/tokio/discussions/3173) in production.\n\n## Terminoligy\n\n`server` - the listener we'd like to proxy tcp connections to.\n`client` - the initiator of connections to the server.\n\n## Benchmarking\n\n### Using localhost:\n\n1. Start the proxy in one terminal window\n   ```bash\n   cargo run -- -c 0.0.0.0:1212 -s 127.0.0.1:1313\n   ```\n2. Listen on the origin port in another window\n   ```\n   nc -l 1313 \u003e /dev/null\n   ```\n3. Send a bunch of traffic from another window\n   ```\n   dd if=/dev/zero bs=1024 count=900000 | nc -v 127.0.0.1 1212\n   ```\n### Using network namespaces:\n\nIf you have a debian linux machine you can use `ns_test.sh` to run a\nbenchmark using three network namespaces.\n\n## Local Results\n\nUsing the proxy:\n\n```\n~ dd if=/dev/zero bs=1024 count=900000 | nc -v 127.0.0.1 1212\nConnection to 127.0.0.1 port 1212 [tcp/lupa] succeeded!\n900000+0 records in\n900000+0 records out\n921600000 bytes transferred in 4.369209 secs (210930626 bytes/sec)\n```\n\nConnecting directly to the server:\n\n```\n~ dd if=/dev/zero bs=1024 count=900000 | nc -v 127.0.0.1 1313\nConnection to 127.0.0.1 port 1313 [tcp/bmc_patroldb] succeeded!\n900000+0 records in\n900000+0 records out\n921600000 bytes transferred in 3.612901 secs (255085873 bytes/sec)\n```\n\nResults\n\n```elisp\n(* 100 (/ 210930626.0 255085873.0))\n=\u003e 82.69004610851186\n```\n\nThe tcp proxy is 82% the speed of a regular connection.\n\n## Network Namespace Results\n\nUsing the proxy:\n\n```\n921600000 bytes (922 MB, 879 MiB) copied, 25.4762 s, 36.2 MB/s\n```\n\nConnecting directly to the server:\n\n```\n921600000 bytes (922 MB, 879 MiB) copied, 5.17278 s, 178 MB/s\n```\n\nResults:\n\n```elisp\n(* 100 (/ 36.2 178))\n=\u003e 20.337078651685395\n```\n\nthe tcp proxy is 20% the speed of a regular connection.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xekez%2Ftcp-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xekez%2Ftcp-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xekez%2Ftcp-proxy/lists"}