dns

DNS client and server implementations using the Go project's dnsmessage package
Log | Files | Refs | README | LICENSE

commit 590fd1b7ff6f75bd5afaea2e2db06d8063841c17
parent b141f1193309066d69c8a1759da0d6cf4d6d60b7
Author: Oliver Lowe <o@olowe.co>
Date:   Sat, 18 Dec 2021 15:08:54 +1100

cmd/recursor: comments on caching records

With an explanation of why we lookup before we insert into the cache

Diffstat:
Mcmd/recursor/resolve.go | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/cmd/recursor/resolve.go b/cmd/recursor/resolve.go @@ -88,6 +88,8 @@ func resolve(q dnsmessage.Question, next []net.IP, depth int) (dnsmessage.Messag } fmt.Println("no auth answer") + // cache resource records from authorities, additionals sections if we + // don't have them already (i.e. from authoritative answers) if len(rmsg.Authorities) > 0 { if _, ok := lookup(rmsg.Authorities[0].Header.Name, rmsg.Authorities[0].Header.Type); !ok { insert(rmsg.Authorities[0].Header.Name, rmsg.Authorities[0].Header.Type, rmsg.Authorities)