tproxy

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2022 License: MIT Imports: 8 Imported by: 0

README

tproxy

English | 简体中文

Go codecov Go Report Card Release

Why I wrote this tool

When I develop backend services and write go-zero, I often need to monitor the network traffic. For example:

  1. monitoring gRPC connections, when to connect and when to reconnect
  2. monitoring MySQL connection pools, how many connections and figure out the lifetime policy
  3. monitoring any TCP connections on the fly

Installation

$ 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>

Usages

$ tproxy --help
Usage of tproxy:
  -l string
        Local address to listen on (default "localhost")
  -p int
        Local port to listen on
  -r string
        Remote address (host:port) to connect
  -silent
        Only prints connection open/close and stats, default false
  -t string
        the type of protocol, currently support grpc

Examples

Monitor gRPC connections
tproxy -p 8088 -r localhost:8081 -t grpc
  • listen on localhost and port 8088
  • redirect the traffic to localhost:8081
  • protocol type to be gRPC

grpc

Monitor MySQL connections
tproxy -p 3307 -r localhost:3306

mysql

Give a Star! ⭐

If you like or are using this project to learn or start your solution, please give it a star. Thanks!

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL