MCPcopy Create free account
hub / github.com/foxcpp/maddy / RegisterStatelessCheck

Function RegisterStatelessCheck

internal/check/stateless_check.go:189–205  ·  view source on GitHub ↗

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

(name string, defaultFailAction modconfig.FailAction, connCheck FuncConnCheck, senderCheck FuncSenderCheck, rcptCheck FuncRcptCheck, bodyCheck FuncBodyCheck)

Source from the content-addressed store, hash-verified

187// code doesn't need to know about it. It should assume that it is always "Reject" and hence it should
188// populate Reason field of the result object with the relevant error description.
189func RegisterStatelessCheck(name string, defaultFailAction modconfig.FailAction, connCheck FuncConnCheck, senderCheck FuncSenderCheck, rcptCheck FuncRcptCheck, bodyCheck FuncBodyCheck) {
190 modules.Register(name, func(c *container.C, modName, instName string) (module.Module, error) {
191 return &statelessCheck{
192 modName: modName,
193 instName: instName,
194 resolver: dns.DefaultResolver(),
195 logger: c.DefaultLogger.Sublogger(modName),
196
197 defaultFailAction: defaultFailAction,
198
199 connCheck: connCheck,
200 senderCheck: senderCheck,
201 rcptCheck: rcptCheck,
202 bodyCheck: bodyCheck,
203 }, nil
204 })
205}

Callers 2

initFunction · 0.92
initFunction · 0.92

Calls 3

RegisterFunction · 0.92
DefaultResolverFunction · 0.92
SubloggerMethod · 0.80

Tested by

no test coverage detected