fix(netx): make sure we save quic udp conn events (#423)

https://github.com/ooni/probe-cli/pull/421 was wrong because we need
a more rich interface for quic-go to call ReadMsgUDP.

With this commit, we use such an interface: OOBCapablePacketConn.

Still part of https://github.com/ooni/probe/issues/1505.
This commit is contained in:
Simone Basso
2021-07-02 11:00:12 +02:00
committed by GitHub
parent 30c7e2cdb3
commit ceb2aa8a8d
8 changed files with 82 additions and 49 deletions
+2 -3
View File
@@ -8,7 +8,6 @@ import (
"strconv"
"github.com/lucas-clemente/quic-go"
"github.com/ooni/probe-cli/v3/internal/quicx"
)
// QUICContextDialer is a dialer for QUIC using Context.
@@ -23,7 +22,7 @@ type QUICContextDialer interface {
// QUICListener listens for QUIC connections.
type QUICListener interface {
// Listen creates a new listening UDPConn.
Listen(addr *net.UDPAddr) (quicx.UDPConn, error)
Listen(addr *net.UDPAddr) (quic.OOBCapablePacketConn, error)
}
// QUICListenerStdlib is a QUICListener using the standard library.
@@ -32,7 +31,7 @@ type QUICListenerStdlib struct{}
var _ QUICListener = &QUICListenerStdlib{}
// Listen implements QUICListener.Listen.
func (qls *QUICListenerStdlib) Listen(addr *net.UDPAddr) (quicx.UDPConn, error) {
func (qls *QUICListenerStdlib) Listen(addr *net.UDPAddr) (quic.OOBCapablePacketConn, error) {
return net.ListenUDP("udp", addr)
}
+1 -2
View File
@@ -12,7 +12,6 @@ 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) {
@@ -76,7 +75,7 @@ func TestQUICDialerQUICGoCannotListen(t *testing.T) {
}
systemdialer := QUICDialerQUICGo{
QUICListener: &netxmocks.QUICListener{
MockListen: func(addr *net.UDPAddr) (quicx.UDPConn, error) {
MockListen: func(addr *net.UDPAddr) (quic.OOBCapablePacketConn, error) {
return nil, expected
},
},