Records found: 17 # 请求总数据量 Malformed records: <nil> # 不符合标准的请求数量,nil表示没有 Files processed: 1 Bytes processed: 7564 # 大小 Max wait: 6.024768111s # 请求间最大等待时间 Min wait: 4.197µs # 请求间最小等待时间 First wait: 118.78604ms # 第一次请求的间隔 It will take `18.078520319s` to replay at current speed.
回放状态
1
--stats --output-http-stats
转发其它地址
--http-rewrite-url expects value in “:” format: “:” is a dilimiter. In `` section you may use captured regexp group values. This works similar to replace method in Javascript or gsub in Ruby.
1 2
# Rewrites all `/v1/user/<user_id>/ping` requests to `/v2/user/<user_id>/ping` gor --input-raw :8080 --output-http staging.com --http-rewrite-url /v1/user/([^\\/]+)/ping:/v2/user/$1/ping
过滤URL
Allow url regexp
1 2
# only forward requests being sent to the /api endpoint gor --input-raw :8080 --output-http staging.com --http-allow-url /api
Disallow url regexp
1 2
# only forward requests NOT being sent to the /api... endpoint gor --input-raw :8080 --output-http staging.com --http-disallow-url /api
Filter based on regexp of header
1 2 3 4 5
# only forward requests with an api version of 1.0x gor --input-raw :8080 --output-http staging.com --http-allow-header api-version:^1\.0\d
# only forward requests NOT containing User-Agent header value "Replayed by Gor" gor --input-raw :8080 --output-http staging.com --http-disallow-header "User-Agent: Replayed by Gor"
Filter based on HTTP method
Requests not matching a specified whitelist can be filtered out. For example to strip non-nullipotent requests:
1 2 3
gor --input-raw :80 --output-http "http://staging.server" \ --http-allow-method GET \ --http-allow-method OPTIONS
下载
1 2 3 4
mkdir goreplay && cd goreplay
wget https://github.com/buger/goreplay/releases/download/1.3.3/gor_1.3.3_x64.tar.gz tar -zxf gor_1.3.3_x64.tar.gz