dagent

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: AGPL-3.0-or-later Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLocalErrorInProcessingError = &smtp.SMTPError{
	Code:         451,
	EnhancedCode: smtp.EnhancedCodeNotSet,
	Message:      "Local error in processing",
}
View Source
var ErrRequestedActioNotTaken = &smtp.SMTPError{
	Code:         553,
	EnhancedCode: smtp.EnhancedCodeNotSet,
	Message:      "Requested action not taken: mailbox name not allowed",
}
View Source
var ErrServiceNotAvailable = &smtp.SMTPError{
	Code:         421,
	EnhancedCode: smtp.EnhancedCodeNotSet,
	Message:      "Service not available",
}
View Source
var ErrTransactionFailed = &smtp.SMTPError{
	Code:         554,
	EnhancedCode: smtp.EnhancedCode{5, 0, 0},
	Message:      "Error: transaction failed",
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Context context.Context
	Logger  logrus.FieldLogger
	Router  Router

	ReadTimeout     time.Duration
	WriteTimeout    time.Duration
	MaxMessageBytes int
	MaxRecipients   int

	LMTP bool
}

Config bundles dagent configuration settings.

type DAgent

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

func New

func New(config *Config) (*DAgent, error)

func (*DAgent) AnonymousLogin

func (da *DAgent) AnonymousLogin(state *smtp.ConnectionState) (smtp.Session, error)

func (*DAgent) Login

func (da *DAgent) Login(state *smtp.ConnectionState, username, password string) (smtp.Session, error)

func (*DAgent) Serve

func (da *DAgent) Serve(l net.Listener) error

Serve accepts incoming connections on the Listener l.

func (*DAgent) Shutdown

func (da *DAgent) Shutdown(ctx context.Context) error

type Route

type Route interface {
	Mail(ctx context.Context, from string, opts smtp.MailOptions) error
	Rcpt(ctx context.Context, rcptTo string) error
	Data(ctx context.Context, r io.Reader) error
}

type Router

type Router interface {
	Mail(from string, opts smtp.MailOptions) error
	GetRoute(domain string) (Route, error)
}

type Session

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

func NewSession

func NewSession(ctx context.Context, sessionID string, router Router, logger logrus.FieldLogger, onLogout SessionCb) (*Session, error)

func (*Session) Data

func (s *Session) Data(r io.Reader) error

func (*Session) LMTPData

func (s *Session) LMTPData(r io.Reader, status smtp.StatusCollector) error

func (*Session) Logout

func (s *Session) Logout() error

func (*Session) Mail

func (s *Session) Mail(from string, opts smtp.MailOptions) error

func (*Session) Rcpt

func (s *Session) Rcpt(rcptTo string) error

func (*Session) Reset

func (s *Session) Reset()

type SessionCb

type SessionCb func(session *Session)

Jump to

Keyboard shortcuts

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