feat: 调整判断网络状态方式

This commit is contained in:
Mmx
2021-09-19 22:47:53 +08:00
parent bffdadda91
commit 83d020c928
5 changed files with 14 additions and 27 deletions

View File

@@ -1,16 +1,12 @@
package util
import (
"autoLogin/global"
"context"
"crypto/md5"
"crypto/sha1"
"errors"
"fmt"
"io"
"net"
"regexp"
"time"
)
func Search(reg string, content string) (string, error) {
@@ -49,12 +45,3 @@ func Sha1(content string) string {
bs := h.Sum(nil)
return fmt.Sprintf("%x\n", bs)
}
func NetDailEr() func(ctx context.Context, network, address string) (net.Conn, error) {
return func(ctx context.Context, network, address string) (net.Conn, error) {
d := net.Dialer{
Deadline: time.Now().Add(5 * time.Second),
}
return d.DialContext(ctx, "udp", global.Config.Settings.Dns+":53")
}
}