refactor:使用指定DNS彻底解决DNS缓存导致的问题
This commit is contained in:
12
Util/util.go
12
Util/util.go
@@ -2,13 +2,16 @@ package Util
|
||||
|
||||
import (
|
||||
"Mmx/Global"
|
||||
"context"
|
||||
"crypto/md5"
|
||||
"crypto/sha1"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"os"
|
||||
"regexp"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Search(reg string, content string) (string, error) {
|
||||
@@ -57,3 +60,12 @@ func ErrHandler(err error) {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
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{
|
||||
Timeout: 20 * time.Second,
|
||||
}
|
||||
return d.DialContext(ctx, "udp", "1.2.4.8:53")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user