updated deps; updated healthchecks.io integration

This commit is contained in:
Aine
2024-04-07 14:42:12 +03:00
parent 271a4a0e31
commit 15d61f174e
122 changed files with 3432 additions and 4613 deletions

View File

@@ -2,6 +2,8 @@ package smtp
import (
"io"
"github.com/emersion/go-sasl"
)
var (
@@ -20,6 +22,11 @@ var (
EnhancedCode: EnhancedCode{5, 7, 0},
Message: "Authentication not supported",
}
ErrAuthUnknownMechanism = &SMTPError{
Code: 504,
EnhancedCode: EnhancedCode{5, 7, 4},
Message: "Unsupported authentication mechanism",
}
)
// A SMTP server backend.
@@ -27,6 +34,17 @@ type Backend interface {
NewSession(c *Conn) (Session, error)
}
// BackendFunc is an adapter to allow the use of an ordinary function as a
// Backend.
type BackendFunc func(c *Conn) (Session, error)
var _ Backend = (BackendFunc)(nil)
// NewSession calls f(c).
func (f BackendFunc) NewSession(c *Conn) (Session, error) {
return f(c)
}
// Session is used by servers to respond to an SMTP client.
//
// The methods are called when the remote client issues the matching command.
@@ -37,9 +55,6 @@ type Session interface {
// Free all resources associated with session.
Logout() error
// Authenticate the user using SASL PLAIN.
AuthPlain(username, password string) error
// Set return path for currently processed message.
Mail(from string, opts *MailOptions) error
// Add recipient for currently processed message.
@@ -76,3 +91,12 @@ type LMTPSession interface {
type StatusCollector interface {
SetStatus(rcptTo string, err error)
}
// AuthSession is an add-on interface for Session. It provides support for the
// AUTH extension.
type AuthSession interface {
Session
AuthMechanisms() []string
Auth(mech string) (sasl.Server, error)
}