debug logs DOH response headers

pull/30/head v0.4.1
Ian Bashford 2021-08-10 22:03:29 +01:00 committed by Karan Sharma
parent ddbf40de9a
commit 3d7b4a9821
1 changed files with 8 additions and 0 deletions

View File

@ -80,6 +80,14 @@ func (r *DOHResolver) Lookup(question dns.Question) (Response, error) {
return rsp, fmt.Errorf("error from nameserver %s", resp.Status)
}
rtt := time.Since(now)
// if debug, extract the response headers
if r.resolverOptions.Logger.IsLevelEnabled(logrus.DebugLevel) {
for header, value := range resp.Header {
r.resolverOptions.Logger.WithFields(logrus.Fields{
header: value,
}).Debug("DOH response header")
}
}
// extract the binary response in DNS Message.
body, err := ioutil.ReadAll(resp.Body)
if err != nil {