backend

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, f func() (Backend, error))

Register registers a backend

Types

type Backend

type Backend interface {
	// Receive receives the output of an SMTP conversation
	Receive(output *Output) error
	// Chan returns a channel to send notifications to
	Chan() chan MessageID
	// List returns a list of messages
	List(start, limit int) ([]*Output, error)
	// Fetch returns a message based on message ID
	Fetch(MessageID) (*Output, error)
	// Close closes the backend
	Close() error
}

Backend represents a server backend

func New

func New(name string) (Backend, error)

New creates a new backend

type Data

type Data struct {
	Date   time.Time
	Sender DataSender
	Line   string
}

Data represents an individual line of the SMTP conversation

type DataSender

type DataSender string

DataSender represents the data origin

const Client DataSender = "CLIENT"

Client represents data sent by the client

const Server DataSender = "SERVER"

Server represents data sent by the server

type Event

type Event struct {
	Date  time.Time
	Event string
	Args  []string
}

Event represents an event

type MessageID

type MessageID string

MessageID represents a message ID

type Output

type Output struct {
	Context       string
	RemoteAddress string
	TLS           bool
	Messages      []*data.SMTPMessage

	Data   []Data
	Proto  []Proto
	Events []Event

	LogData, LogProto, LogEvents bool
	// contains filtered or unexported fields
}

Output represents an SMTP conversation

func NewOutput

func NewOutput(context string, remoteAddress string, logData, logEvents, logProto bool) *Output

NewOutput creates a new Output instance

func (*Output) RecordData

func (s *Output) RecordData(sender DataSender, line string)

RecordData records a line of the SMTP conversation

func (*Output) RecordEvent

func (s *Output) RecordEvent(event string, args []string)

RecordEvent records an event from the server

func (*Output) RecordMessage

func (s *Output) RecordMessage(message *data.SMTPMessage)

RecordMessage records a message received in the SMTP conversation

func (*Output) RecordProto

func (s *Output) RecordProto(event string, args []interface{})

RecordProto records data from the protocol state machine

type Proto

type Proto struct {
	Date  time.Time
	Event string
	Args  []interface{}
}

Proto represents data from the protocol state machine

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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