feat(netxlite): support extracting the CNAME (#875)
* feat(netxlite): support extracting the CNAME Closes https://github.com/ooni/probe/issues/2225 * fix(netxlite): attempt to increase coverage and improve tests 1. dnsovergetaddrinfo: specify the behavior of a DNSResponse returned by this file to make it line with normal responses and write unit tests to make sure we adhere to expectations; 2. dnsoverudp: make sure we wait to deferred responses also w/o a custom context and post on a private channel and test that; 3. utls: recognize that we can actually write a test for NetConn and what needs to change when we'll use go1.19 by default will just be a cast that at that point can be removed.
This commit is contained in:
parent
da1c13e312
commit
cc24f28b9d
10 changed files with 390 additions and 39 deletions
|
|
@ -10,6 +10,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/ooni/probe-cli/v3/internal/model/mocks"
|
||||
utls "gitlab.com/yawning/utls.git"
|
||||
)
|
||||
|
||||
|
|
@ -93,23 +94,22 @@ func TestUTLSConn(t *testing.T) {
|
|||
})
|
||||
})
|
||||
|
||||
// TODO(https://github.com/ooni/probe/issues/2222): we cannot enable
|
||||
// this test until we use oocrypto >= v0.2 which uses go1.19. In turn,
|
||||
// we cannot use go1.19 as our main version until we upgrade psiphon
|
||||
// such that it builds using go1.19, which is the issue in #2222.
|
||||
/*
|
||||
t.Run("NetConn", func(t *testing.T) {
|
||||
factory := newConnUTLS(&utls.HelloChrome_70)
|
||||
conn := &mocks.Conn{}
|
||||
tconn, err := factory(conn, &tls.Config{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if tconn.NetConn() != conn {
|
||||
t.Fatal("NetConn is not WAI")
|
||||
}
|
||||
})
|
||||
*/
|
||||
t.Run("NetConn", func(t *testing.T) {
|
||||
factory := newConnUTLS(&utls.HelloChrome_70)
|
||||
conn := &mocks.Conn{}
|
||||
tconn, err := factory(conn, &tls.Config{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// TODO(https://github.com/ooni/probe/issues/2222): we cannot avoid
|
||||
// castedTconn until we use oocrypto >= v0.2 which uses go1.19. In turn,
|
||||
// we cannot use go1.19 as our main version until we upgrade psiphon
|
||||
// such that it builds using go1.19, which is the issue in #2222.
|
||||
castedTconn := tconn.(*utlsConn)
|
||||
if castedTconn.NetConn() != conn {
|
||||
t.Fatal("NetConn is not WAI")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func Test_newConnUTLSWithHelloID(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue