修复代理为空时的报错bug

This commit is contained in:
M09Ic 2024-02-07 01:54:31 +08:00
parent f35a07050e
commit 2222b49632
2 changed files with 8 additions and 5 deletions

View File

@ -241,13 +241,10 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
if len(opt.AppendRule) > 0 {
s.WriteString("file bak enable; ")
}
if s.Len() > 0 {
logs.Log.Important("Advance Mod: " + s.String())
}
if r.RetryCount > 0 {
logs.Log.Important("Retry Count: " + strconv.Itoa(r.RetryCount))
s.WriteString("Retry Count: " + strconv.Itoa(r.RetryCount))
}
logs.Log.Important(s.String())
if opt.NoScope {
r.Scope = []string{"*"}
@ -301,6 +298,7 @@ func (opt *Option) PrepareRunner() (*Runner, error) {
opt.Word = "{@prefix}" + opt.Word
}
// 类似dirsearch中的
if opt.Extensions != "" {
exts := strings.Split(opt.Extensions, ",")
for i, e := range exts {

View File

@ -118,6 +118,11 @@ func (c *Client) Do(ctx context.Context, req *Request) (*Response, error) {
}
func customDialFunc(proxyAddr string, timeout time.Duration) fasthttp.DialFunc {
if proxyAddr == "" {
return func(addr string) (net.Conn, error) {
return fasthttp.DialTimeout(addr, timeout)
}
}
u, err := url.Parse(proxyAddr)
if err != nil {
logs.Log.Error(err.Error())