netxlite: utls for TLS parroting
This is the ground work for https://github.com/ooni/probe/issues/1424.
This commit is contained in:
parent
17bfb052c5
commit
285290a98d
3 changed files with 56 additions and 0 deletions
|
|
@ -15,6 +15,7 @@ import (
|
|||
|
||||
"github.com/apex/log"
|
||||
"github.com/ooni/probe-cli/v3/internal/netxmocks"
|
||||
utls "gitlab.com/yawning/utls.git"
|
||||
)
|
||||
|
||||
func TestTLSHandshakerConfigurableWithError(t *testing.T) {
|
||||
|
|
@ -177,3 +178,18 @@ func TestTLSHandshakerLoggerFailure(t *testing.T) {
|
|||
t.Fatal("expected zero ConnectionState here")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUTLSHandshakerChrome(t *testing.T) {
|
||||
h := &TLSHandshakerConfigurable{
|
||||
NewConn: NewConnUTLS(&utls.HelloChrome_Auto),
|
||||
}
|
||||
cfg := &tls.Config{ServerName: "google.com"}
|
||||
conn, err := net.Dial("tcp", "google.com:443")
|
||||
conn, _, err = h.Handshake(context.Background(), conn, cfg)
|
||||
if err != nil {
|
||||
t.Fatal("unexpected error", err)
|
||||
}
|
||||
if conn == nil {
|
||||
t.Fatal("nil connection")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue