Use separate DNSRequestContext struct for adding DNS context to connections

This commit is contained in:
Daniel
2021-10-19 10:25:49 +02:00
parent 49767d4c4a
commit b9b33ed2b3
6 changed files with 59 additions and 42 deletions

View File

@@ -145,7 +145,7 @@ type Connection struct { //nolint:maligned // TODO: fix alignment
ProcessContext ProcessContext
// DNSContext holds additional information about the DNS request that was
// probably used to resolve the IP of this connection.
DNSContext *resolver.RRCache
DNSContext *resolver.DNSRequestContext
// TunnelContext holds additional information about the tunnel that this
// connection is using.
TunnelContext interface{}
@@ -333,7 +333,7 @@ func NewConnectionFromFirstPacket(pkt packet.Packet) *Connection {
var scope string
var resolverInfo *resolver.ResolverInfo
var dnsContext *resolver.RRCache
var dnsContext *resolver.DNSRequestContext
if inbound {
@@ -365,7 +365,7 @@ func NewConnectionFromFirstPacket(pkt packet.Packet) *Connection {
scope = lastResolvedDomain.Domain
entity.Domain = lastResolvedDomain.Domain
entity.CNAME = lastResolvedDomain.CNAMEs
dnsContext = lastResolvedDomain.RRCache
dnsContext = lastResolvedDomain.DNSRequestContext
resolverInfo = lastResolvedDomain.Resolver
removeOpenDNSRequest(proc.Pid, lastResolvedDomain.Domain)
}