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:
@@ -20,8 +20,8 @@ import (
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/model"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx/archival"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx/dialer"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx/errorx"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx/selfcensor"
|
||||
"github.com/ooni/probe-cli/v3/internal/randx"
|
||||
)
|
||||
|
||||
@@ -319,11 +319,11 @@ type Dialer struct {
|
||||
// DialContext dials a specific connection and arranges such that
|
||||
// headers in the outgoing request are transformed.
|
||||
func (d Dialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
|
||||
dialer := d.Dialer
|
||||
if dialer == nil {
|
||||
dialer = selfcensor.DefaultDialer
|
||||
child := d.Dialer
|
||||
if child == nil {
|
||||
child = dialer.Default
|
||||
}
|
||||
conn, err := dialer.DialContext(ctx, network, address)
|
||||
conn, err := child.DialContext(ctx, network, address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/model"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx/dialer"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx/resolver"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx/selfcensor"
|
||||
)
|
||||
|
||||
type dialManager struct {
|
||||
@@ -36,7 +35,7 @@ func newDialManager(ndt7URL string, logger model.Logger, userAgent string) dialM
|
||||
func (mgr dialManager) dialWithTestName(ctx context.Context, testName string) (*websocket.Conn, error) {
|
||||
var reso resolver.Resolver = resolver.SystemResolver{}
|
||||
reso = resolver.LoggingResolver{Resolver: reso, Logger: mgr.logger}
|
||||
var dlr dialer.Dialer = selfcensor.SystemDialer{}
|
||||
var dlr dialer.Dialer = dialer.Default
|
||||
dlr = dialer.TimeoutDialer{Dialer: dlr}
|
||||
dlr = dialer.ErrorWrapperDialer{Dialer: dlr}
|
||||
dlr = dialer.LoggingDialer{Dialer: dlr, Logger: mgr.logger}
|
||||
|
||||
Reference in New Issue
Block a user