* 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.
		
			
				
	
	
		
			26 lines
		
	
	
		
			545 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			545 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package dialer_test
 | 
						|
 | 
						|
import (
 | 
						|
	"net"
 | 
						|
	"net/http"
 | 
						|
	"testing"
 | 
						|
 | 
						|
	"github.com/apex/log"
 | 
						|
	"github.com/ooni/probe-cli/v3/internal/engine/netx/dialer"
 | 
						|
)
 | 
						|
 | 
						|
func TestDialerNewSuccess(t *testing.T) {
 | 
						|
	if testing.Short() {
 | 
						|
		t.Skip("skip test in short mode")
 | 
						|
	}
 | 
						|
	log.SetLevel(log.DebugLevel)
 | 
						|
	d := dialer.New(&dialer.Config{Logger: log.Log}, &net.Resolver{})
 | 
						|
	txp := &http.Transport{DialContext: d.DialContext}
 | 
						|
	client := &http.Client{Transport: txp}
 | 
						|
	resp, err := client.Get("http://www.google.com")
 | 
						|
	if err != nil {
 | 
						|
		t.Fatal(err)
 | 
						|
	}
 | 
						|
	resp.Body.Close()
 | 
						|
}
 |