Pull request: doc the Question[0] inspection

Merge in DNS/adguard-home from 2465-question-0 to master

Closes #2465.

Squashed commit of the following:

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

    Merge branch 'master' into 2465-question-0

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

    dnsforward: doc the Question[0] inspection
This commit is contained in:
Eugene Burkov 2020-12-28 19:26:37 +03:00
parent 8a1d86aa7d
commit 483f02c92a
2 changed files with 8 additions and 1 deletions

View File

@ -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,

View File

@ -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{