kevwan / tproxy
- среда, 20 июля 2022 г. в 00:37:32
A cli tool to proxy and analyze TCP connections.
English | 简体中文
When I develop backend services and write go-zero, I often need to monitor the network traffic. For example:
$ go install github.com/kevwan/tproxy@latest
Or use docker images:
$ docker run --rm -it -p <listen-port>:<listen-port> -p <remote-port>:<remote-port> kevinwan/tproxy:v1 tproxy -l 0.0.0.0 -p <listen-port> -r host.docker.internal:<remote-port>
For arm64:
$ docker run --rm -it -p <listen-port>:<listen-port> -p <remote-port>:<remote-port> kevinwan/tproxy:v1-arm64 tproxy -l 0.0.0.0 -p <listen-port> -r host.docker.internal:<remote-port>
$ tproxy --help
Usage of tproxy:
-d duration
the delay to relay packets
-l string
Local address to listen on (default "localhost")
-p int
Local port to listen on, default to pick a random port
-q Quiet mode, only prints connection open/close and stats, default false
-r string
Remote address (host:port) to connect
-s Enable statistics
-t string
The type of protocol, currently support grpc
$ tproxy -p 8088 -r localhost:8081 -t grpc -d 100ms
localhost:8081
$ tproxy -p 3307 -r localhost:3306
If you like or are using this project, please give it a star. Thanks!