2022-09-15 19:27:07 +08:00
|
|
|
package internal
|
|
|
|
|
|
|
|
type ErrorType uint
|
|
|
|
|
|
|
|
const (
|
|
|
|
ErrBadStatus ErrorType = iota
|
2022-11-10 21:03:07 +08:00
|
|
|
ErrSameStatus
|
|
|
|
ErrRequestFailed
|
2022-09-15 19:27:07 +08:00
|
|
|
ErrWaf
|
|
|
|
ErrRedirect
|
|
|
|
)
|
|
|
|
|
|
|
|
func (e ErrorType) Error() string {
|
|
|
|
switch e {
|
|
|
|
case ErrBadStatus:
|
|
|
|
return "bad status"
|
2022-11-10 21:03:07 +08:00
|
|
|
case ErrSameStatus:
|
|
|
|
return "same status"
|
|
|
|
case ErrRequestFailed:
|
|
|
|
return "request failed"
|
2022-09-15 19:27:07 +08:00
|
|
|
case ErrWaf:
|
|
|
|
return "maybe ban of waf"
|
|
|
|
case ErrRedirect:
|
|
|
|
return "duplicate redirect url"
|
|
|
|
default:
|
|
|
|
return "unknown error"
|
|
|
|
}
|
|
|
|
}
|
2022-10-19 16:38:23 +08:00
|
|
|
|
|
|
|
type sourceType int
|
|
|
|
|
|
|
|
const (
|
|
|
|
CheckSource sourceType = iota + 1
|
2022-10-27 23:40:15 +08:00
|
|
|
InitSource
|
2022-10-19 16:38:23 +08:00
|
|
|
WordSource
|
|
|
|
WafSource
|
|
|
|
)
|
|
|
|
|
|
|
|
func newUnit(path string, source sourceType) *Unit {
|
|
|
|
return &Unit{path: path, source: source}
|
|
|
|
}
|
|
|
|
|
|
|
|
type Unit struct {
|
|
|
|
path string
|
|
|
|
source sourceType
|
|
|
|
}
|