wust校园网认证登录(web + pppoe拨号)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
canti/app/network/check.go

21 lines
451 B

package network
import (
"canti/app/api"
"github.com/go-resty/resty/v2"
)
const (
TestBaidu = "http://baidu.com"
TestTencent = "http://qq.com"
TestTaobao = "http://taobao.com"
TestSchoolNetwork = api.Host
)
// CheckNetwork 检查网络是否可通
func CheckNetwork(testUrl string) bool {
client := resty.New()
resp, err := client.R().SetHeaders(defaultHeaders).Get(testUrl)
return err != nil && resp.Body() != nil
}