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

@ -48,7 +48,9 @@ func TestErrorWrapperInvalidCertificate(t *testing.T) {
ServerName: servername,
}
dlr := quicdialer.ErrorWrapperDialer{Dialer: &quicdialer.SystemDialer{}}
dlr := quicdialer.ErrorWrapperDialer{Dialer: &quicdialer.SystemDialer{
QUICListener: &quicdialer.QUICListenerStdlib{},
}}
// use Google IP
sess, err := dlr.DialContext(context.Background(), "udp",
"216.58.212.164:443", tlsConf, &quic.Config{})
@ -69,7 +71,9 @@ func TestErrorWrapperSuccess(t *testing.T) {
NextProtos: []string{"h3"},
ServerName: "www.google.com",
}
d := quicdialer.ErrorWrapperDialer{Dialer: quicdialer.SystemDialer{}}
d := quicdialer.ErrorWrapperDialer{Dialer: quicdialer.SystemDialer{
QUICListener: &quicdialer.QUICListenerStdlib{},
}}
sess, err := d.DialContext(ctx, "udp", "216.58.212.164:443", tlsConf, &quic.Config{})
if err != nil {
t.Fatal(err)