diff --git a/app/dns/nameserver_doh.go b/app/dns/nameserver_doh.go index 81e5561d..92ced968 100644 --- a/app/dns/nameserver_doh.go +++ b/app/dns/nameserver_doh.go @@ -371,9 +371,9 @@ func (s *DoHNameServer) QueryIP(ctx context.Context, domain string, clientIP net } else { ips, err := s.findIPsForDomain(fqdn, option) if err != errRecordNotFound { - if cs == CacheStrategy_Cache_NOERROR && err == nil { + if cs == CacheStrategy_Cache_ALL || (cs == CacheStrategy_Cache_NOERROR && err == nil) { newError(s.name, " cache HIT ", domain, " -> ", ips).Base(err).AtDebug().WriteToLog() - log.Record(&log.DNSLog{s.name, domain, ips, log.DNSCacheHit, 0, err}) + log.Record(&log.DNSLog{Server: s.name, Domain: domain, Result: ips, Status: log.DNSCacheHit, Error: err}) return ips, err } } diff --git a/app/dns/nameserver_quic.go b/app/dns/nameserver_quic.go index f7f08927..1ad7fd58 100644 --- a/app/dns/nameserver_quic.go +++ b/app/dns/nameserver_quic.go @@ -276,9 +276,9 @@ func (s *QUICNameServer) QueryIP(ctx context.Context, domain string, clientIP ne } else { ips, err := s.findIPsForDomain(fqdn, option) if err != errRecordNotFound { - if cs == CacheStrategy_Cache_NOERROR && err == nil { + if cs == CacheStrategy_Cache_ALL || (cs == CacheStrategy_Cache_NOERROR && err == nil) { newError(s.name, " cache HIT ", domain, " -> ", ips).Base(err).AtDebug().WriteToLog() - log.Record(&log.DNSLog{s.name, domain, ips, log.DNSCacheHit, 0, err}) + log.Record(&log.DNSLog{Server: s.name, Domain: domain, Result: ips, Status: log.DNSCacheHit, Error: err}) return ips, err } } diff --git a/app/dns/nameserver_udp.go b/app/dns/nameserver_udp.go index fa6327c5..20dc06d8 100644 --- a/app/dns/nameserver_udp.go +++ b/app/dns/nameserver_udp.go @@ -253,9 +253,9 @@ func (s *ClassicNameServer) QueryIP(ctx context.Context, domain string, clientIP } else { ips, err := s.findIPsForDomain(fqdn, option) if err != errRecordNotFound { - if cs == CacheStrategy_Cache_NOERROR && err == nil { + if cs == CacheStrategy_Cache_ALL || (cs == CacheStrategy_Cache_NOERROR && err == nil) { newError(s.name, " cache HIT ", domain, " -> ", ips).Base(err).AtDebug().WriteToLog() - log.Record(&log.DNSLog{s.name, domain, ips, log.DNSCacheHit, 0, err}) + log.Record(&log.DNSLog{Server: s.name, Domain: domain, Result: ips, Status: log.DNSCacheHit, Error: err}) return ips, err } }