refactor(quicdialer): separate saving from listening (#405)

With this change, we will soon be able to move the creation of
a QUIC session inside of the netxlite package.

Part of https://github.com/ooni/probe/issues/1505.
This commit is contained in:
Simone Basso 2021-06-25 16:20:08 +02:00 committed by GitHub
commit c00cad1382
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 83 additions and 24 deletions

View file

@ -18,7 +18,10 @@ func TestSystemDialerInvalidIPFailure(t *testing.T) {
}
saver := &trace.Saver{}
systemdialer := quicdialer.SystemDialer{
Saver: saver,
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 {
@ -39,7 +42,12 @@ func TestSystemDialerSuccessWithReadWrite(t *testing.T) {
ServerName: "www.google.com",
}
saver := &trace.Saver{}
systemdialer := quicdialer.SystemDialer{Saver: saver}
systemdialer := quicdialer.SystemDialer{
QUICListener: &quicdialer.QUICListenerSaver{
QUICListener: &quicdialer.QUICListenerStdlib{},
Saver: saver,
},
}
_, err := systemdialer.DialContext(context.Background(), "udp",
"216.58.212.164:443", tlsConf, &quic.Config{})
if err != nil {