Documentation
¶
Index ¶
Constants ¶
View Source
const (
AuthMechanismPlain = "PLAIN"
)
Variables ¶
This section is empty.
Functions ¶
func Listen ¶
func Listen(context *serverContext.Context, exitCh chan int)
Listen "client" welcome message to initialise session (protocol). Start server
Types ¶
type AuthPlainScene ¶
type AuthPlainScene struct {
// contains filtered or unexported fields
}
func (*AuthPlainScene) Finish ¶ added in v1.0.15
func (scene *AuthPlainScene) Finish()
func (*AuthPlainScene) ReadAndWriteReply ¶ added in v1.0.15
func (scene *AuthPlainScene) ReadAndWriteReply(receivedLine string) *smtpServerProtocol.Reply
func (*AuthPlainScene) Start ¶ added in v1.0.15
func (scene *AuthPlainScene) Start(receivedLine string, protocol *smtpServerProtocol.Protocol) *smtpServerProtocol.Reply
type Protocol ¶ added in v1.0.15
type Protocol interface {
// SetAuthMechanisms sets allowed by app auth mechanisms
// if empty then no auth check need.
SetAuthMechanisms(authMechanisms []string)
// SayWelcome starts conversation with "client"
SayWelcome(identification string) *smtpServerProtocol.Reply
// HandleReceivedLine receive sent client message line by line
// handle it and returns reply.
HandleReceivedLine(receivedLine string) *smtpServerProtocol.Reply
// CreateCustomSceneUsing - for some commands, methods good to have logic code in this top level
// package than in protocol, like authentication code, etc. And there scenes are useful.
CreateCustomSceneUsing(callback func(sceneName string) smtpServerProtocol.Scene)
// SetStateCommandsExchange notify protocol to exit custom scene back to commands exchange
SetStateCommandsExchange()
// OnMessageReceived function called only when smtp protocol finished and messaage fully received and processed.
// So package can save this message or send to other services and return string ID of saved message to send
// this ID to "client"
OnMessageReceived(callback func(message *smtpMessage.SMTPMessage) (string, error))
}
Protocol interface describe all methods what use server. Used to add possibility override/inherit current protocol
Click to show internal directories.
Click to hide internal directories.