refactor: move quicdialing base functionality to netxlite (#406)
Part of https://github.com/ooni/probe/issues/1505
This commit is contained in:
parent
c00cad1382
commit
925ca22b88
10 changed files with 254 additions and 84 deletions
|
|
@ -9,32 +9,9 @@ import (
|
|||
"github.com/ooni/probe-cli/v3/internal/engine/netx/errorx"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx/quicdialer"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx/trace"
|
||||
"github.com/ooni/probe-cli/v3/internal/netxlite"
|
||||
)
|
||||
|
||||
func TestSystemDialerInvalidIPFailure(t *testing.T) {
|
||||
tlsConf := &tls.Config{
|
||||
NextProtos: []string{"h3"},
|
||||
ServerName: "www.google.com",
|
||||
}
|
||||
saver := &trace.Saver{}
|
||||
systemdialer := quicdialer.SystemDialer{
|
||||
QUICListener: &quicdialer.QUICListenerSaver{
|
||||
QUICListener: &quicdialer.QUICListenerStdlib{},
|
||||
Saver: saver,
|
||||
},
|
||||
}
|
||||
sess, err := systemdialer.DialContext(context.Background(), "udp", "a.b.c.d:0", tlsConf, &quic.Config{})
|
||||
if err == nil {
|
||||
t.Fatal("expected an error here")
|
||||
}
|
||||
if sess != nil {
|
||||
t.Fatal("expected nil sess here")
|
||||
}
|
||||
if err.Error() != "quicdialer: invalid IP representation" {
|
||||
t.Fatal("expected another error here")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSystemDialerSuccessWithReadWrite(t *testing.T) {
|
||||
// This is the most common use case for collecting reads, writes
|
||||
tlsConf := &tls.Config{
|
||||
|
|
@ -42,9 +19,9 @@ func TestSystemDialerSuccessWithReadWrite(t *testing.T) {
|
|||
ServerName: "www.google.com",
|
||||
}
|
||||
saver := &trace.Saver{}
|
||||
systemdialer := quicdialer.SystemDialer{
|
||||
systemdialer := &netxlite.QUICDialerQUICGo{
|
||||
QUICListener: &quicdialer.QUICListenerSaver{
|
||||
QUICListener: &quicdialer.QUICListenerStdlib{},
|
||||
QUICListener: &netxlite.QUICListenerStdlib{},
|
||||
Saver: saver,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue