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:
parent
c553afdbd5
commit
adbde7246b
11 changed files with 88 additions and 538 deletions
24
internal/engine/netx/dialer/system.go
Normal file
24
internal/engine/netx/dialer/system.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package dialer
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
// defaultNetDialer is the net.Dialer we use by default.
|
||||
var defaultNetDialer = &net.Dialer{
|
||||
Timeout: 15 * time.Second,
|
||||
KeepAlive: 15 * time.Second,
|
||||
}
|
||||
|
||||
// SystemDialer is the system dialer.
|
||||
type SystemDialer struct{}
|
||||
|
||||
// DialContext implements Dialer.DialContext
|
||||
func (d SystemDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
|
||||
return defaultNetDialer.DialContext(ctx, network, address)
|
||||
}
|
||||
|
||||
// Default is the dialer we use by default.
|
||||
var Default = SystemDialer{}
|
||||
Loading…
Reference in a new issue