mirror of
https://github.com/chainreactors/spray.git
synced 2025-05-06 18:51:22 +00:00
实装-c参数, 可以自定义client
This commit is contained in:
parent
171786c51e
commit
033f3acdd7
@ -6,6 +6,7 @@ import (
|
||||
"github.com/chainreactors/files"
|
||||
"github.com/chainreactors/logs"
|
||||
"github.com/chainreactors/spray/pkg"
|
||||
"github.com/chainreactors/spray/pkg/ihttp"
|
||||
"github.com/chainreactors/words/mask"
|
||||
"github.com/chainreactors/words/rule"
|
||||
"github.com/gosuri/uiprogress"
|
||||
@ -163,6 +164,14 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
|
||||
r.ErrPeriod = max
|
||||
}
|
||||
|
||||
if opt.Client == "auto" {
|
||||
r.ClientType = ihttp.Auto
|
||||
} else if opt.Client == "fast" {
|
||||
r.ClientType = ihttp.FAST
|
||||
} else if opt.Client == "standard" {
|
||||
r.ClientType = ihttp.STANDARD
|
||||
}
|
||||
|
||||
if opt.Advance {
|
||||
r.Crawl = true
|
||||
r.Active = true
|
||||
|
@ -48,6 +48,7 @@ type Runner struct {
|
||||
RecuDepth int
|
||||
Threads int
|
||||
PoolSize int
|
||||
ClientType int
|
||||
Pools *ants.PoolWithFunc
|
||||
PoolName map[string]bool
|
||||
Timeout int
|
||||
@ -99,11 +100,15 @@ func (r *Runner) PrepareConfig() *pkg.Config {
|
||||
Active: r.Active,
|
||||
Bak: r.Bak,
|
||||
Common: r.Common,
|
||||
ClientType: r.ClientType,
|
||||
}
|
||||
if config.Mod == pkg.PathSpray {
|
||||
config.ClientType = ihttp.FAST
|
||||
} else if config.Mod == pkg.HostSpray {
|
||||
config.ClientType = ihttp.STANDARD
|
||||
|
||||
if config.ClientType == 0 {
|
||||
if config.Mod == pkg.PathSpray {
|
||||
config.ClientType = ihttp.FAST
|
||||
} else if config.Mod == pkg.HostSpray {
|
||||
config.ClientType = ihttp.STANDARD
|
||||
}
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
@ -14,7 +14,8 @@ var (
|
||||
)
|
||||
|
||||
const (
|
||||
FAST = iota
|
||||
Auto = iota
|
||||
FAST
|
||||
STANDARD
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user