smtp

package
v0.0.0-...-5cfdc92 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceNotAvailable              = 421
	AuthenticationCredentialsInvalid = 535
	TransactionFailed                = 554
)

Variables

View Source
var ErrTLSNotConfigured = errors.New("TLS not configured")

Functions

func ErrInvalidScheme

func ErrInvalidScheme(scheme string) error

func ErrMissingTLSConfig

func ErrMissingTLSConfig(tlsType string) error

Types

type Auth

type Auth struct {
	Enabled bool
	Users   []*AuthUser
}

func NewAuth

func NewAuth(conf config.SMTPAuth) *Auth

type AuthUser

type AuthUser struct {
	Email        string
	PasswordHash string
}

func NewAuthUser

func NewAuthUser(email, passwordHash string) *AuthUser

func (*AuthUser) Authenticate

func (au *AuthUser) Authenticate(username, password string) bool

type Limit

type Limit struct {
	Connections int
	MessageSize int
	Recipients  int
}

func NewLimit

func NewLimit(conf config.SMTPLimit) *Limit

type SMTP

type SMTP struct {
	Servers []*Server
}

func NewSMTP

func NewSMTP(smtpConf config.SMTP, relayConf config.Relay, uris []string) *SMTP

func (*SMTP) GetName

func (s *SMTP) GetName() string

func (*SMTP) Serve

func (s *SMTP) Serve(ctx context.Context) (err error)

type Server

type Server struct {
	Auth      *Auth
	Hostname  string
	Limit     *Limit
	Timeout   *Timeout
	TLS       *TLS
	Whitelist []string

	URI      *URI
	Relay    *relay.Relay
	SMTPD    *smtpd.Server
	Listener net.Listener
}

func NewServer

func NewServer(smtpConf config.SMTP, relayConf config.Relay, uri *URI) (*Server, error)

func (*Server) Build

func (s *Server) Build() (err error)

func (*Server) Shutdown

func (s *Server) Shutdown() error

func (*Server) Start

func (s *Server) Start()

type TLS

type TLS struct {
	Config           *tls.Config
	ForceForStartTLS bool
}

func NewTLS

func NewTLS(conf config.SMTPTLS) (*TLS, error)

type Timeout

type Timeout struct {
	Read  time.Duration
	Write time.Duration
	Data  time.Duration
}

func NewTimeout

func NewTimeout(conf config.SMTPTimeout) *Timeout

type URI

type URI struct {
	Scheme  string
	Address string
}

func NewURI

func NewURI(uri string) (*URI, error)

func (*URI) String

func (u *URI) String() string

type Whitelist

type Whitelist struct {
	CIDRs []string
}

func NewWhitelist

func NewWhitelist(cidrs []string) *Whitelist

Jump to

Keyboard shortcuts

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