2024-02-10 18:23:50 +08:00
|
|
|
package pkg
|
2023-04-25 17:33:07 +08:00
|
|
|
|
|
|
|
type ErrorType uint
|
|
|
|
|
|
|
|
const (
|
|
|
|
NoErr ErrorType = iota
|
|
|
|
ErrBadStatus
|
|
|
|
ErrSameStatus
|
|
|
|
ErrRequestFailed
|
|
|
|
ErrWaf
|
|
|
|
ErrRedirect
|
|
|
|
ErrCompareFailed
|
|
|
|
ErrCustomCompareFailed
|
|
|
|
ErrCustomFilter
|
|
|
|
ErrFuzzyCompareFailed
|
|
|
|
ErrFuzzyRedirect
|
|
|
|
ErrFuzzyNotUnique
|
|
|
|
ErrUrlError
|
2024-06-04 16:24:36 +08:00
|
|
|
ErrResponseError
|
2023-04-25 17:33:07 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
var ErrMap = map[ErrorType]string{
|
|
|
|
NoErr: "",
|
|
|
|
ErrBadStatus: "blacklist status",
|
|
|
|
ErrSameStatus: "same status with random baseline",
|
|
|
|
ErrRequestFailed: "request failed",
|
|
|
|
ErrWaf: "maybe banned by waf",
|
|
|
|
ErrRedirect: "duplicate redirect url",
|
|
|
|
ErrCompareFailed: "compare failed",
|
|
|
|
ErrCustomCompareFailed: "custom compare failed",
|
|
|
|
ErrCustomFilter: "custom filtered",
|
|
|
|
ErrFuzzyCompareFailed: "fuzzy compare failed",
|
|
|
|
ErrFuzzyRedirect: "fuzzy redirect",
|
|
|
|
ErrFuzzyNotUnique: "not unique",
|
|
|
|
ErrUrlError: "url parse error",
|
2024-06-04 16:24:36 +08:00
|
|
|
ErrResponseError: "response parse error",
|
2023-04-25 17:33:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e ErrorType) Error() string {
|
|
|
|
return ErrMap[e]
|
|
|
|
}
|