Categorygithub.com/buger/goreplay
modulepackage
2.0.0-rc2+incompatible
Repository: https://github.com/buger/goreplay.git
Documentation: pkg.go.dev

# README

GitHub release codebeat Go Report Card Join the chat at https://gitter.im/buger/gor Reviewed by Hound

Go Replay

https://goreplay.org/

GoReplay is an open-source network monitoring tool which can record your live traffic, and use it for shadowing, load testing, monitoring and detailed analysis.

About

As your application grows, the effort required to test it also grows exponentially. GoReplay offers you the simple idea of reusing your existing traffic for testing, which makes it incredibly powerful. Our state of art technique allows you to analyze and record your application traffic without affecting it. This eliminates the risks that come with putting a third party component in the critical path.

GoReplay increases your confidence in code deployments, configuration and infrastructure changes.

GoReplay offers unique approach for shadowing. Instead of being a proxy, GoReplay in background listen for traffic on your network interface, requiring no changes in your production infrastructure, rather then running GoReplay daemon on the same machine as your service.

Diagram

Check latest documentation.

Installation

Download latest binary from https://github.com/buger/goreplay/releases or compile by yourself.

Getting started

The most basic setup will be sudo ./gor --input-raw :8000 --output-stdout which acts like tcpdump. If you already have test environment you can start replaying: sudo ./gor --input-raw :8000 --output-http http://staging.env.

See the our documentation and Getting started page for more info.

Newsletter

Subscribe to our newsletter to stay informed about the latest features and changes to Gor project.

Want to Upgrade?

We have created a GoReplay PRO extension which provides additional features such as support for binary protocols like Thrift or ProtocolBuffers, saving and replaying from cloud storage, TCP sessions replication, etc. The PRO version also includes a commercial-friendly license, dedicated support, and it also allows you to support high-quality open source development.

Problems?

If you have a problem, please review the FAQ and Troubleshooting wiki pages. Searching the issues for your problem is also a good idea.

All bug-reports and suggestions should go through Github Issues or our Google Group (you can just send email to [email protected]). If you have a private question feel free to send email to [email protected].

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Companies using Gor

  • GOV.UK - UK Government Digital Service
  • theguardian.com - Most popular online newspaper in the UK
  • TomTom - Global leader in navigation, traffic and map products, GPS Sport Watches and fleet management solutions.
  • 3SCALE - API infrastructure to manage your APIs for internal or external users
  • Optionlab - Optimize customer experience and drive engagement across multiple channels
  • TubeMogul - Software for Brand Advertising
  • Videology - Video advertising platform
  • ForeksMobile - One of the leading financial application development company in Turkey
  • Granify - AI backed SaaS solution that enables online retailers to maximise their sales
  • And many more!

If you are using Gor, we are happy to add you to the list and share your story, just write to: [email protected]

Author

Leonid Bugaev, @buger, https://leonsbox.com

# Packages

Package byteutils provides helpers for working with byte slices.
Package capture provides traffic sniffier using AF_PACKET, pcap or pcap file.
Package proto provides byte-level interaction with HTTP request payload.
Package tcp implements TCP transport layer protocol, it is responsible for parsing, reassembling tcp packets, handling communication with engine listeners(github.com/buger/goreplay/capture), and reporting errors and statistics of packets.

# Functions

CopyMulty copies from 1 reader to multiple writers.
Debug take an effect only if --verbose greater than 0 is specified.
NewBinaryOutput constructor for BinaryOutput Initialize workers.
NewDummyInput constructor for DummyInput.
NewDummyOutput constructor for DummyOutput.
NewEmitter creates and initializes new Emitter object.
NewFileInput constructor for FileInput.
NewFileOutput constructor for FileOutput, accepts path.
NewHTTPClient returns new http client with check redirects policy.
NewHTTPInput constructor for HTTPInput.
NewHTTPOutput constructor for HTTPOutput Initialize workers.
NewKafkaConfig returns Kafka config with or without TLS.
NewKafkaInput creates instance of kafka consumer client with TLS config.
NewKafkaOutput creates instance of kafka producer client with TLS config.
NewLimiter constructor for Limiter, accepts plugin and options `options` allow to sprcify relatve or absolute limiting.
NewMiddleware returns new middleware.
NewNullOutput constructor for NullOutput.
NewPlugins specify and initialize all available plugins.
NewRAWInput constructor for RAWInput.
NewS3Output constructor for FileOutput, accepts path.
NewS3ReadCloser returns new instance of S3 read closer.
NewTCPClient returns new TCPClient.
NewTCPInput constructor for TCPInput, accepts address with port.
NewTCPOutput constructor for TCPOutput Initialize X workers which hold keep-alive connection.
NewTestInput constructor for TestInput.
NewTestOutput constructor for TestOutput, accepts callback which get called on each incoming Write.
NewTLSConfig loads TLS certificates.

