Documentation ¶
Index ¶
- func OnError(writer http.ResponseWriter, code int, message string)
- func OnSuccess(writer http.ResponseWriter, payload interface{})
- func SendJSONResponse(writer http.ResponseWriter, code int, payload interface{})
- func Start(serverContext *config.Context, router *mux.Router)
- func Stop(serverContext *config.Context)
- func WaitForStopSignal() chan os.Signal
- type SMTPBackEnd
- func (smtpBackEnd *SMTPBackEnd) AddEmail(email parsemail.Email)
- func (smtpBackEnd *SMTPBackEnd) AnonymousLogin(state *smtp.ConnectionState) (smtp.Session, error)
- func (smtpBackEnd *SMTPBackEnd) ClearEmails()
- func (smtpBackEnd *SMTPBackEnd) GetEmail() (parsemail.Email, error)
- func (smtpBackEnd *SMTPBackEnd) Login(state *smtp.ConnectionState, username, password string) (smtp.Session, error)
- func (smtpBackEnd *SMTPBackEnd) Start()
- func (smtpBackEnd *SMTPBackEnd) Stop()
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OnError ¶
func OnError(writer http.ResponseWriter, code int, message string)
Wrapper function which calls SendJSONResponse with the provided error code and specifies an error message in the response
func OnSuccess ¶
func OnSuccess(writer http.ResponseWriter, payload interface{})
Wrapper function which calls SendJSONResponse with http.StatusOk
func SendJSONResponse ¶
func SendJSONResponse(writer http.ResponseWriter, code int, payload interface{})
Writes a json response with the specified error code and supplied payload An error is logged if the write fails
func WaitForStopSignal ¶
Returns a channel that sends a signal when one of the following system calls is detected:
- SIGHUP
- SIGINT
- SIGTERM
- SIGKILL
- SIGQUIT
Types ¶
type SMTPBackEnd ¶
type SMTPBackEnd struct { Config config.SMTP SMTPServer *smtp.Server // contains filtered or unexported fields }
The backend that implements SMTP server methods
func NewSMTPBackEnd ¶
func NewSMTPBackEnd(serverConfig config.SMTP) *SMTPBackEnd
Default constructor for SMTPBackEnd
func (*SMTPBackEnd) AddEmail ¶
func (smtpBackEnd *SMTPBackEnd) AddEmail(email parsemail.Email)
Adds an email to the queue Uses a mutex to ensure thread safety.
func (*SMTPBackEnd) AnonymousLogin ¶
func (smtpBackEnd *SMTPBackEnd) AnonymousLogin(state *smtp.ConnectionState) (smtp.Session, error)
AnonymousLogin requires clients to authenticate using SMTP AUTH before sending emails
func (*SMTPBackEnd) ClearEmails ¶
func (smtpBackEnd *SMTPBackEnd) ClearEmails()
Removes all emails from the queue Uses a mutex for thread safety.
func (*SMTPBackEnd) GetEmail ¶
func (smtpBackEnd *SMTPBackEnd) GetEmail() (parsemail.Email, error)
Retrieves the first email and removes it from the queue Uses a mutex to ensure thread safety.
func (*SMTPBackEnd) Login ¶
func (smtpBackEnd *SMTPBackEnd) Login(state *smtp.ConnectionState, username, password string) (smtp.Session, error)
Login handles a login command with username and password.
func (*SMTPBackEnd) Start ¶
func (smtpBackEnd *SMTPBackEnd) Start()
Starts the SMTPServer in a new go-routine
func (*SMTPBackEnd) Stop ¶
func (smtpBackEnd *SMTPBackEnd) Stop()
Calls close on a running SMTPServer instance