mirror of
https://github.com/m13253/dns-over-https.git
synced 2026-03-29 22:50:01 +00:00
Workaround a bug causing Unbound to refuse returning anything about the root
This commit is contained in:
@@ -164,6 +164,8 @@ func (s *Server) handlerFunc(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
req = s.patchRootRD(req)
|
||||
|
||||
var err error
|
||||
req, err = s.doDNSQuery(req)
|
||||
if err != nil {
|
||||
@@ -209,6 +211,16 @@ func (s *Server) findClientIP(r *http.Request) net.IP {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Workaround a bug causing Unbound to refuse returning anything about the root
|
||||
func (s *Server) patchRootRD(req *DNSRequest) *DNSRequest {
|
||||
for _, question := range req.request.Question {
|
||||
if question.Name == "." {
|
||||
req.request.RecursionDesired = true
|
||||
}
|
||||
}
|
||||
return req
|
||||
}
|
||||
|
||||
func (s *Server) doDNSQuery(req *DNSRequest) (resp *DNSRequest, err error) {
|
||||
numServers := len(s.conf.Upstream)
|
||||
for i := uint(0); i < s.conf.Tries; i++ {
|
||||
|
||||
Reference in New Issue
Block a user