1874f7a7c2
This diff enables `websteps` to use uTLS for TLS parroting. It integrates the `oohttp.StdlibTransport` wrapper which uses the `ooni/oohttp` fork. `oohttp` supports TLS-like connections like `utls.Conn`. As a prototype, the testhelper and `websteps` code now uses the `utls.HelloChrome_Auto` fingerprint, i.e. the simulated TLS fingerprint of the Google Chrome browser. It is a further contribution for my GSoC project. Reference issue: https://github.com/ooni/probe/issues/1733
24 lines
538 B
Go
24 lines
538 B
Go
package websteps
|
|
|
|
import (
|
|
"context"
|
|
"crypto/tls"
|
|
"net"
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/netxlite"
|
|
utls "gitlab.com/yawning/utls.git"
|
|
)
|
|
|
|
// TLSDo performs the TLS check.
|
|
func TLSDo(ctx context.Context, conn net.Conn, hostname string) (net.Conn, error) {
|
|
tlsConf := &tls.Config{
|
|
ServerName: hostname,
|
|
NextProtos: []string{"h2", "http/1.1"},
|
|
}
|
|
h := &netxlite.TLSHandshakerConfigurable{
|
|
NewConn: netxlite.NewConnUTLS(&utls.HelloChrome_Auto),
|
|
}
|
|
tlsConn, _, err := h.Handshake(ctx, conn, tlsConf)
|
|
return tlsConn, err
|
|
}
|