monkey

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChaosMonkey

type ChaosMonkey interface {
	RegisterFlags()
	Configure(func(string, ...interface{}))

	// Accept is called for each incoming connection. Returning false closes the connection.
	Accept(conn net.Conn) bool
	// LinkSpeed sets the maximum connection throughput (in one direction)
	LinkSpeed() *linkio.Throughput

	// ValidRCPT is called for the RCPT command. Returning false signals an invalid recipient.
	ValidRCPT(rcpt string) bool
	// ValidMAIL is called for the MAIL command. Returning false signals an invalid sender.
	ValidMAIL(mail string) bool
	// ValidAUTH is called after authentication. Returning false signals invalid authentication.
	ValidAUTH(mechanism string, args ...string) bool

	// Disconnect is called after every read. Returning true will close the connection.
	Disconnect() bool
}

ChaosMonkey should be implemented by chaos monkeys!

type Jim

type Jim struct {
	DisconnectChance      float64
	AcceptChance          float64
	LinkSpeedAffect       float64
	LinkSpeedMin          float64
	LinkSpeedMax          float64
	RejectSenderChance    float64
	RejectRecipientChance float64
	RejectAuthChance      float64
	// contains filtered or unexported fields
}

Jim is a chaos monkey

func (*Jim) Accept

func (j *Jim) Accept(conn net.Conn) bool

Accept implements ChaosMonkey.Accept

func (*Jim) Configure

func (j *Jim) Configure(logf func(string, ...interface{}))

Configure implements ChaosMonkey.Configure

func (*Jim) ConfigureFrom added in v0.1.2

func (j *Jim) ConfigureFrom(j2 *Jim)

ConfigureFrom lets us configure a new Jim from an old one without having to expose logf (and any other future private vars)

func (*Jim) Disconnect

func (j *Jim) Disconnect() bool

Disconnect implements ChaosMonkey.Disconnect

func (*Jim) LinkSpeed

func (j *Jim) LinkSpeed() *linkio.Throughput

LinkSpeed implements ChaosMonkey.LinkSpeed

func (*Jim) RegisterFlags

func (j *Jim) RegisterFlags()

RegisterFlags implements ChaosMonkey.RegisterFlags

func (*Jim) ValidAUTH

func (j *Jim) ValidAUTH(mechanism string, args ...string) bool

ValidAUTH implements ChaosMonkey.ValidAUTH

func (*Jim) ValidMAIL

func (j *Jim) ValidMAIL(mail string) bool

ValidMAIL implements ChaosMonkey.ValidMAIL

func (*Jim) ValidRCPT

func (j *Jim) ValidRCPT(rcpt string) bool

ValidRCPT implements ChaosMonkey.ValidRCPT

Jump to

Keyboard shortcuts

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