refactor(netx/dialer): hide implementation complexity (#372)
* refactor(netx/dialer): hide implementation complexity This follows the blueprint of `module.Config` and `nodule.New` described at https://github.com/ooni/probe/issues/1591. * fix: ndt7 bug where we were not using the right resolver * fix(legacy/netx): clarify irrelevant implementation change * fix: improve comments * fix(hhfm): do not use dialer.New b/c it breaks it Unclear to me why this is happening. Still, improve upon the previous situation by adding a timeout. It does not seem a priority to look into this issue now.
This commit is contained in:
parent
b7a6dbe47b
commit
06ee0e55a9
30 changed files with 312 additions and 517 deletions
|
|
@ -1,20 +1,14 @@
|
|||
package dialer_test
|
||||
package dialer
|
||||
|
||||
import (
|
||||
"net"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx/dialer"
|
||||
)
|
||||
|
||||
func TestGood(t *testing.T) {
|
||||
txp := netx.NewHTTPTransport(netx.Config{
|
||||
Dialer: dialer.ShapingDialer{
|
||||
Dialer: new(net.Dialer),
|
||||
},
|
||||
})
|
||||
func TestShapingDialerGood(t *testing.T) {
|
||||
d := &shapingDialer{Dialer: &net.Dialer{}}
|
||||
txp := &http.Transport{DialContext: d.DialContext}
|
||||
client := &http.Client{Transport: txp}
|
||||
resp, err := client.Get("https://www.google.com/")
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue