refactor(netx): remove the self censorship mechanism (#364)

We're currently use jafar for QA and jafar is a better mechanism,
even though it is not portable outside of Linux.

This self censorship mechanism was less cool and added a bunch
of (also cognitive) complexity to netx.

If we ever want to go down a self censorship like road, we probably
want to do as little work as possible in the problem and as much
work as possible inside a helper like jafar.

Part of https://github.com/ooni/probe/issues/1591.
This commit is contained in:
Simone Basso 2021-06-08 19:40:17 +02:00 committed by GitHub
commit adbde7246b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 88 additions and 538 deletions

View file

@ -13,7 +13,6 @@ import (
"github.com/ooni/probe-cli/v3/internal/engine/netx/dialer"
"github.com/ooni/probe-cli/v3/internal/engine/netx/httptransport"
"github.com/ooni/probe-cli/v3/internal/engine/netx/resolver"
"github.com/ooni/probe-cli/v3/internal/engine/netx/selfcensor"
"github.com/ooni/probe-cli/v3/internal/engine/netx/tlsdialer"
"github.com/ooni/probe-cli/v3/internal/engine/netx/trace"
)
@ -245,7 +244,7 @@ func TestNewDialerVanilla(t *testing.T) {
if !ok {
t.Fatal("not the dialer we expected")
}
if _, ok := td.Dialer.(selfcensor.SystemDialer); !ok {
if _, ok := td.Dialer.(dialer.SystemDialer); !ok {
t.Fatal("not the dialer we expected")
}
}
@ -285,7 +284,7 @@ func TestNewDialerWithResolver(t *testing.T) {
if !ok {
t.Fatal("not the dialer we expected")
}
if _, ok := td.Dialer.(selfcensor.SystemDialer); !ok {
if _, ok := td.Dialer.(dialer.SystemDialer); !ok {
t.Fatal("not the dialer we expected")
}
}
@ -334,7 +333,7 @@ func TestNewDialerWithLogger(t *testing.T) {
if !ok {
t.Fatal("not the dialer we expected")
}
if _, ok := td.Dialer.(selfcensor.SystemDialer); !ok {
if _, ok := td.Dialer.(dialer.SystemDialer); !ok {
t.Fatal("not the dialer we expected")
}
}
@ -384,7 +383,7 @@ func TestNewDialerWithDialSaver(t *testing.T) {
if !ok {
t.Fatal("not the dialer we expected")
}
if _, ok := td.Dialer.(selfcensor.SystemDialer); !ok {
if _, ok := td.Dialer.(dialer.SystemDialer); !ok {
t.Fatal("not the dialer we expected")
}
}
@ -434,7 +433,7 @@ func TestNewDialerWithReadWriteSaver(t *testing.T) {
if !ok {
t.Fatal("not the dialer we expected")
}
if _, ok := td.Dialer.(selfcensor.SystemDialer); !ok {
if _, ok := td.Dialer.(dialer.SystemDialer); !ok {
t.Fatal("not the dialer we expected")
}
}
@ -480,7 +479,7 @@ func TestNewDialerWithContextByteCounting(t *testing.T) {
if !ok {
t.Fatal("not the dialer we expected")
}
if _, ok := td.Dialer.(selfcensor.SystemDialer); !ok {
if _, ok := td.Dialer.(dialer.SystemDialer); !ok {
t.Fatal("not the dialer we expected")
}
}