misc update

This commit is contained in:
M09Ic 2022-10-19 16:38:23 +08:00
parent 39dab7b18c
commit 029a83faa8
3 changed files with 20 additions and 22 deletions

1
go.mod
View File

@ -15,7 +15,6 @@ require (
require (
github.com/gosuri/uiprogress v0.0.1
github.com/jessevdk/go-flags v1.5.0
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475
github.com/valyala/fasthttp v1.40.0
)

View File

@ -59,10 +59,10 @@ func NewPool(ctx context.Context, config *pkg.Config, outputCh chan *baseline) (
defer fasthttp.ReleaseResponse(resp)
defer fasthttp.ReleaseRequest(req)
if reqerr != nil && reqerr != fasthttp.ErrBodyTooLarge {
pool.errorCount++
pool.failedCount++
bl = &baseline{UrlString: pool.BaseURL + unit.path, Err: reqerr}
} else {
pool.errorCount = 0
pool.failedCount = 0
if err = pool.PreCompare(resp); err == nil || unit.source == CheckSource {
// 通过预对比跳过一些无用数据, 减少性能消耗
bl = NewBaseline(req.URI(), resp)
@ -96,7 +96,7 @@ func NewPool(ctx context.Context, config *pkg.Config, outputCh chan *baseline) (
go pool.check()
}
}
//todo connectivity check
pool.bar.Done()
pool.wg.Done()
})
@ -118,7 +118,6 @@ type Pool struct {
outputCh chan *baseline // 输出的chan, 全局统一
tempCh chan *baseline // 待处理的baseline
reqCount int
errorCount int
failedCount int
checkPeriod int
errPeriod int
@ -251,20 +250,3 @@ func (p *Pool) buildHostRequest(host string) (*fasthttp.Request, error) {
req.SetHost(host)
return req, nil
}
type sourceType int
const (
CheckSource sourceType = iota + 1
WordSource
WafSource
)
func newUnit(path string, source sourceType) *Unit {
return &Unit{path: path, source: source}
}
type Unit struct {
path string
source sourceType
}

View File

@ -20,3 +20,20 @@ func (e ErrorType) Error() string {
return "unknown error"
}
}
type sourceType int
const (
CheckSource sourceType = iota + 1
WordSource
WafSource
)
func newUnit(path string, source sourceType) *Unit {
return &Unit{path: path, source: source}
}
type Unit struct {
path string
source sourceType
}