Skip to content

Commit

Permalink
Pull request: doc the Question[0] inspection
Browse files Browse the repository at this point in the history
Merge in DNS/adguard-home from 2465-question-0 to master

Closes AdguardTeam#2465.

Squashed commit of the following:

commit 0dbcaf7
Merge: 0d7c22c 8a1d86a
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Dec 28 19:09:25 2020 +0300

    Merge branch 'master' into 2465-question-0

commit 0d7c22c
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Dec 23 14:17:13 2020 +0300

    dnsforward: doc the Question[0] inspection
  • Loading branch information
EugeneOne1 committed Dec 28, 2020
1 parent 8a1d86a commit 483f02c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions internal/dnsforward/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ func (s *Server) handleDNSRequest(_ *proxy.Proxy, d *proxy.DNSContext) error {
ctx.startTime = time.Now()

type modProcessFunc func(ctx *dnsContext) int

// Since (*dnsforward.Server).handleDNSRequest(...) is used as
// proxy.(Config).RequestHandler, there is no need for additional index
// out of range checking in any of the following functions, because the
// (*proxy.Proxy).handleDNSRequest method performs it before calling the
// appropriate handler.
mods := []modProcessFunc{
processInitial,
processInternalHosts,
Expand Down
3 changes: 2 additions & 1 deletion internal/dnsforward/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (
"github.com/miekg/dns"
)

// Create a DNS response by DNS request and set necessary flags
// makeResponse creates a DNS response by req and sets necessary flags. It also
// guarantees that req.Question will be not empty.
func (s *Server) makeResponse(req *dns.Msg) (resp *dns.Msg) {
resp = &dns.Msg{
MsgHdr: dns.MsgHdr{
Expand Down

0 comments on commit 483f02c

Please sign in to comment.