Documentation ¶
Overview ¶
Package evsmtp is a generated GoMock package.
Index ¶
- Constants
- Variables
- func DefaultRandomCacheKeyGetter(email evmail.Address) interface{}
- func DirectDial(ctx context.Context, addr, proxyURL string) (smtpclient.SMTPClient, error)
- func ExtID() int8
- func H12IODial(ctx context.Context, addr, proxyURL string) (smtpclient.SMTPClient, error)
- func SetExtID(rExt int8)
- type ARandomRCPT
- type ASMTPError
- type AliasError
- type Checker
- type CheckerDTO
- type CheckerWithRandomRCPT
- type DefaultError
- type DialFunc
- type Error
- type FuncLookupMX
- type Input
- type MXs
- type MockChecker
- type MockCheckerMockRecorder
- type MockCheckerWithRandomRCPT
- type MockCheckerWithRandomRCPTMockRecorder
- type MockRandomRCPT
- type MockRandomRCPTMockRecorder
- type Options
- type OptionsDTO
- type RandomCacheKeyGetter
- type RandomEmail
- type RandomRCPT
- type RandomRCPTFunc
- type SafeSendMailStage
- type SendMail
- type SendMailDialerFactory
- type SendMailFactory
- type SendMailStage
Constants ¶
const ( ErrPrefix = "evsmtp: " ErrConnectionMsg = ErrPrefix + "connection was not created" DefaultEmail = "user@example.org" DefaultSMTPPort = 25 DefaultHelloName = "localhost" )
Configuration constants
const ( RandomRCPTStage = CloseStage + 1 ConnectionStage = RandomRCPTStage + 1 )
Constants of stages
const ( // DefaultTimeoutConnection is timeout for connection DefaultTimeoutConnection = 5 * time.Second // DefaultTimeoutResponse is timeout for communication with smtp server DefaultTimeoutResponse = 5 * time.Second )
const TCPConnection = "tcp"
TCPConnection is tcp name
Variables ¶
var ( // ErrConnection is error of connection ErrConnection = NewError(ConnectionStage, errors.New(ErrConnectionMsg)) // DefaultFromEmail is address, used as default From email DefaultFromEmail = evmail.FromString(DefaultEmail) )
Functions ¶
func DefaultRandomCacheKeyGetter ¶
DefaultRandomCacheKeyGetter generates of cache key for RandomRCPT
func DirectDial ¶
func DirectDial(ctx context.Context, addr, proxyURL string) (smtpclient.SMTPClient, error)
DirectDial generates smtpclient.SMTPClient (smtp.Client)
func H12IODial ¶
func H12IODial(ctx context.Context, addr, proxyURL string) (smtpclient.SMTPClient, error)
H12IODial generates smtpclient.SMTPClient (smtp.Client) with proxy in socks.Dial
Types ¶
type ARandomRCPT ¶
type ARandomRCPT struct {
// contains filtered or unexported fields
}
ARandomRCPT is abstract realization of RandomRCPT
type ASMTPError ¶
type ASMTPError struct {
// contains filtered or unexported fields
}
ASMTPError isa abstract struct for Checker errors
func (*ASMTPError) DecodeMsgpack ¶
func (a *ASMTPError) DecodeMsgpack(dec *msgpack.Decoder) error
DecodeMsgpack implements decoder for msgpack
func (*ASMTPError) EncodeMsgpack ¶
func (a *ASMTPError) EncodeMsgpack(enc *msgpack.Encoder) error
EncodeMsgpack implements encoder for msgpack
func (*ASMTPError) Error ¶
func (a *ASMTPError) Error() string
func (*ASMTPError) Unwrap ¶
func (a *ASMTPError) Unwrap() error
type AliasError ¶
type AliasError error
AliasError is alias to fix msgpack
func ErrorsToEVSMTPErrors ¶
func ErrorsToEVSMTPErrors(errs []error) (Errs []AliasError)
ErrorsToEVSMTPErrors converts []error to []AliasError It is used like fix of msgpack problems https://github.com/vmihailenco/msgpack/issues/294
type Checker ¶
Checker is SMTP validation
func NewCheckerCacheRandomRCPT ¶
func NewCheckerCacheRandomRCPT(checker CheckerWithRandomRCPT, cache evcache.Interface, getKey RandomCacheKeyGetter) Checker
NewCheckerCacheRandomRCPT creates Checker with caching of RandomRCPT calling
type CheckerDTO ¶
type CheckerDTO struct { SendMailFactory SendMailDialerFactory RandomEmail RandomEmail Options Options }
CheckerDTO is DTO for NewChecker
type CheckerWithRandomRCPT ¶
type CheckerWithRandomRCPT interface { Checker RandomRCPT }
CheckerWithRandomRCPT is used for caching of RandomRCPT
type DialFunc ¶
type DialFunc func(ctx context.Context, addr, proxyURL string) (smtpclient.SMTPClient, error)
DialFunc is function type to create smtpclient.SMTPClient
type Error ¶
type Error interface { error Stage() SendMailStage Unwrap() error }
Error is interface of Checker errors
func NewError ¶
func NewError(stage SendMailStage, err error) Error
NewError is constructor for DefaultError
type MockChecker ¶
type MockChecker struct {
// contains filtered or unexported fields
}
MockChecker is a mock of Checker interface
func NewMockChecker ¶
func NewMockChecker(ctrl *gomock.Controller) *MockChecker
NewMockChecker creates a new mock instance
func (*MockChecker) EXPECT ¶
func (m *MockChecker) EXPECT() *MockCheckerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockCheckerMockRecorder ¶
type MockCheckerMockRecorder struct {
// contains filtered or unexported fields
}
MockCheckerMockRecorder is the mock recorder for MockChecker
func (*MockCheckerMockRecorder) Validate ¶
func (mr *MockCheckerMockRecorder) Validate(mxs, input interface{}) *gomock.Call
Validate indicates an expected call of Validate
type MockCheckerWithRandomRCPT ¶
type MockCheckerWithRandomRCPT struct {
// contains filtered or unexported fields
}
MockCheckerWithRandomRCPT is a mock of CheckerWithRandomRCPT interface
func NewMockCheckerWithRandomRCPT ¶
func NewMockCheckerWithRandomRCPT(ctrl *gomock.Controller) *MockCheckerWithRandomRCPT
NewMockCheckerWithRandomRCPT creates a new mock instance
func (*MockCheckerWithRandomRCPT) Call ¶
func (m *MockCheckerWithRandomRCPT) Call(sm SendMail, email evmail.Address) []error
Call mocks base method
func (*MockCheckerWithRandomRCPT) EXPECT ¶
func (m *MockCheckerWithRandomRCPT) EXPECT() *MockCheckerWithRandomRCPTMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockCheckerWithRandomRCPTMockRecorder ¶
type MockCheckerWithRandomRCPTMockRecorder struct {
// contains filtered or unexported fields
}
MockCheckerWithRandomRCPTMockRecorder is the mock recorder for MockCheckerWithRandomRCPT
func (*MockCheckerWithRandomRCPTMockRecorder) Call ¶
func (mr *MockCheckerWithRandomRCPTMockRecorder) Call(sm, email interface{}) *gomock.Call
Call indicates an expected call of Call
func (*MockCheckerWithRandomRCPTMockRecorder) Validate ¶
func (mr *MockCheckerWithRandomRCPTMockRecorder) Validate(mxs, input interface{}) *gomock.Call
Validate indicates an expected call of Validate
type MockRandomRCPT ¶
type MockRandomRCPT struct {
// contains filtered or unexported fields
}
MockRandomRCPT is a mock of RandomRCPT interface
func NewMockRandomRCPT ¶
func NewMockRandomRCPT(ctrl *gomock.Controller) *MockRandomRCPT
NewMockRandomRCPT creates a new mock instance
func (*MockRandomRCPT) Call ¶
func (m *MockRandomRCPT) Call(sm SendMail, email evmail.Address) []error
Call mocks base method
func (*MockRandomRCPT) EXPECT ¶
func (m *MockRandomRCPT) EXPECT() *MockRandomRCPTMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockRandomRCPTMockRecorder ¶
type MockRandomRCPTMockRecorder struct {
// contains filtered or unexported fields
}
MockRandomRCPTMockRecorder is the mock recorder for MockRandomRCPT
func (*MockRandomRCPTMockRecorder) Call ¶
func (mr *MockRandomRCPTMockRecorder) Call(sm, email interface{}) *gomock.Call
Call indicates an expected call of Call
type Options ¶
type Options interface { EmailFrom() evmail.Address HelloName() string Proxy() string TimeoutConnection() time.Duration TimeoutResponse() time.Duration Port() int }
Options describes smtp options
func DefaultOptions ¶
func DefaultOptions() Options
DefaultOptions returns options with default values
func EmptyOptions ¶
func EmptyOptions() Options
EmptyOptions returns empty options to avoid rewriting of default values
type OptionsDTO ¶
type OptionsDTO struct { EmailFrom evmail.Address HelloName string Proxy string TimeoutCon time.Duration TimeoutResp time.Duration Port int }
OptionsDTO is dto for NewOptions
type RandomCacheKeyGetter ¶
RandomCacheKeyGetter is type of function to get cache key
type RandomEmail ¶
RandomEmail is function type to generate random email for checking of Catching All emails by RCPTs
type RandomRCPT ¶
type RandomRCPT interface { Call(sm SendMail, email evmail.Address) []error // contains filtered or unexported methods }
RandomRCPT Need to realize of is-a relation (inheritance)
type RandomRCPTFunc ¶
RandomRCPTFunc is function for checking of Catching All
type SafeSendMailStage ¶
type SafeSendMailStage struct { SendMailStage // contains filtered or unexported fields }
SafeSendMailStage is thread safe SendMailStage
type SendMail ¶
type SendMail interface { Client() smtpclient.SMTPClient Hello(helloName string) error Auth(a smtp.Auth) error Mail(from string) error RCPTs(addrs []string) map[string]error Data() (io.WriteCloser, error) Write(w io.WriteCloser, msg []byte) error Quit() error Close() error }
SendMail is interface of custom realization as smtp.SendMail
func NewSendMail ¶
func NewSendMail(client smtpclient.SMTPClient, tlsConfig *tls.Config) SendMail
NewSendMail instantiates SendMail
type SendMailDialerFactory ¶
SendMailDialerFactory is factory for SendMail with dialing
func NewSendMailCustom ¶
func NewSendMailCustom(dialFunc DialFunc, tlsConfig *tls.Config, factory SendMailFactory) SendMailDialerFactory
NewSendMailCustom creates SendMailFactory with dialing and customization calling of SendMailFactory
func NewSendMailFactory ¶
func NewSendMailFactory(dialFunc DialFunc, tlsConfig *tls.Config) SendMailDialerFactory
NewSendMailFactory creates SendMailDialerFactory
type SendMailFactory ¶
type SendMailFactory func(client smtpclient.SMTPClient, tlsConfig *tls.Config) SendMail
SendMailFactory is factory for SendMail
type SendMailStage ¶
type SendMailStage uint8
SendMailStage is stage type of SendMail
const ( ClientStage SendMailStage = iota + 1 HelloStage AuthStage MailStage RCPTsStage QuitStage CloseStage )
Constants of stages