Documentation ¶
Overview ¶
Package http implements an disruptor for http requests. The disruptor runs as a proxy, redirecting the traffic from a target defined in DisruptionTarget using iptables. The intercepted requests are forwarded to the target and optionally are disrupted according to the disruption options defined in Disruption. The configuration of the proxy is defined in the DisruptorConfig.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 DisruptionTarget ¶
type DisruptionTarget struct { // Destination port to intercept traffic TargetPort uint // Network interface where the traffic will be intercepted Iface string }
DisruptionTarget defines the target of the disruptions
type Disruptor ¶
Disruptor defines the interface disruptor of http requests
func NewDefaultDisruptor ¶
func NewDefaultDisruptor(target DisruptionTarget, disruption Disruption) (Disruptor, error)
NewDefaultDisruptor creates a Disruptor with valid default configuration.
func NewDisruptor ¶
func NewDisruptor( target DisruptionTarget, disruption Disruption, config DisruptorConfig, ) (Disruptor, error)
NewDisruptor creates a new instance of a Disruptor that applies a disruptions to a target The configuration controls how the disruptor operates.
type DisruptorConfig ¶
type DisruptorConfig struct {
ProxyConfig ProxyConfig
}
DisruptorConfig defines the configuration options for the Disruptor
type Proxy ¶
Proxy defines an interface for a proxy
func NewProxy ¶
func NewProxy(target Target, disruption Disruption, config ProxyConfig) (Proxy, error)
NewProxy return a new HttpProxy
type ProxyConfig ¶
type ProxyConfig struct { // Port on which the proxy will be running ListeningPort uint }
ProxyConfig specifies the configuration for the http proxy