Pull request 2057: dnsforward: imp clientid log
Updates #6371. Squashed commit of the following: commit 0461266a5420c985af6bb0b36a42af54bc62e075 Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Oct 31 21:38:20 2023 +0300 dnsforward: imp clientid log
This commit is contained in:
parent
62ec0d5adc
commit
52713a2600
|
@ -8,6 +8,7 @@ import (
|
||||||
|
|
||||||
"github.com/AdguardTeam/dnsproxy/proxy"
|
"github.com/AdguardTeam/dnsproxy/proxy"
|
||||||
"github.com/AdguardTeam/golibs/errors"
|
"github.com/AdguardTeam/golibs/errors"
|
||||||
|
"github.com/AdguardTeam/golibs/log"
|
||||||
"github.com/AdguardTeam/golibs/netutil"
|
"github.com/AdguardTeam/golibs/netutil"
|
||||||
"github.com/quic-go/quic-go"
|
"github.com/quic-go/quic-go"
|
||||||
)
|
)
|
||||||
|
@ -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
|
// DNS-over-HTTPS requests, it will return the hostname part of the Host header
|
||||||
// if there is one.
|
// if there is one.
|
||||||
func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string, err error) {
|
func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string, err error) {
|
||||||
|
from := "tls conn"
|
||||||
|
|
||||||
switch proto {
|
switch proto {
|
||||||
case proxy.ProtoHTTPS:
|
case proxy.ProtoHTTPS:
|
||||||
r := pctx.HTTPRequest
|
r := pctx.HTTPRequest
|
||||||
|
@ -164,6 +167,7 @@ func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string
|
||||||
}
|
}
|
||||||
|
|
||||||
srvName = host
|
srvName = host
|
||||||
|
from = "host header"
|
||||||
}
|
}
|
||||||
case proxy.ProtoQUIC:
|
case proxy.ProtoQUIC:
|
||||||
qConn := pctx.QUICConnection
|
qConn := pctx.QUICConnection
|
||||||
|
@ -183,5 +187,7 @@ func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string
|
||||||
srvName = tc.ConnectionState().ServerName
|
srvName = tc.ConnectionState().ServerName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Debug("dnsforward: got client server name %q from %s", srvName, from)
|
||||||
|
|
||||||
return srvName, nil
|
return srvName, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue