mirror of
https://github.com/chainreactors/spray.git
synced 2025-05-08 19:47:03 +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/files"
|
||||||
"github.com/chainreactors/logs"
|
"github.com/chainreactors/logs"
|
||||||
"github.com/chainreactors/spray/pkg"
|
"github.com/chainreactors/spray/pkg"
|
||||||
|
"github.com/chainreactors/spray/pkg/ihttp"
|
||||||
"github.com/chainreactors/words/mask"
|
"github.com/chainreactors/words/mask"
|
||||||
"github.com/chainreactors/words/rule"
|
"github.com/chainreactors/words/rule"
|
||||||
"github.com/gosuri/uiprogress"
|
"github.com/gosuri/uiprogress"
|
||||||
@ -163,6 +164,14 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
|
|||||||
r.ErrPeriod = max
|
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 {
|
if opt.Advance {
|
||||||
r.Crawl = true
|
r.Crawl = true
|
||||||
r.Active = true
|
r.Active = true
|
||||||
|
@ -48,6 +48,7 @@ type Runner struct {
|
|||||||
RecuDepth int
|
RecuDepth int
|
||||||
Threads int
|
Threads int
|
||||||
PoolSize int
|
PoolSize int
|
||||||
|
ClientType int
|
||||||
Pools *ants.PoolWithFunc
|
Pools *ants.PoolWithFunc
|
||||||
PoolName map[string]bool
|
PoolName map[string]bool
|
||||||
Timeout int
|
Timeout int
|
||||||
@ -99,11 +100,15 @@ func (r *Runner) PrepareConfig() *pkg.Config {
|
|||||||
Active: r.Active,
|
Active: r.Active,
|
||||||
Bak: r.Bak,
|
Bak: r.Bak,
|
||||||
Common: r.Common,
|
Common: r.Common,
|
||||||
|
ClientType: r.ClientType,
|
||||||
}
|
}
|
||||||
if config.Mod == pkg.PathSpray {
|
|
||||||
config.ClientType = ihttp.FAST
|
if config.ClientType == 0 {
|
||||||
} else if config.Mod == pkg.HostSpray {
|
if config.Mod == pkg.PathSpray {
|
||||||
config.ClientType = ihttp.STANDARD
|
config.ClientType = ihttp.FAST
|
||||||
|
} else if config.Mod == pkg.HostSpray {
|
||||||
|
config.ClientType = ihttp.STANDARD
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,8 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
FAST = iota
|
Auto = iota
|
||||||
|
FAST
|
||||||
STANDARD
|
STANDARD
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user