feature:支持使用配置文件,增加网络检查
1、从Config.json读取配置 2、网络正常时跳过登录
This commit is contained in:
20
Util/checker.go
Normal file
20
Util/checker.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package Util
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
)
|
||||
|
||||
type checker struct{}
|
||||
|
||||
var Checker checker
|
||||
|
||||
func (checker) NetOk() bool {
|
||||
if ip, err := net.LookupIP("www.msftconnecttest.com"); err != nil {
|
||||
fmt.Println("a")
|
||||
return false
|
||||
} else if len(ip) == 0 || ip[0].String() != "13.107.4.52" {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user