tcp-proxy
Forward TCP requests hitting a specified port on the localhost to a different port on another host
Both IPv4 and IPv6 are supported. On Linux splice is used to improve perf, details can be found here.
USAGE:
./zig-out/bin/tcp-proxy [OPTIONS]
OPTIONS:
-b, --bind_host STRING Local bind host(default: 0.0.0.0)
-p, --local_port INTEGER Local bind port(default: 8081)
-H, --remote_host STRING Remote host(required)
-P, --remote_port INTEGER Remote port(required)
--buf_size INTEGER Buffer size for tcp read/write(default: 16384)
--server_threads INTEGER Server worker threads num(default: 24)
-h, --help
-v, --version
--verbose
| |
This will forward tcp requests from localhost:8082 to 192.168.0.2:8082
Benchmark
iPerf3 is used to benchmark performance between zigcli and this, a proxy written in C.
All in one
- server/client/proxy
192.168.31.142, debian 12
| sender | receiver | |
|---|---|---|
| zigcli | 57.2 | 56.9 |
| proxy in C | 56.1 | 55.9 |
- Unit: Gbits/sec
Server/client separated
- server
- 192.168.31.94, macOS
- proxy/client
- 192.168.31.142, debian 12
| sender | receiver | |
|---|---|---|
| zigcli | 191 | 180 |
| proxy in C | 210 | 198 |
- Unit: Mbits/sec
Commands
| |