Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterStatelessCheck ¶
func RegisterStatelessCheck(name string, defaultFailAction modconfig.FailAction, connCheck FuncConnCheck, senderCheck FuncSenderCheck, rcptCheck FuncRcptCheck, bodyCheck FuncBodyCheck)
RegisterStatelessCheck is helper function to create stateless message check modules that run one simple check during one stage.
It creates the module and its instance with the specified name that implement module.Check interface and runs passed functions when corresponding module.CheckState methods are called.
Note about CheckResult that is returned by the functions: StatelessCheck supports different action types based on the user configuration, but the particular check code doesn't need to know about it. It should assume that it is always "Reject" and hence it should populate Reason field of the result object with the relevant error description.
Types ¶
type FuncBodyCheck ¶
type FuncBodyCheck func(checkContext StatelessCheckContext, header textproto.Header, body buffer.Buffer) module.CheckResult
type FuncConnCheck ¶
type FuncConnCheck func(checkContext StatelessCheckContext) module.CheckResult
type FuncRcptCheck ¶
type FuncRcptCheck func(checkContext StatelessCheckContext, rcptTo string) module.CheckResult
type FuncSenderCheck ¶
type FuncSenderCheck func(checkContext StatelessCheckContext, mailFrom string) module.CheckResult
type StatelessCheckContext ¶
type StatelessCheckContext struct { // Embedded context.Context value, used for tracing, cancellation and // timeouts. context.Context // Resolver that should be used by the check for DNS queries. Resolver dns.Resolver MsgMeta *module.MsgMetadata // Logger that should be used by the check for logging, note that it is // already wrapped to append Msg ID to all messages so check code // should not do the same. Logger log.Logger }