Pull request 1729: upd-go

Merge in DNS/adguard-home from upd-go to master

Squashed commit of the following:

commit 0e13d6863a3d463289823a27414b427cb76be88c
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Feb 7 20:20:14 2023 +0300

    scripts: try increasing test timeout

commit 8e7d230e40de8f49a2b74a6d32a7fc78a361edab
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Feb 7 20:00:17 2023 +0300

    all: upd quic-go; imp atomic values

commit fae2b75b6990f2bd77e5c019a35a72322bac85f7
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Feb 7 17:36:33 2023 +0300

    all: upd go, deps; imp atomic values
This commit is contained in:
Ainar Garipov
2023-02-08 13:39:04 +03:00
parent 4baa6e6990
commit 137d280032
22 changed files with 108 additions and 198 deletions

View File

@@ -9,7 +9,7 @@ import (
"github.com/AdguardTeam/dnsproxy/proxy"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/netutil"
"github.com/lucas-clemente/quic-go"
"github.com/quic-go/quic-go"
)
// ValidateClientID returns an error if id is not a valid ClientID.
@@ -151,25 +151,7 @@ func (s *Server) clientIDFromDNSContext(pctx *proxy.DNSContext) (clientID string
func clientServerName(pctx *proxy.DNSContext, proto proxy.Proto) (srvName string, err error) {
switch proto {
case proxy.ProtoHTTPS:
// github.com/lucas-clemente/quic-go seems to not populate the TLS
// field. So, if the request comes over HTTP/3, use the Host header
// value as the server name.
//
// See https://github.com/lucas-clemente/quic-go/issues/2879.
//
// TODO(a.garipov): Remove this crutch once they fix it.
r := pctx.HTTPRequest
if r.ProtoAtLeast(3, 0) {
var host string
host, err = netutil.SplitHost(r.Host)
if err != nil {
return "", fmt.Errorf("parsing host: %w", err)
}
srvName = host
} else if connState := r.TLS; connState != nil {
srvName = r.TLS.ServerName
}
srvName = pctx.HTTPRequest.TLS.ServerName
case proxy.ProtoQUIC:
qConn := pctx.QUICConnection
conn, ok := qConn.(quicConnection)