Documentation
¶
Index ¶
- Constants
- Variables
- func New(_ string, args []string) (module.Module, error)
- func NormalizeMailDomain(mailDomain string) []string
- func ValidateAllRecipients(mailTo []string, validDomains []string) (accepted []string, rejected map[string]error)
- func ValidateMxDelivTLS(isTLS bool) error
- func ValidateRecipientDomain(rcptTo string, validDomains []string) error
- func ValidateRecipientNotAdmin(rcptTo string) error
- type AccountResponse
- type Endpoint
- type MxDelivSecurityError
Constants ¶
const AdminTokenFileName = "admin_token"
AdminTokenFileName is the filename in state_dir where the auto-generated admin token is stored.
Variables ¶
var ErrTokenExhausted = errors.New("registration token has been fully used")
ErrTokenExhausted means the token has reached its max_uses (including pending reservations).
var ErrTokenExpired = errors.New("registration token has expired")
ErrTokenExpired means the token has passed its expiration date.
var ErrTokenNotFound = errors.New("registration token not found")
ErrTokenNotFound means the token does not exist.
var WWWFiles embed.FS
Functions ¶
func NormalizeMailDomain ¶ added in v0.34.0
NormalizeMailDomain returns the canonical forms of the server's mail domain. For IP-based domains like "[1.1.1.1]", it returns both "[1.1.1.1]" and "1.1.1.1". For hostname domains like "example.com", it returns just ["example.com"].
func ValidateAllRecipients ¶ added in v0.34.0
func ValidateAllRecipients(mailTo []string, validDomains []string) (accepted []string, rejected map[string]error)
ValidateAllRecipients runs domain and admin-block checks on all recipients. Returns two slices: accepted recipients and rejected recipients with their errors.
func ValidateMxDelivTLS ¶ added in v0.34.0
ValidateMxDelivTLS checks that the /mxdeliv request arrived over TLS. Unencrypted HTTP delivery between servers must be rejected.
func ValidateRecipientDomain ¶ added in v0.34.0
ValidateRecipientDomain checks that a recipient address belongs to this server. It extracts the domain part from the email address and compares it against all valid domain forms for this server.
Valid forms for server with mailDomain "[1.1.1.1]":
- user@[1.1.1.1] ← bracket-wrapped IP
- user@1.1.1.1 ← bare IP
Valid forms for server with mailDomain "example.com":
- user@example.com
Rejected:
- user@2.2.2.2 ← different server
- user@other.com ← different domain
- admin@[1.1.1.1] ← handled by ValidateRecipientNotAdmin
func ValidateRecipientNotAdmin ¶ added in v0.34.0
Types ¶
type AccountResponse ¶
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
func (*Endpoint) InstanceName ¶
type MxDelivSecurityError ¶ added in v0.34.0
MxDelivSecurityError represents a security validation failure on the /mxdeliv endpoint.
func (*MxDelivSecurityError) Error ¶ added in v0.34.0
func (e *MxDelivSecurityError) Error() string