symptom

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: May 11, 2019 License: MIT Imports: 18 Imported by: 4

Documentation

Overview

Package symptom contains the default muxy.Symptom implementations: HTTP Delay, HTTP Tamperer, Network Shape and the TCP Tamperer.

Index

Constants

This section is empty.

Variables

View Source
var MatchSymptoms = func(rules []MatchingRule, ctx muxy.Context) bool {
	for _, rule := range rules {
		if MatchSymptom(rule, ctx) {
			return true
		}
	}
	return false
}

MatchSymptoms takes a set of matching rules and a Muxy context and determines if there is a match

Functions

func MatchSymptom added in v0.0.4

func MatchSymptom(rule MatchingRule, ctx muxy.Context) bool

MatchSymptom takes a matching rule and a Muxy context and determines if there is a match

Types

type HTTPDelaySymptom added in v0.0.3

type HTTPDelaySymptom struct {
	RequestDelay  int            `required:"false" mapstructure:"request_delay"`
	ResponseDelay int            `required:"false" mapstructure:"response_delay"`
	Delay         int            `required:"false" mapstructure:"delay"`
	MatchingRules []MatchingRule `required:"false" mapstructure:"matching_rules"`
}

HTTPDelaySymptom adds specified delays to requests Symptom Update docs: these values should be in ms

func (*HTTPDelaySymptom) HandleEvent added in v0.0.3

func (m *HTTPDelaySymptom) HandleEvent(e muxy.ProxyEvent, ctx *muxy.Context)

HandleEvent takes a proxy event for the proxy to intercept and modify

func (*HTTPDelaySymptom) Muck added in v0.0.3

func (m *HTTPDelaySymptom) Muck(ctx *muxy.Context, wait int)

Muck injects chaos into the system

func (*HTTPDelaySymptom) Setup added in v0.0.3

func (m *HTTPDelaySymptom) Setup()

Setup sets up the delay plugin

func (*HTTPDelaySymptom) Teardown added in v0.0.3

func (m *HTTPDelaySymptom) Teardown()

Teardown shuts down the plugin

type HTTPTampererSymptom added in v0.0.3

type HTTPTampererSymptom struct {
	Request       RequestConfig
	Response      ResponseConfig
	MatchingRules []MatchingRule `required:"false" mapstructure:"matching_rules"`
}

HTTPTampererSymptom is a plugin to mess with request/responses between a consumer and provider system

func (*HTTPTampererSymptom) HandleEvent added in v0.0.3

func (m *HTTPTampererSymptom) HandleEvent(e muxy.ProxyEvent, ctx *muxy.Context)

HandleEvent is a hook to allow the plugin to intervene with a request/response event

func (*HTTPTampererSymptom) MuckRequest added in v0.0.3

func (m *HTTPTampererSymptom) MuckRequest(ctx *muxy.Context)

MuckRequest adds chaos to the request

func (*HTTPTampererSymptom) MuckResponse added in v0.0.3

func (m *HTTPTampererSymptom) MuckResponse(ctx *muxy.Context)

MuckResponse adds chaos to the response

func (*HTTPTampererSymptom) Setup added in v0.0.3

func (m *HTTPTampererSymptom) Setup()

Setup sets up the plugin

func (*HTTPTampererSymptom) Teardown added in v0.0.3

func (m *HTTPTampererSymptom) Teardown()

Teardown shuts down the plugin

type MatchingRule added in v0.0.4

type MatchingRule struct {
	Method      string
	Path        string
	Host        string
	Probability float64
}

MatchingRule describes the fields to match on an HTTP request

type NetworkShaperSymptom added in v0.0.4

