Skip to content

Commit

Permalink
quic: update quic-go to v0.37.5 (#2497)
Browse files Browse the repository at this point in the history
* Small changes for new quic-go API

* Update quic-go dependency

* Manually bump Go version in go-test

* Don't run examples in Go 1.21 yet

Revert this commit when we release a new go-libp2p version compatible
with Go 1.21

* update quic-go to v0.37.5

---------

Co-authored-by: Marco Munizaga <git@marcopolo.io>
  • Loading branch information
marten-seemann and MarcoPolo committed Aug 17, 2023
1 parent 2398ba4 commit d2398ee
Show file tree
Hide file tree
Showing 57 changed files with 144 additions and 40 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu", "windows", "macos" ]
go: ["1.19.x","1.20.x"]
os: ["ubuntu", "windows", "macos"]
go: ["1.20.x", "1.21.x"]
env:
COVERAGES: ""
runs-on: ${{ fromJSON(vars[format('UCI_GO_TEST_RUNNER_{0}', matrix.os)] || format('"{0}-latest"', matrix.os)) }}
Expand Down
2 changes: 2 additions & 0 deletions examples/chat-with-mdns/flags.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/chat-with-mdns/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/chat-with-mdns/mdns.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/chat-with-rendezvous/chat.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/chat-with-rendezvous/flags.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/chat/chat.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

/*
*
* The MIT License (MIT)
Expand Down
2 changes: 2 additions & 0 deletions examples/chat/chat_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/echo/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/echo/main_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
8 changes: 8 additions & 0 deletions examples/go_121_workaround_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build go1.21

package main

import "testing"

// Needed so that we run at least one test in Go 1.21 so that our go test command exits successfully
func TestNothing(t *testing.T) {}
2 changes: 2 additions & 0 deletions examples/http-proxy/proxy.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/ipfs-camp-2019/01-Transports/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/ipfs-camp-2019/02-Multiaddrs/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/ipfs-camp-2019/03-Muxing-Encryption/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/ipfs-camp-2019/05-Discovery/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/ipfs-camp-2019/05-Discovery/protocol.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/ipfs-camp-2019/06-Pubsub/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/ipfs-camp-2019/06-Pubsub/protocol.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/ipfs-camp-2019/07-Messaging/chat.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions examples/ipfs-camp-2019/07-Messaging/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/ipfs-camp-2019/07-Messaging/protocol.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/ipfs-camp-2019/07-Messaging/pubsub.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/ipfs-camp-2019/08-End/chat.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions examples/ipfs-camp-2019/08-End/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/ipfs-camp-2019/08-End/protocol.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/ipfs-camp-2019/08-End/pubsub.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
8 changes: 8 additions & 0 deletions examples/ipfs-camp-2019/go_121_workaround_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build go1.21

package main

import "testing"

// Needed so that we run at least one test in Go 1.21 so that our go test command exits successfully
func TestNothing(t *testing.T) {}
2 changes: 2 additions & 0 deletions examples/libp2p-host/host.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/libp2p-host/host_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/metrics-and-dashboards/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/multipro/echo.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/multipro/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/multipro/main_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/multipro/node.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/multipro/pb/p2p.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions examples/multipro/ping.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build go1.21

package main

import "testing"

// Needed so that we run at least one test in Go 1.21 so that our go test command exits successfully
func TestNothing(t *testing.T) {}
2 changes: 2 additions & 0 deletions examples/pubsub/basic-chat-with-rendezvous/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/pubsub/chat/chatroom.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
8 changes: 8 additions & 0 deletions examples/pubsub/chat/go_121_workaround_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build go1.21

package main

import "testing"

// Needed so that we run at least one test in Go 1.21 so that our go test command exits successfully
func TestNothing(t *testing.T) {}
2 changes: 2 additions & 0 deletions examples/pubsub/chat/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/pubsub/chat/ui.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/relay/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/relay/main_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/routed-echo/bootstrap.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/routed-echo/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package main

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/testutils/logharness.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package testutils

import (
Expand Down
2 changes: 2 additions & 0 deletions examples/testutils/net.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !go1.21

package testutils

import (
Expand Down
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ require (
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
github.com/prometheus/client_golang v1.14.0
github.com/prometheus/client_model v0.4.0
github.com/quic-go/quic-go v0.36.3
github.com/quic-go/quic-go v0.37.5
github.com/quic-go/webtransport-go v0.5.3
github.com/raulk/go-watchdog v1.3.0
github.com/stretchr/testify v1.8.4
Expand Down Expand Up @@ -103,8 +103,7 @@ require (
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qtls-go1-19 v0.3.3 // indirect
github.com/quic-go/qtls-go1-20 v0.2.3 // indirect
github.com/quic-go/qtls-go1-20 v0.3.1 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/syndtr/goleveldb v1.0.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
Expand Down
10 changes: 4 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -434,12 +434,10 @@ github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5
github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/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/qtls-go1-19 v0.3.3 h1:wznEHvJwd+2X3PqftRha0SUKmGsnb6dfArMhy9PeJVE=
github.com/quic-go/qtls-go1-19 v0.3.3/go.mod h1:ySOI96ew8lnoKPtSqx2BlI5wCpUVPT05RMAlajtnyOI=
github.com/quic-go/qtls-go1-20 v0.2.3 h1:m575dovXn1y2ATOb1XrRFcrv0F+EQmlowTkoraNkDPI=
github.com/quic-go/qtls-go1-20 v0.2.3/go.mod h1:JKtK6mjbAVcUTN/9jZpvLbGxvdWIKS8uT7EiStoU1SM=
github.com/quic-go/quic-go v0.36.3 h1:f+yOqeGhMoRX7/M3wmEw/djhzKWr15FtQysox85/834=
github.com/quic-go/quic-go v0.36.3/go.mod h1:qxQumdeKw5GmWs1OsTZZnOxzSI+RJWuhf1O8FN35L2o=
github.com/quic-go/qtls-go1-20 v0.3.1 h1:O4BLOM3hwfVF3AcktIylQXyl7Yi2iBNVy5QsV+ySxbg=
github.com/quic-go/qtls-go1-20 v0.3.1/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k=
github.com/quic-go/quic-go v0.37.5 h1:pzkYe8AgaxHi+7KJrYBMF+u2rLO5a9kwyCp2dAsljzk=
github.com/quic-go/quic-go v0.37.5/go.mod h1:YsbH1r4mSHPJcLF4k4zruUkLBqctEMBDR6VPvcYjIsU=
github.com/quic-go/webtransport-go v0.5.3 h1:5XMlzemqB4qmOlgIus5zB45AcZ2kCgCy2EptUrfOPWU=
github.com/quic-go/webtransport-go v0.5.3/go.mod h1:OhmmgJIzTTqXK5xvtuX0oBpLV2GkLWNDA+UeTGJXErU=
github.com/raulk/go-watchdog v1.3.0 h1:oUmdlHxdkXRJlwfG0O9omj8ukerm8MEQavSiDTEtBsk=
Expand Down
13 changes: 2 additions & 11 deletions p2p/transport/quicreuse/connmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (c *ConnManager) transportForListen(network string, laddr *net.UDPAddr) (re
return reuse.TransportForListen(network, laddr)
}

conn, err := listenAndOptimize(network, laddr)
conn, err := net.ListenUDP(network, laddr)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -204,7 +204,7 @@ func (c *ConnManager) TransportForDial(network string, raddr *net.UDPAddr) (refC
case "udp6":
laddr = &net.UDPAddr{IP: net.IPv6zero, Port: 0}
}
conn, err := listenAndOptimize(network, laddr)
conn, err := net.ListenUDP(network, laddr)
if err != nil {
return nil, err
}
Expand All @@ -229,12 +229,3 @@ func (c *ConnManager) Close() error {
}
return c.reuseUDP4.Close()
}

// listenAndOptimize same as net.ListenUDP, but also calls quic.OptimizeConn
func listenAndOptimize(network string, laddr *net.UDPAddr) (net.PacketConn, error) {
conn, err := net.ListenUDP(network, laddr)
if err != nil {
return nil, err
}
return quic.OptimizeConn(conn)
}
3 changes: 2 additions & 1 deletion p2p/transport/quicreuse/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func newQuicListener(tr refCountedQuicTransport, quicConfig *quic.Config) (*quic
addrs: localMultiaddrs,
}
tlsConf := &tls.Config{
SessionTicketsDisabled: true, // This is set for the config for client, but we set it here as well: https://github.com/quic-go/quic-go/issues/4029
GetConfigForClient: func(info *tls.ClientHelloInfo) (*tls.Config, error) {
cl.protocolsMu.Lock()
defer cl.protocolsMu.Unlock()
Expand Down Expand Up @@ -82,7 +83,7 @@ func (l *quicListener) allowWindowIncrease(conn quic.Connection, delta uint64) b
l.protocolsMu.Lock()
defer l.protocolsMu.Unlock()

conf, ok := l.protocols[conn.ConnectionState().TLS.ConnectionState.NegotiatedProtocol]
conf, ok := l.protocols[conn.ConnectionState().TLS.NegotiatedProtocol]
if !ok {
return false
}
Expand Down
Loading

0 comments on commit d2398ee

Please sign in to comment.