一个尽量只依赖 Go 标准库的 HTTP 延迟测速工具,支持把 target、Host、SNI 分开控制,适合 CDN / 代理 / 回源链路探测。
- 默认
simple文本输出 - 支持
-f,--format切换simple/json - 支持
target作为 flag 或位置参数,参数可写在前后任意位置 - 支持独立配置
-host和-sni - 支持
-notls关闭 TLS,支持-insecure跳过证书校验 - 支持
-n多次测速、-i/--interval发起间隔 - 负间隔(如
--interval=-1ms)进入严格串行模式 - 支持 warm up(
-warmup/-warmup-count)
go build -o httpping ../httpping https://1.2.3.4/
./httpping -host cdn.example.com https://1.2.3.4/
./httpping -host cdn.example.com -sni tls.example.com https://1.2.3.4/
./httpping -n 5 -i 200ms https://1.2.3.4/
./httpping -n 5 --interval=-1ms https://1.2.3.4/
./httpping -warmup-count 2 -n 5 https://1.2.3.4/
./httpping -insecure https://1.2.3.4/
./httpping -notls https://1.2.3.4/
./httpping -f json https://1.2.3.4/位置参数与 flag 可混用:
./httpping https://1.2.3.4/ -host cdn.example.com -n 3-target:目标地址,支持http:///https://;省略 scheme 时默认https://-host:HTTP Host 头-sni:TLS SNI-f,--format:输出格式,simple或json(默认simple)-insecure:使用 TLS 但跳过证书校验-notls:强制使用明文 HTTP-n:正式测速次数,默认1-i,--interval:发起间隔,默认1s;负值表示严格串行-warmup:开启 warm up,默认 1 次-warmup-count:指定 warm up 次数(>0会隐式开启 warm up)-timeout:单次请求超时,默认10s
输出人类可读文本:配置、每次测量、汇总统计(first byte / total 的 avg/min/max)。
仅输出 JSON(不会混入文本日志),适合给其他程序调用。主要结构:
config:本次测速配置(目标、Host/SNI、TLS 模式、次数、间隔、超时)attempts:每次测量结果(状态码、响应体大小、各阶段耗时)summary:first_byte和total的avg_ns/min_ns/max_ns
示例:
./httpping -f json -n 2 https://1.2.3.4/./httpping -h