mox/store/validation.go

25 lines
595 B
Go
Raw Permalink Normal View History

2023-01-30 16:27:06 +03:00
package store
import (
"github.com/mjl-/mox/spf"
)
var spfValidations = map[spf.Status]Validation{
spf.StatusNone: ValidationNone,
spf.StatusNeutral: ValidationNeutral,
spf.StatusPass: ValidationPass,
spf.StatusFail: ValidationFail,
spf.StatusSoftfail: ValidationSoftfail,
spf.StatusTemperror: ValidationTemperror,
spf.StatusPermerror: ValidationPermerror,
}
// SPFValidation returns a Validation for an spf.Status.
func SPFValidation(status spf.Status) Validation {
v, ok := spfValidations[status]
if !ok {
panic("missing spf status validation")
}
return v
}