type NetworkShaperSymptom struct {
	Device           string
	Latency          int      `default:"-1"`
	TargetBandwidth  int      `mapstructure:"target_bw" default:"-1"`
	DefaultBandwidth int      `mapstructure:"default_bw" default:"-1"`
	PacketLoss       float64  `mapstructure:"packet_loss"`
	TargetIps        []string `mapstructure:"target_ips"`
	TargetIps6       []string `mapstructure:"target_ips6"`
	TargetPorts      []string `mapstructure:"target_ports"`
	TargetProtos     []string `mapstructure:"target_protos" required:"true" default:"tcp,icmp,udp"`
	// contains filtered or unexported fields
}

NetworkShaperSymptom allows you to modify the network speed on a host e.g. shape bandwidth to mobile, slower speeds

func (NetworkShaperSymptom) HandleEvent added in v0.0.4

func (s NetworkShaperSymptom) HandleEvent(e muxy.ProxyEvent, ctx *muxy.Context)

HandleEvent is the hook into the event system

func (*NetworkShaperSymptom) Muck added in v0.0.4

func (s *NetworkShaperSymptom) Muck(ctx *muxy.Context)

Muck is where the plugin can do any context-specific chaos

func (*NetworkShaperSymptom) Setup added in v0.0.4

func (s *NetworkShaperSymptom) Setup()

Setup sets up the plugin

func (*NetworkShaperSymptom) Teardown added in v0.0.4

func (s *NetworkShaperSymptom) Teardown()

Teardown shuts down the plugin

type RequestConfig

type RequestConfig struct {
	Method  string
	Headers map[string]string
	Cookies []http.Cookie
	Body    string
	Path    string
	Host    string
}

RequestConfig contains details of the HTTP request to tamper with prior to sending on to the target system

type ResponseConfig

type ResponseConfig struct {
	Headers map[string]string
	Cookies []http.Cookie
	Body    string
	Status  int
}

ResponseConfig contains details of the HTTP response to tamper with prior to sending on to the initiating system

type TCPRequestConfig added in v0.0.3

type TCPRequestConfig struct {
	// Body fixes the request message
	Body string

	// Randomize request message
	Randomize bool

	// Truncate the request message. Removes trailing char
	Truncate bool
}

TCPRequestConfig contains details of the HTTP request to tamper with prior to sending on to the target system

type TCPResponseConfig added in v0.0.3

type TCPResponseConfig struct {
	// Body fixes the response message
	Body string

	// Randomize response message
	Randomize bool

	// Truncate the response message. Removes trailing char
	Truncate bool
}

TCPResponseConfig contains details of the TCP response to tamper with prior to sending on to the initiating system

type TCPTampererSymptom added in v0.0.3

type TCPTampererSymptom struct {
	Request       TCPRequestConfig
	Response      TCPResponseConfig
	MatchingRules []MatchingRule `required:"false" mapstructure:"matching_rules"`
}

TCPTampererSymptom is a plugin to mess with request/responses between a consumer and provider system

func (*TCPTampererSymptom) HandleEvent added in v0.0.3

func (m *TCPTampererSymptom) HandleEvent(e muxy.ProxyEvent, ctx *muxy.Context)

HandleEvent is a hook to allow the plugin to intervene with a request/response event

func (*TCPTampererSymptom) MuckRequest added in v0.0.3

func (m *TCPTampererSymptom) MuckRequest(ctx *muxy.Context)

MuckRequest adds chaos to the request

func (*TCPTampererSymptom) MuckResponse added in v0.0.3

func (m *TCPTampererSymptom) MuckResponse(ctx *muxy.Context)

MuckResponse adds chaos to the response

func (*TCPTampererSymptom) Setup added in v0.0.3

func (m *TCPTampererSymptom) Setup()

Setup sets up the plugin

func (*TCPTampererSymptom) Teardown added in v0.0.3

func (m *TCPTampererSymptom) Teardown()

Teardown shuts down the plugin

Directories

Path Synopsis
package throttler is taken from https://github.com/tylertreat/comcast and modified for use as a library
package throttler is taken from https://github.com/tylertreat/comcast and modified for use as a library

Jump to

Keyboard shortcuts

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