cli: upgrade to lucas-clemente/quic-go 0.23.0 (#449)

See https://github.com/ooni/probe/issues/1754 for a comprehensive description.
This commit is contained in:
Simone Basso
2021-08-23 16:49:22 +02:00
committed by GitHub
parent a9014e7950
commit 8f18813e17
12 changed files with 192 additions and 130 deletions
+5 -4
View File
@@ -8,6 +8,7 @@ import (
"strconv"
"github.com/lucas-clemente/quic-go"
"github.com/ooni/probe-cli/v3/internal/quicx"
)
// QUICContextDialer is a dialer for QUIC using Context.
@@ -22,7 +23,7 @@ type QUICContextDialer interface {
// QUICListener listens for QUIC connections.
type QUICListener interface {
// Listen creates a new listening UDPConn.
Listen(addr *net.UDPAddr) (quic.OOBCapablePacketConn, error)
Listen(addr *net.UDPAddr) (quicx.UDPLikeConn, error)
}
// QUICListenerStdlib is a QUICListener using the standard library.
@@ -31,7 +32,7 @@ type QUICListenerStdlib struct{}
var _ QUICListener = &QUICListenerStdlib{}
// Listen implements QUICListener.Listen.
func (qls *QUICListenerStdlib) Listen(addr *net.UDPAddr) (quic.OOBCapablePacketConn, error) {
func (qls *QUICListenerStdlib) Listen(addr *net.UDPAddr) (quicx.UDPLikeConn, error) {
return net.ListenUDP("udp", addr)
}
@@ -118,13 +119,13 @@ func (d *QUICDialerQUICGo) maybeApplyTLSDefaults(config *tls.Config, port int) *
return config
}
// quicSessionOwnsConn ensures that we close the PacketConn.
// quicSessionOwnsConn ensures that we close the UDPLikeConn.
type quicSessionOwnsConn struct {
// EarlySession is the embedded early session
quic.EarlySession
// conn is the connection we own
conn net.PacketConn
conn quicx.UDPLikeConn
}
// CloseWithError implements quic.EarlySession.CloseWithError.
+2 -1
View File
@@ -12,6 +12,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/lucas-clemente/quic-go"
"github.com/ooni/probe-cli/v3/internal/netxmocks"
"github.com/ooni/probe-cli/v3/internal/quicx"
)
func TestQUICDialerQUICGoCannotSplitHostPort(t *testing.T) {
@@ -75,7 +76,7 @@ func TestQUICDialerQUICGoCannotListen(t *testing.T) {
}
systemdialer := QUICDialerQUICGo{
QUICListener: &netxmocks.QUICListener{
MockListen: func(addr *net.UDPAddr) (quic.OOBCapablePacketConn, error) {
MockListen: func(addr *net.UDPAddr) (quicx.UDPLikeConn, error) {
return nil, expected
},
},
+3
View File
@@ -185,6 +185,9 @@ func TestUTLSHandshakerChrome(t *testing.T) {
}
cfg := &tls.Config{ServerName: "google.com"}
conn, err := net.Dial("tcp", "google.com:443")
if err != nil {
t.Fatal("unexpected error", err)
}
conn, _, err = h.Handshake(context.Background(), conn, cfg)
if err != nil {
t.Fatal("unexpected error", err)