cleanup(netx): remove unused proxy-via-context codepath (#367)

We always set the proxy explicitly now. So, let us remove this
extra bit of code we're not using.

Part of https://github.com/ooni/probe/issues/1507.
This commit is contained in:
Simone Basso 2021-06-08 22:26:24 +02:00 committed by GitHub
commit b8cae3f5a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 1 additions and 73 deletions

View file

@ -10,9 +10,7 @@ import (
"testing"
"github.com/apex/log"
"github.com/google/go-cmp/cmp"
"github.com/ooni/probe-cli/v3/internal/engine/httpx"
"github.com/ooni/probe-cli/v3/internal/engine/netx/dialer"
)
const userAgent = "miniooni/0.1.0-dev"
@ -153,21 +151,6 @@ func TestNewRequestUserAgentIsSet(t *testing.T) {
}
}
func TestNewRequestTunnelingIsPossible(t *testing.T) {
client := newClient()
client.ProxyURL = &url.URL{Scheme: "socks5", Host: "[::1]:54321"}
req, err := client.NewRequest(
context.Background(), "GET", "/", nil, nil,
)
if err != nil {
t.Fatal(err)
}
cmp := cmp.Diff(dialer.ContextProxyURL(req.Context()), client.ProxyURL)
if cmp != "" {
t.Fatal(cmp)
}
}
func TestClientDoJSONClientDoFailure(t *testing.T) {
expected := errors.New("mocked error")
client := newClient()
@ -265,10 +248,6 @@ func TestCreateJSONSuccess(t *testing.T) {
}
}
type httpbinput struct {
Data string `json:"data"`
}
func TestUpdateJSONSuccess(t *testing.T) {
headers := httpbinheaders{
Headers: map[string]string{