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)
| 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. |
| 189 | func 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 | } |
no test coverage detected