mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-07-14 05:12:36 +08:00
Update client.go
This commit is contained in:
parent
99d526d7d0
commit
608b2e2c87
@ -6,6 +6,9 @@ import (
|
|||||||
"embed"
|
"embed"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/shadow1ng/fscan/common"
|
||||||
|
"golang.org/x/net/proxy"
|
||||||
|
"gopkg.in/yaml.v2"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
@ -13,10 +16,6 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/shadow1ng/fscan/common"
|
|
||||||
"golang.org/x/net/proxy"
|
|
||||||
"gopkg.in/yaml.v2"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -26,15 +25,15 @@ var (
|
|||||||
keepAlive = 5 * time.Second
|
keepAlive = 5 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
func Inithttp(flags common.Flags) {
|
func Inithttp(PocInfo common.PocInfo) {
|
||||||
//PocInfo.Proxy = "http://127.0.0.1:8080"
|
//PocInfo.Proxy = "http://127.0.0.1:8080"
|
||||||
err := InitHttpClient(flags.PocNum, flags.Proxy, common.Socks5{Address: flags.Socks5Proxy}, time.Duration(flags.WebTimeout)*time.Second)
|
err := InitHttpClient(common.PocNum, common.Proxy, time.Duration(common.WebTimeout)*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitHttpClient(ThreadsNum int, DownProxy string, socks5Proxy common.Socks5, Timeout time.Duration) error {
|
func InitHttpClient(ThreadsNum int, DownProxy string, Timeout time.Duration) error {
|
||||||
type DialContext = func(ctx context.Context, network, addr string) (net.Conn, error)
|
type DialContext = func(ctx context.Context, network, addr string) (net.Conn, error)
|
||||||
dialer := &net.Dialer{
|
dialer := &net.Dialer{
|
||||||
Timeout: dialTimout,
|
Timeout: dialTimout,
|
||||||
@ -47,13 +46,13 @@ func InitHttpClient(ThreadsNum int, DownProxy string, socks5Proxy common.Socks5,
|
|||||||
MaxIdleConns: 0,
|
MaxIdleConns: 0,
|
||||||
MaxIdleConnsPerHost: ThreadsNum * 2,
|
MaxIdleConnsPerHost: ThreadsNum * 2,
|
||||||
IdleConnTimeout: keepAlive,
|
IdleConnTimeout: keepAlive,
|
||||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
TLSClientConfig: &tls.Config{MinVersion: tls.VersionTLS10, InsecureSkipVerify: true},
|
||||||
TLSHandshakeTimeout: 5 * time.Second,
|
TLSHandshakeTimeout: 5 * time.Second,
|
||||||
DisableKeepAlives: false,
|
DisableKeepAlives: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
if socks5Proxy.Address != "" {
|
if common.Socks5Proxy != "" {
|
||||||
dialSocksProxy, err := common.Socks5Dailer(dialer, socks5Proxy)
|
dialSocksProxy, err := common.Socks5Dailer(dialer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user