Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kevwan/tproxy
A cli tool to proxy and analyze TCP connections.
https://github.com/kevwan/tproxy
charles connection grpc monitoring-tool proxy relay tcp tcpdump wireshark
Last synced: 17 days ago
JSON representation
A cli tool to proxy and analyze TCP connections.
- Host: GitHub
- URL: https://github.com/kevwan/tproxy
- Owner: kevwan
- License: mit
- Created: 2022-06-14T01:21:58.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-15T09:23:12.000Z (2 months ago)
- Last Synced: 2024-04-17T14:28:17.599Z (about 2 months ago)
- Topics: charles, connection, grpc, monitoring-tool, proxy, relay, tcp, tcpdump, wireshark
- Language: Go
- Homepage: https://go-zero.dev
- Size: 1.64 MB
- Stars: 3,154
- Watchers: 30
- Forks: 223
- Open Issues: 3
-
Metadata Files:
- Readme: readme-cn.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Lists
- my-awesome-stars - kevwan/tproxy - A cli tool to proxy and analyze TCP connections. (Go)
- awesome-stars - kevwan/tproxy - A cli tool to proxy and analyze TCP connections. (Go)
- my-awesome-stars - kevwan/tproxy - A cli tool to proxy and analyze TCP connections. (Go)
- awesome-stars - kevwan/tproxy
- awesome-repositories - kevwan/tproxy - A cli tool to proxy and analyze TCP connections. (Go)
- awesome-repositories - kevwan/tproxy - A cli tool to proxy and analyze TCP connections. (Go)
- awesome-stars - kevwan/tproxy - A cli tool to proxy and analyze TCP connections. (Go)
- awesome-stars - kevwan/tproxy - A cli tool to proxy and analyze TCP connections. (Go)
- awesome-stars - kevwan/tproxy - A cli tool to proxy and analyze TCP connections. (Go)
- cli-apps - tproxy - A CLI tool to proxy and analyze TCP connections. (<a name="networking"></a>Networking)
- awesome-stars - kevwan/tproxy - `★3178` A cli tool to proxy and analyze TCP connections. (Go)
- awesome-cli-apps - tproxy - A CLI tool to proxy and analyze TCP connections. (<a name="networking"></a>Networking)
README
# tproxy
[English](readme.md) | 简体中文
[![Go](https://github.com/kevwan/tproxy/workflows/Go/badge.svg?branch=main)](https://github.com/kevwan/tproxy/actions)
[![Go Report Card](https://goreportcard.com/badge/github.com/kevwan/tproxy)](https://goreportcard.com/report/github.com/kevwan/tproxy)
[![Release](https://img.shields.io/github/v/release/kevwan/tproxy.svg?style=flat-square)](https://github.com/kevwan/tproxy)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)## 为啥写这个工具
当我在做后端开发或者写 [go-zero](https://github.com/zeromicro/go-zero) 的时候,经常会需要监控网络连接,分析请求内容。比如:
1. 分析 gRPC 连接何时连接、何时重连
2. 分析 MySQL 连接池,当前多少连接,连接的生命周期是什么策略
3. 也可以用来观察和分析任何 TCP 连接## 安装
```shell
$ GOPROXY=https://goproxy.cn/,direct go install github.com/kevwan/tproxy@latest
```或者使用 docker 镜像:
```shell
$ docker run --rm -it -p : -p : kevinwan/tproxy:v1 tproxy -l 0.0.0.0 -p -r host.docker.internal:
```arm64 系统:
```shell
$ docker run --rm -it -p : -p : kevinwan/tproxy:v1-arm64 tproxy -l 0.0.0.0 -p -r host.docker.internal:
```Windows:
```shell
$ scoop install tproxy
```## 用法
```shell
$ tproxy --help
Usage of tproxy:
-d duration
the delay to relay packets
-down int
Downward speed limit(bytes/second)
-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 http2, grpc, redis and mongodb
-up int
Upward speed limit(bytes/second)
```## 示例
### 分析 gRPC 连接
```shell
$ tproxy -p 8088 -r localhost:8081 -t grpc -d 100ms
```- 侦听在 localhost 和 8088 端口
- 重定向请求到 `localhost:8081`
- 识别数据包格式为 gRPC
- 数据包延迟100毫秒
### 分析 MySQL 连接
```shell
$ tproxy -p 3307 -r localhost:3306
```
### 查看网络状况(重传率和RTT)
```shell
$ tproxy -p 3307 -r remotehost:3306 -s -q
```
### 查看连接池(总连接数、最大并发连接数、最长生命周期等)
```shell
$ tproxy -p 3307 -r :3306 -s -q
```
## 欢迎 star!⭐
如果你正在使用或者觉得这个项目对你有帮助,请 **star** 支持,感谢!