general: use builtin dns as resolver when dns enabled

This commit is contained in:
nadoo committed 2020-09-13 15:25:57 +08:00
1 parent 851fc46104
commit 0e89d1879f
7 files changed
+24 -13

No files matched your search

+8
View File
@@ -1,8 +1,10 @@
package main
import (
"context"
"fmt"
stdlog "log"
"net"
"os"
"os/signal"
"syscall"
@@ -76,6 +78,12 @@ func main() {
}
d.Start()
net.DefaultResolver.PreferGo = true
net.DefaultResolver.Dial = func(ctx context.Context, network, address string) (net.Conn, error) {
d := net.Dialer{}
return d.DialContext(ctx, "udp", conf.DNS)
}
}
// enable checkers