Pull request: * dnsforward, querylog: set client_proto for logs correctly

Merge in DNS/adguard-home from 2241-doq-logs to master

Squashed commit of the following:

commit a15cab05358e3c0b97f8257f8b9628fa590e7e7d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Nov 3 14:22:25 2020 +0300

    * all: update dnsproxy

commit 5fb0919a7528dc6ee7a433a8096b550f3691771c
Merge: b22b1dff4 64c1a68fb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Nov 3 14:22:15 2020 +0300

    Merge branch 'master' into 2241-doq-logs

commit b22b1dff43e541d77160fd5c234483bbf0f6d8de
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Nov 3 12:37:23 2020 +0300

    * dnsforward, querylog: set client_proto for logs correctly
This commit is contained in:
Ainar Garipov
2020-11-03 15:39:55 +03:00
parent 64c1a68fb9
commit df34ee5c09
9 changed files with 108 additions and 45 deletions

View File

@@ -5,12 +5,11 @@ import (
"strings"
"time"
"github.com/AdguardTeam/AdGuardHome/internal/querylog"
"github.com/miekg/dns"
"github.com/AdguardTeam/AdGuardHome/internal/dnsfilter"
"github.com/AdguardTeam/AdGuardHome/internal/querylog"
"github.com/AdguardTeam/AdGuardHome/internal/stats"
"github.com/AdguardTeam/dnsproxy/proxy"
"github.com/miekg/dns"
)
// Write Stats data and logs
@@ -40,10 +39,16 @@ func processQueryLogsAndStats(ctx *dnsContext) int {
ClientIP: getIP(d.Addr),
}
if d.Proto == "https" {
p.ClientProto = "doh"
} else if d.Proto == "tls" {
p.ClientProto = "dot"
switch d.Proto {
case proxy.ProtoHTTPS:
p.ClientProto = querylog.ClientProtoDOH
case proxy.ProtoQUIC:
p.ClientProto = querylog.ClientProtoDOQ
case proxy.ProtoTLS:
p.ClientProto = querylog.ClientProtoDOT
default:
// Consider this a plain DNS-over-UDP or DNS-over-TCL
// request.
}
if d.Upstream != nil {