MailHog/vendor/github.com/mailhog/MailHog-Server/monkey/monkey.go

29 lines
922 B
Go
Raw Normal View History

2017-04-16 23:42:21 +00:00
package monkey
import (
"net"
"github.com/ian-kent/linkio"
)
// ChaosMonkey should be implemented by chaos monkeys!
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
}