Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/Distributed-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ In case if you are planning a large load testing, you may consider use separate
# This command will read multiple log files, replay them on 10x speed and loop them if needed for 30 seconds, and will distributed traffic (tcp session aware) among multiple workers
gor --input-file logs_from_multiple_machines.*|1000% --input-file-loop --exit-after 30s --recognize-tcp-sessions --split-output --output-tcp worker1.local --output-tcp worker2.local:27017 --output-tcp worker3.local:27017 ... --output-tcp workerN.local:27017

# worker
gor --input-tcp :27017 --ouput-http load_test.target
# worker
gor --input-tcp :27017 --output-http load_test.target
```
2 changes: 1 addition & 1 deletion docs/Request-rewriting.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ gor --input-raw :80 --output-http "http://staging.server" \
```

#### Host header
Host header gets special treatment. By default Host get set to the value specified in --output-http. If you manually set --http-set-header "Host: anonther.com", Gor will not override Host value.
Host header gets special treatment. By default Host get set to the value specified in --output-http. If you manually set --http-set-header "Host: another.com", Gor will not override Host value.

If you app accepts traffic from multiple domains, and you want to keep original headers, there is specific `--http-original-host` with tells Gor do not touch Host header at all.

Expand Down
2 changes: 1 addition & 1 deletion examples/middleware/token_modifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func process(buf []byte) {
// Token is inside response body
secureToken := proto.Body(payload)
originalTokens[reqID] = secureToken
Debug("Remember origial token:", string(secureToken))
Debug("Remember original token:", string(secureToken))
}
case '3': // Replayed response
if originalToken, ok := originalTokens[reqID]; ok {
Expand Down
2 changes: 1 addition & 1 deletion internal/capture/sock_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ func (sock *SockRaw) SetPromiscuous(b bool) error {
return unix.SetsockoptPacketMreq(sock.fd, unix.SOL_PACKET, opt, &mreq)
}

// Stats returns number of packets and dropped packets. This will be the number of packets/dropped packets since the last call to stats (not the cummulative sum!).
// Stats returns number of packets and dropped packets. This will be the number of packets/dropped packets since the last call to stats (not the cumulative sum!).
func (sock *SockRaw) Stats() (*unix.TpacketStats, error) {
sock.mu.Lock()
defer sock.mu.Unlock()
Expand Down
2 changes: 1 addition & 1 deletion internal/tcp/tcp_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func (parser *MessageParser) Fix100Continue(m *Message) {
p.Ack += 25
}

// If next section was aready approved and received, merge messages
// If next section was already approved and received, merge messages
if next, found := parser.m[m.packets[0].MessageID()]; found {
for _, p := range next.packets {
parser.addPacket(m, p)
Expand Down
2 changes: 1 addition & 1 deletion internal/tcp/tcp_packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const (
/*
Packet represent data and layers of packet.
parser extracts information from pcap Packet. functions of *Packet doesn't validate if packet is nil,
calllers must make sure that ParsePacket has'nt returned any error before calling any other
callers must make sure that ParsePacket hasn't returned any error before calling any other
function.
*/
type Packet struct {
Expand Down
2 changes: 1 addition & 1 deletion k8s/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ After following steps below, you will be able to capture traffic inside k8s like
gor --input-raw k8s://namespace/deployment/app:80 --output-http http://replay.com
```

GoReplay will running as a daemonset (e.g. on each phisical k8s node.
GoReplay will running as a daemonset (e.g. on each physical k8s node.
It will also require giving required permission to have read access to K8s APIs, so it can dynamically filter traffic for a specific pods.

Supported format for filtering required pods:
Expand Down
2 changes: 1 addition & 1 deletion kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type KafkaTLSConfig struct {
ClientKey string `json:"kafka-tls-client-key"`
}

// KafkaMessage should contains catched request information that should be
// KafkaMessage should contains caught request information that should be
// passed as Json to Apache Kafka.
type KafkaMessage struct {
ReqURL string `json:"Req_URL"`
Expand Down
10 changes: 5 additions & 5 deletions middleware/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# GoReplay middleware

GoReplay support protocol for writing middleware in any language, which allows you to implement custom logic like authentification or complex rewriting and filterting. See protocol description here: https://github.com/buger/goreplay/wiki/Middleware, but the basic idea that middleware process receive hex encoded data via STDIN and emits it back via STDOUT. STDERR for loggin inside middleware. Yes, that's simple.
GoReplay support protocol for writing middleware in any language, which allows you to implement custom logic like authentication or complex rewriting and filterting. See protocol description here: https://github.com/buger/goreplay/wiki/Middleware, but the basic idea that middleware process receive hex encoded data via STDIN and emits it back via STDOUT. STDERR for logging inside middleware. Yes, that's simple.

To simplify middleware creation we provide packages for NodeJS and Go (upcoming).

Expand All @@ -16,7 +16,7 @@ var gor = require("goreplay_middleware");
gor.init();
```

Basic idea is that you write callbacks which respond to `request`, `response`, `replay`, or `message` events, which contain request meta information and actuall http paylod. Depending on your needs you may compare, override or filter incoming requests and responses.
Basic idea is that you write callbacks which respond to `request`, `response`, `replay`, or `message` events, which contain request meta information and actual http paylod. Depending on your needs you may compare, override or filter incoming requests and responses.

You can respond to the incoming events using `on` function, by providing callbacks:
```javascript
Expand All @@ -33,7 +33,7 @@ gor.on('request', function(data) {
data.http

// Meta is an array size of 4, containing:
// 1. request type - 1, 2 or 3 (which maps to `request`, `respose` and `replay`)
// 1. request type - 1, 2 or 3 (which maps to `request`, `response` and `replay`)
// 2. uuid - request unique identifier. Request responses have the same ID as their request.
// 3. timestamp of when request was made (for responses it is time of request start too)
// 4. latency - time difference between request start and finish. For `request` is zero.
Expand All @@ -58,7 +58,7 @@ gor.on("request", function(req) {
if (gor.httpStatus(resp.http) != gor.httpStatus(repl.http)) {
// Note that STDERR is used for logging, and it actually will be send to `Gor` STDOUT.
// This trick is used because SDTIN and STDOUT already used for process communication.
// You can write logger that writes to files insead.
// You can write logger that writes to files instead.
console.error(`${gor.httpPath(req.http)} STATUS NOT MATCH: 'Expected ${gor.httpStatus(resp.http)}' got '${gor.httpStatus(repl.http)}'`)
}
return repl;
Expand Down Expand Up @@ -110,7 +110,7 @@ Package expose following functions to process raw HTTP payloads:
* `setHttpBody` - Set HTTP Body and ensures that `Content-Length` header have proper value. Returns modified payload: `req.http = gor.setHttpBody(req.http, Buffer.from('hello!'))`.
* `httpBodyParam` - get POST body param: `gor.httpBodyParam(req.http, param)`
* `setHttpBodyParam` - set POST body param: `req.http = gor.setHttpBodyParam(req.http, param, value)`
* `httpCookie` - get HTTP cookie: `gor.httpCookie(req.http, "SESSSION_ID")`
* `httpCookie` - get HTTP cookie: `gor.httpCookie(req.http, "SESSION_ID")`
* `setHttpCookie` - set HTTP cookie, returns modified payload: `req.http = gor.setHttpCookie(req.http, "iam", "cuckoo")`
* `deleteHttpCookie` - delete HTTP cookie, returns modified payload: `req.http = gor.deleteHttpCookie(req.http, "iam")`

Expand Down