http

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package http implements a proxy that applies disruptions to HTTP requests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProxy

func NewProxy(c ProxyConfig, d Disruption) (protocol.Proxy, error)

NewProxy return a new Proxy for HTTP requests

Types

type Disruption

type Disruption struct {
	// Average delay introduced to requests
	AverageDelay uint
	// Variation in the delay (with respect of the average delay)
	DelayVariation uint
	// Fraction (in the range 0.0 to 1.0) of requests that will return an error
	ErrorRate float32
	// Error code to be returned by requests selected in the error rate
	ErrorCode uint
	// Body to be returned when an error is injected
	ErrorBody string
	// List of url paths to be excluded from disruptions
	Excluded []string
}

Disruption specifies disruptions in http requests

type ProxyConfig

type ProxyConfig struct {
	// Address to listen for incoming requests
	ListenAddress string
	// Address where to redirect requests
	UpstreamAddress string
}

ProxyConfig configures the Proxy options

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL