Move some Resolver information to ResolverInfo and propagate it

This commit is contained in:
Daniel 2021-03-20 22:19:27 +01:00
parent 43cfba8445
commit 20383226f8
13 changed files with 275 additions and 180 deletions

View file

@ -72,22 +72,20 @@ func (pr *PlainResolver) Query(ctx context.Context, q *Query) (*RRCache, error)
// check if blocked
if pr.resolver.IsBlockedUpstream(reply) {
return nil, &BlockedUpstreamError{pr.resolver.GetName()}
return nil, &BlockedUpstreamError{pr.resolver.Info.DescriptiveName()}
}
// hint network environment at successful connection
netenv.ReportSuccessfulConnection()
newRecord := &RRCache{
Domain: q.FQDN,
Question: q.QType,
RCode: reply.Rcode,
Answer: reply.Answer,
Ns: reply.Ns,
Extra: reply.Extra,
Server: pr.resolver.Server,
ServerScope: pr.resolver.ServerIPScope,
ServerInfo: pr.resolver.ServerInfo,
Domain: q.FQDN,
Question: q.QType,
RCode: reply.Rcode,
Answer: reply.Answer,
Ns: reply.Ns,
Extra: reply.Extra,
Resolver: pr.resolver.Info.Copy(),
}
// TODO: check if reply.Answer is valid