feat: 支持多网卡模式

This commit is contained in:
Mmx
2021-12-03 19:59:42 +08:00
parent a595de3ed1
commit ddaac2d155
11 changed files with 132 additions and 33 deletions

View File

@@ -2,6 +2,7 @@ package util
import (
"github.com/Mmx233/tool"
"net"
"time"
)
@@ -10,11 +11,12 @@ type checker struct{}
var Checker checker
// NetOk 网络状况检查
func (checker) NetOk(timeout uint) bool {
func (checker) NetOk(timeout uint, localAddr net.Addr) bool {
h, i, e := tool.HTTP.GetReader(&tool.GetRequest{
Url: "https://www.baidu.com/",
Redirect: false,
Timeout: time.Duration(timeout) * time.Second,
Url: "https://www.baidu.com/",
Redirect: false,
Timeout: time.Duration(timeout) * time.Second,
LocalAddr: localAddr,
})
if e != nil {
return false