# Constants

KafkaOutputFrequency in milliseconds.
These constants help to indicate the type of payload.
These constants help to indicate the type of payload.
These constants help to indicate the type of payload.

# Variables

DEMO indicates that goreplay is running in demo mode.
ErrorStopped is the error returned when the go routines reading the input is stopped.
PRO this value indicates if goreplay is running in PRO mode.
Settings holds Gor configuration.
VERSION the current version of goreplay.

# Structs

AppSettings is the struct of main configuration.
BinaryOutput plugin manage pool of workers which send request to replayed server By default workers pool is dynamic and starts with 10 workers You can specify fixed number of workers using `--output-tcp-workers`.
BinaryOutputConfig struct for holding binary output configuration.
DummyInput used for debugging.
DummyOutput used for debugging, prints all incoming requests.
Emitter represents an abject to manage plugins communication.
FileInput can read requests generated by FileOutput.
FileOutput output plugin.
FileOutputConfig ...
HTTPClient holds configurations for a single HTTP client.
HTTPInput used for sending requests to Gor via http.
HTTPModifierConfig holds configuration options for built-in traffic modifier.
HTTPOutput plugin manage pool of workers which send request to replayed server By default workers pool is dynamic and starts with 1 worker or workerMin workers You can specify maximum number of workers using `--output-http-workers`.
HTTPOutputConfig struct for holding http output configuration.
InOutPlugins struct for holding references to plugins.
InputKafkaConfig should contains required information to build producers.
KafkaInput is used for receiving Kafka messages and transforming them into HTTP payloads.
KafkaMessage should contains catched request information that should be passed as Json to Apache Kafka.
KafkaOutput is used for sending payloads to kafka in JSON format.
KafkaTLSConfig should contains TLS certificates for connecting to secured Kafka clusters.
Limiter is a wrapper for input or output plugin which adds rate limiting.
Message represents data across plugins.
Middleware represents a middleware object.
NullOutput used for debugging, prints nothing.
OutputKafkaConfig is the representation of kfka output configuration.
RAWInput used for intercepting traffic for given address.
RAWInputConfig represents configuration that can be applied on raw input.
S3Output output plugin.
S3ReadCloser ...
TCPClient client connection properties.
TCPClientConfig client configuration.
TCPInput used for internal communication.
TCPInputConfig represents configuration of a TCP input plugin.
TCPOutput used for sending raw tcp payloads Currently used for internal communication between listener and replay server Can be used for transferring binary payloads like protocol buffers.
TCPOutputConfig tcp output configuration.
TestInput used for testing purpose, it allows emitting requests on demand.
TestOutput used in testing to intercept any output into callback.

# Interfaces

PluginReader is an interface for input plugins.
PluginReadWriter is an interface for plugins that support reading and writing.
PluginWriter is an interface for output plugins.

# Type aliases

HeaderRewriteMap holds regexp and data to rewrite headers.
HTTPHashFilters represents a slice of header hash filters.
HTTPHeaderBasicAuthFilters holds list of regxp to match basic Auth header values.
HTTPHeaderFilters holds list of headers and their regexps.
HTTPHeaders is a slice of headers that must appended.
HTTPMethods holds values for method allowed.
HTTPParams filters for --http-set-param.
HTTPURLRegexp a slice of regexp to match URLs.
MultiOption allows to specify multiple flags with same name and collects all values into array.
URLRewriteMap holds regexp and data to modify URL.