diff --git a/dns/client.go b/dns/client.go index 1d68dc70..1dcaae82 100644 --- a/dns/client.go +++ b/dns/client.go @@ -234,6 +234,7 @@ func transform(servers []NameServer) []*nameserver { TLSConfig: &tls.Config{ ClientSessionCache: globalSessionCache, }, + UDPSize: 4096, }, Address: s.Addr, }) diff --git a/dns/server.go b/dns/server.go index 2ece2e97..9db92d78 100644 --- a/dns/server.go +++ b/dns/server.go @@ -1,8 +1,10 @@ package dns import ( + "fmt" "net" + "github.com/Dreamacro/clash/log" D "github.com/miekg/dns" ) @@ -20,6 +22,11 @@ func (s *Server) ServeDNS(w D.ResponseWriter, r *D.Msg) { msg, err := s.r.Exchange(r) if err != nil { + if len(r.Question) > 0 { + q := r.Question[0] + qString := fmt.Sprintf("%s %s %s", q.Name, D.Class(q.Qclass).String(), D.Type(q.Qtype).String()) + log.Debugln("[DNS Server] Exchange %s failed: %v", qString, err) + } D.HandleFailed(w, r) return }