fix: 携程溢出、优化若干

This commit is contained in:
Mmx
2022-01-11 12:30:32 +08:00
parent a240165eed
commit 8b006e77af
12 changed files with 77 additions and 32 deletions

View File

@@ -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