Skip to content

Commit

Permalink
Pull request 2057: dnsforward: imp clientid log
Browse files Browse the repository at this point in the history
Updates #6371.

Squashed commit of the following:

commit 0461266
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Oct 31 21:38:20 2023 +0300

    dnsforward: imp clientid log
  • Loading branch information
ainar-g committed Nov 1, 2023
1 parent 62ec0d5 commit 52713a2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/dnsforward/clientid.go
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/AdguardTeam/dnsproxy/proxy"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/netutil"
"github.com/quic-go/quic-go"
)
Expand Down Expand Up @@ -151,6 +152,8 @@ func (s *Server) clientIDFromDNSContext(pctx *proxy.DNSContext) (clientID string
// DNS-over-HTTPS requests, it will return the hostname part of the Host header
// if there is one.
func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string, err error) {
from := "tls conn"

switch proto {
case proxy.ProtoHTTPS:
r := pctx.HTTPRequest
Expand All @@ -164,6 +167,7 @@ func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string
}

srvName = host
from = "host header"
}
case proxy.ProtoQUIC:
qConn := pctx.QUICConnection
Expand All @@ -183,5 +187,7 @@ func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string
srvName = tc.ConnectionState().ServerName
}

log.Debug("dnsforward: got client server name %q from %s", srvName, from)

return srvName, nil
}

0 comments on commit 52713a2

Please sign in to comment.