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:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user