fix: 携程溢出、优化若干
This commit is contained in:
@@ -2,8 +2,7 @@ package util
|
||||
|
||||
import (
|
||||
"github.com/Mmx233/tool"
|
||||
"net"
|
||||
"time"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type checker struct{}
|
||||
@@ -11,12 +10,12 @@ type checker struct{}
|
||||
var Checker checker
|
||||
|
||||
// NetOk 网络状况检查
|
||||
func (checker) NetOk(timeout uint, localAddr net.Addr) bool {
|
||||
func (a *checker) NetOk(transport *http.Transport) bool {
|
||||
|
||||
h, i, e := tool.HTTP.GetReader(&tool.GetRequest{
|
||||
Url: "https://www.baidu.com/",
|
||||
Redirect: false,
|
||||
Timeout: time.Duration(timeout) * time.Second,
|
||||
LocalAddr: localAddr,
|
||||
Transport: transport,
|
||||
})
|
||||
if e != nil {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user