defender: allow to set a different score for "no auth tried" events

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2023-01-25 18:56:37 +01:00
parent 16d908e76b
commit 87820d980b
16 changed files with 151 additions and 45 deletions

View File

@@ -24,6 +24,11 @@ const (
"sftpgo serve -c \"<path to dir containing the default config file and templates directory>\""
)
// errors definitions
var (
ErrNotFound = NewRecordNotFoundError("")
)
// ValidationError raised if input data is not valid
type ValidationError struct {
err string
@@ -55,6 +60,12 @@ func (e *RecordNotFoundError) Error() string {
return fmt.Sprintf("not found: %s", e.err)
}
// Is reports if target matches
func (e *RecordNotFoundError) Is(target error) bool {
_, ok := target.(*RecordNotFoundError)
return ok
}
// NewRecordNotFoundError returns a not found error
func NewRecordNotFoundError(error string) *RecordNotFoundError {
return &RecordNotFoundError{