httpmon HTTP 流量命令行工具

看清一条命令收发的 HTTP 流量

把 httpmon 放在 curl 这类命令前面,就能看到它的 HTTP 流量;存进会话,之后还能查询、对比或重放。

httpmon v4.1.0 · 实际输出 已捕获
$ httpmon curl -sS https://proxy.golang.org/github.com/hxddh/https-traffic-inspector/@v/list
REQUEST #1 GET https://proxy.golang.org:443/github.com/hxddh/https-traffic-inspector/@v/list

Host: proxy.golang.org · Accept: */* · User-Agent: curl/8.7.1

RESPONSE #1 HTTP/2.0 200 OK (1.144s)

Content-Type: text/plain; charset=UTF-8 · Content-Length: 91

v1.3.0 v1.0.2 v1.0.0 v1.1.1 v1.4.1 …
HTTPS 只在本地解密查看原始响应流继续交给命令

记录、对比和重放

开始使用

go install 需要 Go 1.26+。Windows 用 install.ps1,或从 GitHub Releases 下载二进制文件。

  1. 安装(Linux、macOS)

    curl -fsSL https://github.com/hxddh/https-traffic-inspector/releases/latest/download/install.sh | sh
  2. 或用 Go 安装

    go install github.com/hxddh/https-traffic-inspector/v5/cmd/httpmon@latest
  3. 包住一条命令,看它的流量

    httpmon curl https://api.github.com/users/octocat

常见问题

能包住哪些命令?

支持代理的命令都可以,比如 curl、aws、Python、Node、Java、git、cargo 和 Deno。

  • 只有这个子进程拿到代理地址和 CA,系统设置保持不变。
  • Go 程序访问本机回环地址时不走代理。
  • httpmon 启动前就在运行的 JVM(比如 Gradle 守护进程)不会被配置。
它还会校验证书吗?

会。httpmon 终止了 TLS,所以由它代替命令校验服务器的真实证书;校验失败返回 502,错误类型为 tls_verify。--insecure-upstream 会关掉这项校验,只在你自己管理的主机上用。

它能诊断存储故障吗?

不能。httpmon 只展示流量,判断交给你。想在开源终端编码 Agent Pi 里诊断 S3 兼容存储的故障,请用 StorageOps,它会经 httpmon 采集 trace。 打开 StorageOps