smtp

package
v0.0.0-...-11acd14 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2017 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServer

func NewServer() (mh2server.Server, error)

NewServer returns a new server

Types

type ChaosMonkey

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

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

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

ChaosMonkey should be implemented by chaos monkeys!

type Config

type Config struct {
	BindAddr            string `env:"MH2_SMTP_BIND_ADDR"`
	Hostname            string `env:"MH2_SMTP_HOSTNAME"`
	LogData             bool   `env:"MH2_LOG_DATA"`
	LogProto            bool   `env:"MH2_LOG_PROTO"`
	Backend             string `env:"MH2_BACKEND"`
	RecordSessionData   bool   `env:"MH2_RECORD_SESSION_DATA"`
	RecordSessionProto  bool   `env:"MH2_RECORD_SESSION_PROTO"`
	RecordSessionEvents bool   `env:"MH2_RECORD_SESSION_EVENTS"`
	Jim                 JimConfig
}

Config is the SMTP server configuration

type Jim

type Jim struct {
	JimConfig
}

Jim is a chaos monkey

func (*Jim) Accept

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

Accept implements ChaosMonkey.Accept

func (*Jim) Disconnect

func (j *Jim) Disconnect(context string) bool

Disconnect implements ChaosMonkey.Disconnect

func (*Jim) LinkSpeed

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

LinkSpeed implements ChaosMonkey.LinkSpeed

func (*Jim) ValidAUTH

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

ValidAUTH implements ChaosMonkey.ValidAUTH

func (*Jim) ValidMAIL

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

ValidMAIL implements ChaosMonkey.ValidMAIL

func (*Jim) ValidRCPT

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

ValidRCPT implements ChaosMonkey.ValidRCPT

type JimConfig

type JimConfig struct {
	Enabled               bool    `env:"JIM_ENABLED"`
	DisconnectChance      float64 `env:"JIM_DISCONNECT_CHANCE"`
	AcceptChance          float64 `env:"JIM_ACCEPT_CHANCE"`
	LinkSpeedAffect       float64 `env:"JIM_LINKSPEED_AFFECT"`
	LinkSpeedMin          float64 `env:"JIM_LINKSPEED_MIN"`
	LinkSpeedMax          float64 `env:"JIM_LINKSPEED_MAX"`
	RejectSenderChance    float64 `env:"JIM_REJECT_SENDER_CHANCE"`
	RejectRecipientChance float64 `env:"JIM_REJECT_RECIPIENT_CHANCE"`
	RejectAuthChance      float64 `env:"JIM_REJECT_AUTH_CHANCE"`
}

JimConfig is the Jim chaos monkey configuration

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session represents a SMTP session using net.TCPConn

func (*Session) Read

func (c *Session) Read() bool

Read reads from the underlying net.TCPConn

func (*Session) Write

func (c *Session) Write(reply *smtp.Reply)

Write writes a reply to the underlying net.TCPConn

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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