Skip to content

Commit

Permalink
all: fix race
Browse files Browse the repository at this point in the history
  • Loading branch information
schzhn committed Dec 20, 2024
1 parent f901a5f commit c222940
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build

'env':
'GO_VERSION': '1.23.3'
'GO_VERSION': '1.23.4'

'on':
'push':
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'name': Docker

'env':
'GO_VERSION': '1.23.3'
'GO_VERSION': '1.23.4'

'on':
'push':
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'name': 'lint'

'env':
'GO_VERSION': '1.23.3'
'GO_VERSION': '1.23.4'

'on':
'push':
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ BRANCH = $${BRANCH:-$$(git rev-parse --abbrev-ref HEAD)}
DIST_DIR = build
GOAMD64 = v1
GOPROXY = https://proxy.golang.org|direct
GOTOOLCHAIN = go1.23.3
GOTOOLCHAIN = go1.23.4
GOTELEMETRY = off
OUT = dnsproxy
RACE = 0
Expand Down
2 changes: 1 addition & 1 deletion bamboo-specs/bamboo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# exact patch version as opposed to a minor one to make sure that this exact
# version is actually used and not whatever the docker daemon on the CI has
# cached a few months ago.
'dockerGo': 'golang:1.23.3'
'dockerGo': 'golang:1.23.4'
'maintainer': 'Adguard Go Team'
'name': 'dnsproxy'

Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/AdguardTeam/dnsproxy

go 1.23.3
go 1.23.4

require (
github.com/AdguardTeam/golibs v0.30.2
Expand All @@ -10,7 +10,7 @@ require (
github.com/bluele/gcache v0.0.2
github.com/miekg/dns v1.1.58
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/quic-go/quic-go v0.44.0
github.com/quic-go/quic-go v0.48.2
github.com/stretchr/testify v1.9.0
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c
golang.org/x/net v0.30.0
Expand All @@ -28,7 +28,7 @@ require (
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/onsi/ginkgo/v2 v2.15.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qpack v0.5.1 // indirect
go.uber.org/mock v0.4.0 // indirect
golang.org/x/crypto v0.28.0 // indirect
golang.org/x/mod v0.21.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaR
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A=
github.com/quic-go/quic-go v0.44.0 h1:So5wOr7jyO4vzL2sd8/pD9Kesciv91zSk8BoFngItQ0=
github.com/quic-go/quic-go v0.44.0/go.mod h1:z4cx/9Ny9UtGITIPzmPTXh1ULfOyWh4qGQlpnPcWmek=
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
github.com/quic-go/quic-go v0.48.2 h1:wsKXZPeGWpMpCGSWqOcqpW2wZYic/8T3aqiOID0/KWE=
github.com/quic-go/quic-go v0.48.2/go.mod h1:yBgs3rWBOADpga7F+jJsb6Ybg1LSYiQvwWlLX+/6HMs=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
Expand All @@ -72,8 +72,8 @@ golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
gonum.org/v1/gonum v0.14.0 h1:2NiG67LD1tEH0D7kM+ps2V+fXmsAnpUeec7n8tcr4S0=
gonum.org/v1/gonum v0.14.0/go.mod h1:AoWeoz0becf9QMWtE8iWXNXc27fK4fNeHNf/oMejGfU=
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
2 changes: 1 addition & 1 deletion internal/tools/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/AdguardTeam/dnsproxy/internal/tools

go 1.23.3
go 1.23.4

require (
github.com/fzipp/gocyclo v0.6.0
Expand Down
4 changes: 2 additions & 2 deletions proxy/server_https_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ func sendTestDoHMessage(
}

method := http.MethodGet
if _, ok := client.Transport.(*http3.RoundTripper); ok {
if _, ok := client.Transport.(*http3.Transport); ok {
// If we're using HTTP/3, use http3.MethodGet0RTT to force using 0-RTT.
method = http3.MethodGet0RTT
}
Expand Down Expand Up @@ -432,7 +432,7 @@ func createTestHTTPClient(dnsProxy *Proxy, caPem []byte, http3Enabled bool) (cli
if http3Enabled {
tlsClientConfig.NextProtos = []string{"h3"}

transport = &http3.RoundTripper{
transport = &http3.Transport{
Dial: func(
ctx context.Context,
_ string,
Expand Down
16 changes: 8 additions & 8 deletions upstream/doh.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,12 +490,12 @@ func (p *dnsOverHTTPS) createTransport() (t http.RoundTripper, err error) {
return transport, nil
}

// http3Transport is a wrapper over *http3.RoundTripper that tries to optimize
// http3Transport is a wrapper over [*http3.Transport] that tries to optimize
// its behavior. The main thing that it does is trying to force use a single
// connection to a host instead of creating a new one all the time. It also
// helps mitigate race issues with quic-go.
type http3Transport struct {
baseTransport *http3.RoundTripper
baseTransport *http3.Transport

closed bool
mu sync.RWMutex
Expand Down Expand Up @@ -537,11 +537,11 @@ func (h *http3Transport) Close() (err error) {
return h.baseTransport.Close()
}

// createTransportH3 tries to create an HTTP/3 transport for this upstream.
// We should be able to fall back to H1/H2 in case if HTTP/3 is unavailable or
// if it is too slow. In order to do that, this method will run two probes
// in parallel (one for TLS, the other one for QUIC) and if QUIC is faster it
// will create the *http3.RoundTripper instance.
// createTransportH3 tries to create an HTTP/3 transport for this upstream. We
// should be able to fall back to H1/H2 in case if HTTP/3 is unavailable or if
// it is too slow. In order to do that, this method will run two probes in
// parallel (one for TLS, the other one for QUIC) and if QUIC is faster it will
// create the [*http3.Transport] instance.
func (p *dnsOverHTTPS) createTransportH3(
tlsConfig *tls.Config,
dialContext bootstrap.DialHandler,
Expand All @@ -555,7 +555,7 @@ func (p *dnsOverHTTPS) createTransportH3(
return nil, err
}

rt := &http3.RoundTripper{
rt := &http3.Transport{
Dial: func(
ctx context.Context,

Expand Down
3 changes: 3 additions & 0 deletions upstream/plain.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ func isExpectedConnErr(err error) (is bool) {

// Exchange implements the [Upstream] interface for *plainDNS.
func (p *plainDNS) Exchange(req *dns.Msg) (resp *dns.Msg, err error) {
// TODO(e.burkov): Use some smarter cloning approach.
req = req.Copy()

dial, err := p.getDialer()
if err != nil {
// Don't wrap the error since it's informative enough as is.
Expand Down

0 comments on commit c222940

Please sign in to comment.