基本介绍
Gor 是一款go语言实现的简单的http流量复制工具,它的主要目的是使你的生产环境HTTP真实流量在开发环境和语言预演环境(staging server)重现。
工具使用非常简单,只需要下载一个gor文件即可,并同时支持linux、mac、windows版本。下面是它的工作的流程,监听服务器捕捉http流量,把捕捉到的流量发送到重现服务器上或者保存到文件中,重现服务器再继续把流量发送到一个指定的ip地址。
用法简介
简单的 HTTP 流量复制:
gor –input-raw :80 –output-http “http://staging.com”
HTTP流量复制频率控制:
gor –input-tcp :28020 –output-http “http://staging.com|10″
HTTP流量复制缩小:
gor –input-raw :80 –output-tcp “replay.local:28020|10%”
HTTP流量记录到本地文件:
gor –input-raw :80 –output-file requests.gor
HTTP流量回放和压测:
gor –input-file “requests.gor|200%” –output-http “staging.com”
HTTP流量过滤复制:
gor –input-raw :8080 –output-http staging.com –output-http-url-regexp ^www.
注入改变请求流量header
gor –input-raw :80 –output-http “http://staging.server” –output-http-header “User-Agent: Replayed by Gor” –output-http-header “Enable-Feature-X: true”
可以通过gor –help查看更多用法
相关链接
官方网站
http://leonsbox.com/blog/2013/06/04/improving-testing-by-using-real-traffic-from-production/
下载地址
https://pan.baidu.com/s/1jInUaCe
https://github.com/buger/gor/releases
开源地址
其他资源
https://github.com/doubaokun/node-ab
https://github.com/session-replay-tools/tcpcopy
https://github.com/httperf/httperf
https://github.com/buger/gor/blob/master/ELASTICSEARCH.md