refactor: use ooni/oocrypto instead of ooni/go (#751)
Rather than building for Android using ooni/go, we're now using ooni/oocryto as the TLS dependency. Such a repository only forks crypto/tls and some minor crypto packages and includes the same set of patches that we have been using in ooni/go. This new strategy should be better than the previous one in terms of building for Android, because we can use the vanilla go1.18.2 build. It also seems that it is easier to track and merge from upstream with ooni/oocrypto than it is with ooni/go. Should this assessment be wrong, we can revert back to the previous scenario where we used ooni/go. See https://github.com/ooni/probe/issues/2106 for extra context.
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
package httptransport
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
oohttp "github.com/ooni/oohttp"
|
||||
"github.com/ooni/probe-cli/v3/internal/model"
|
||||
)
|
||||
|
||||
@@ -13,7 +12,7 @@ import (
|
||||
//
|
||||
// New code should use netxlite.NewHTTPTransport instead.
|
||||
func NewSystemTransport(config Config) model.HTTPTransport {
|
||||
txp := http.DefaultTransport.(*http.Transport).Clone()
|
||||
txp := oohttp.DefaultTransport.(*oohttp.Transport).Clone()
|
||||
txp.DialContext = config.Dialer.DialContext
|
||||
txp.DialTLSContext = config.TLSDialer.DialTLSContext
|
||||
// Better for Cloudflare DNS and also better because we have less
|
||||
@@ -24,12 +23,12 @@ func NewSystemTransport(config Config) model.HTTPTransport {
|
||||
// back the true headers, such as Content-Length. This change is
|
||||
// functional to OONI's goal of observing the network.
|
||||
txp.DisableCompression = true
|
||||
return &SystemTransportWrapper{txp}
|
||||
return &SystemTransportWrapper{&oohttp.StdlibTransport{Transport: txp}}
|
||||
}
|
||||
|
||||
// SystemTransportWrapper adapts *http.Transport to have the .Network method
|
||||
type SystemTransportWrapper struct {
|
||||
*http.Transport
|
||||
*oohttp.StdlibTransport
|
||||
}
|
||||
|
||||
func (txp *SystemTransportWrapper) Network() string {
|
||||
|
||||
Reference in New Issue
Block a user