Skip to content

Commit

Permalink
debug logs DOH response headers
Browse files Browse the repository at this point in the history
  • Loading branch information
ianbashford authored and mr-karan committed Aug 11, 2021
1 parent ddbf40d commit 3d7b4a9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/resolvers/doh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3d7b4a9

Please sign in to comment.