From f0181c432f782ed7d56e998c6efcf7b670300931 Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Wed, 5 Jan 2022 17:17:20 +0100 Subject: [PATCH] refactor: move httpx into the internal package (#646) This concludes the TODO list at https://github.com/ooni/probe/issues/1951 --- internal/cmd/apitool/main.go | 2 +- internal/cmd/oohelperd/internal/webconnectivity/dns_test.go | 2 +- internal/engine/experiment/webconnectivity/control.go | 2 +- internal/engine/experiment/websteps/control.go | 2 +- internal/engine/geolocate/avast.go | 2 +- internal/engine/geolocate/ipconfig.go | 2 +- internal/engine/geolocate/ipinfo.go | 2 +- internal/engine/geolocate/ubuntu.go | 2 +- internal/engine/legacy/errorsx/dialer_test.go | 2 +- internal/engine/legacy/errorsx/resolver_test.go | 2 +- internal/engine/legacy/errorsx/tls_test.go | 2 +- internal/engine/netx/dialer/bytecounter_test.go | 2 +- internal/engine/netx/dialer/saver_test.go | 2 +- internal/engine/netx/netx_test.go | 2 +- internal/engine/netx/quicdialer/system_test.go | 2 +- internal/engine/probeservices/checkreportid.go | 2 +- internal/engine/probeservices/checkreportid_test.go | 2 +- internal/engine/probeservices/measurementmeta.go | 2 +- internal/engine/probeservices/measurementmeta_test.go | 2 +- internal/engine/probeservices/probeservices.go | 2 +- internal/{engine => }/httpx/httpx.go | 0 internal/{engine => }/httpx/httpx_test.go | 0 internal/netxlite/filtering/dns_test.go | 2 +- internal/netxlite/filtering/tls_test.go | 2 +- internal/netxlite/filtering/tproxy_test.go | 2 +- internal/ptx/ptx_test.go | 2 +- 26 files changed, 24 insertions(+), 24 deletions(-) rename internal/{engine => }/httpx/httpx.go (100%) rename internal/{engine => }/httpx/httpx_test.go (100%) diff --git a/internal/cmd/apitool/main.go b/internal/cmd/apitool/main.go index ece42d1..2e64355 100644 --- a/internal/cmd/apitool/main.go +++ b/internal/cmd/apitool/main.go @@ -17,8 +17,8 @@ import ( "github.com/apex/log" "github.com/ooni/probe-cli/v3/internal/atomicx" - "github.com/ooni/probe-cli/v3/internal/engine/httpx" "github.com/ooni/probe-cli/v3/internal/engine/probeservices" + "github.com/ooni/probe-cli/v3/internal/httpx" "github.com/ooni/probe-cli/v3/internal/kvstore" "github.com/ooni/probe-cli/v3/internal/netxlite" "github.com/ooni/probe-cli/v3/internal/version" diff --git a/internal/cmd/oohelperd/internal/webconnectivity/dns_test.go b/internal/cmd/oohelperd/internal/webconnectivity/dns_test.go index 5848919..cc9b805 100644 --- a/internal/cmd/oohelperd/internal/webconnectivity/dns_test.go +++ b/internal/cmd/oohelperd/internal/webconnectivity/dns_test.go @@ -7,8 +7,8 @@ import ( "github.com/google/go-cmp/cmp" "github.com/ooni/probe-cli/v3/internal/engine/experiment/webconnectivity" - "github.com/ooni/probe-cli/v3/internal/netxlite" "github.com/ooni/probe-cli/v3/internal/model/mocks" + "github.com/ooni/probe-cli/v3/internal/netxlite" ) func stringPointerForString(s string) *string { diff --git a/internal/engine/experiment/webconnectivity/control.go b/internal/engine/experiment/webconnectivity/control.go index 2e69055..0ff4a7c 100644 --- a/internal/engine/experiment/webconnectivity/control.go +++ b/internal/engine/experiment/webconnectivity/control.go @@ -4,8 +4,8 @@ import ( "context" "github.com/ooni/probe-cli/v3/internal/engine/geolocate" - "github.com/ooni/probe-cli/v3/internal/engine/httpx" legacyerrorsx "github.com/ooni/probe-cli/v3/internal/engine/legacy/errorsx" + "github.com/ooni/probe-cli/v3/internal/httpx" "github.com/ooni/probe-cli/v3/internal/model" "github.com/ooni/probe-cli/v3/internal/netxlite" ) diff --git a/internal/engine/experiment/websteps/control.go b/internal/engine/experiment/websteps/control.go index db0c18f..8e9ebf1 100644 --- a/internal/engine/experiment/websteps/control.go +++ b/internal/engine/experiment/websteps/control.go @@ -3,8 +3,8 @@ package websteps import ( "context" - "github.com/ooni/probe-cli/v3/internal/engine/httpx" errorsxlegacy "github.com/ooni/probe-cli/v3/internal/engine/legacy/errorsx" + "github.com/ooni/probe-cli/v3/internal/httpx" "github.com/ooni/probe-cli/v3/internal/model" "github.com/ooni/probe-cli/v3/internal/netxlite" ) diff --git a/internal/engine/geolocate/avast.go b/internal/engine/geolocate/avast.go index 4261c55..99e037d 100644 --- a/internal/engine/geolocate/avast.go +++ b/internal/engine/geolocate/avast.go @@ -4,7 +4,7 @@ import ( "context" "net/http" - "github.com/ooni/probe-cli/v3/internal/engine/httpx" + "github.com/ooni/probe-cli/v3/internal/httpx" "github.com/ooni/probe-cli/v3/internal/model" ) diff --git a/internal/engine/geolocate/ipconfig.go b/internal/engine/geolocate/ipconfig.go index a5d466d..c21f258 100644 --- a/internal/engine/geolocate/ipconfig.go +++ b/internal/engine/geolocate/ipconfig.go @@ -6,7 +6,7 @@ import ( "strings" "github.com/ooni/probe-cli/v3/internal/engine/httpheader" - "github.com/ooni/probe-cli/v3/internal/engine/httpx" + "github.com/ooni/probe-cli/v3/internal/httpx" "github.com/ooni/probe-cli/v3/internal/model" ) diff --git a/internal/engine/geolocate/ipinfo.go b/internal/engine/geolocate/ipinfo.go index 703d19a..bd75463 100644 --- a/internal/engine/geolocate/ipinfo.go +++ b/internal/engine/geolocate/ipinfo.go @@ -5,7 +5,7 @@ import ( "net/http" "github.com/ooni/probe-cli/v3/internal/engine/httpheader" - "github.com/ooni/probe-cli/v3/internal/engine/httpx" + "github.com/ooni/probe-cli/v3/internal/httpx" "github.com/ooni/probe-cli/v3/internal/model" ) diff --git a/internal/engine/geolocate/ubuntu.go b/internal/engine/geolocate/ubuntu.go index 3cc48e4..1b6b191 100644 --- a/internal/engine/geolocate/ubuntu.go +++ b/internal/engine/geolocate/ubuntu.go @@ -5,7 +5,7 @@ import ( "encoding/xml" "net/http" - "github.com/ooni/probe-cli/v3/internal/engine/httpx" + "github.com/ooni/probe-cli/v3/internal/httpx" "github.com/ooni/probe-cli/v3/internal/model" ) diff --git a/internal/engine/legacy/errorsx/dialer_test.go b/internal/engine/legacy/errorsx/dialer_test.go index 48806d9..48f1a21 100644 --- a/internal/engine/legacy/errorsx/dialer_test.go +++ b/internal/engine/legacy/errorsx/dialer_test.go @@ -7,8 +7,8 @@ import ( "net" "testing" - "github.com/ooni/probe-cli/v3/internal/netxlite" "github.com/ooni/probe-cli/v3/internal/model/mocks" + "github.com/ooni/probe-cli/v3/internal/netxlite" ) func TestErrorWrapperDialerFailure(t *testing.T) { diff --git a/internal/engine/legacy/errorsx/resolver_test.go b/internal/engine/legacy/errorsx/resolver_test.go index 2e423d2..f04825a 100644 --- a/internal/engine/legacy/errorsx/resolver_test.go +++ b/internal/engine/legacy/errorsx/resolver_test.go @@ -6,8 +6,8 @@ import ( "net" "testing" - "github.com/ooni/probe-cli/v3/internal/netxlite" "github.com/ooni/probe-cli/v3/internal/model/mocks" + "github.com/ooni/probe-cli/v3/internal/netxlite" ) func TestErrorWrapperResolverSuccess(t *testing.T) { diff --git a/internal/engine/legacy/errorsx/tls_test.go b/internal/engine/legacy/errorsx/tls_test.go index 2fc8007..da91256 100644 --- a/internal/engine/legacy/errorsx/tls_test.go +++ b/internal/engine/legacy/errorsx/tls_test.go @@ -8,8 +8,8 @@ import ( "net" "testing" - "github.com/ooni/probe-cli/v3/internal/netxlite" "github.com/ooni/probe-cli/v3/internal/model/mocks" + "github.com/ooni/probe-cli/v3/internal/netxlite" ) func TestErrorWrapperTLSHandshakerFailure(t *testing.T) { diff --git a/internal/engine/netx/dialer/bytecounter_test.go b/internal/engine/netx/dialer/bytecounter_test.go index 7daffb9..b1e251f 100644 --- a/internal/engine/netx/dialer/bytecounter_test.go +++ b/internal/engine/netx/dialer/bytecounter_test.go @@ -9,8 +9,8 @@ import ( "testing" "github.com/ooni/probe-cli/v3/internal/bytecounter" - "github.com/ooni/probe-cli/v3/internal/netxlite" "github.com/ooni/probe-cli/v3/internal/model/mocks" + "github.com/ooni/probe-cli/v3/internal/netxlite" ) func dorequest(ctx context.Context, url string) error { diff --git a/internal/engine/netx/dialer/saver_test.go b/internal/engine/netx/dialer/saver_test.go index 2b72aff..0439d81 100644 --- a/internal/engine/netx/dialer/saver_test.go +++ b/internal/engine/netx/dialer/saver_test.go @@ -9,8 +9,8 @@ import ( "time" "github.com/ooni/probe-cli/v3/internal/engine/netx/trace" - "github.com/ooni/probe-cli/v3/internal/netxlite" "github.com/ooni/probe-cli/v3/internal/model/mocks" + "github.com/ooni/probe-cli/v3/internal/netxlite" ) func TestSaverDialerFailure(t *testing.T) { diff --git a/internal/engine/netx/netx_test.go b/internal/engine/netx/netx_test.go index 3ab0989..093a0c5 100644 --- a/internal/engine/netx/netx_test.go +++ b/internal/engine/netx/netx_test.go @@ -17,8 +17,8 @@ import ( "github.com/ooni/probe-cli/v3/internal/engine/netx/resolver" "github.com/ooni/probe-cli/v3/internal/engine/netx/tlsdialer" "github.com/ooni/probe-cli/v3/internal/engine/netx/trace" - "github.com/ooni/probe-cli/v3/internal/netxlite" "github.com/ooni/probe-cli/v3/internal/model/mocks" + "github.com/ooni/probe-cli/v3/internal/netxlite" ) func TestNewResolverVanilla(t *testing.T) { diff --git a/internal/engine/netx/quicdialer/system_test.go b/internal/engine/netx/quicdialer/system_test.go index 9676def..28a429b 100644 --- a/internal/engine/netx/quicdialer/system_test.go +++ b/internal/engine/netx/quicdialer/system_test.go @@ -11,8 +11,8 @@ import ( "github.com/ooni/probe-cli/v3/internal/engine/netx/quicdialer" "github.com/ooni/probe-cli/v3/internal/engine/netx/trace" "github.com/ooni/probe-cli/v3/internal/model" - "github.com/ooni/probe-cli/v3/internal/netxlite" "github.com/ooni/probe-cli/v3/internal/model/mocks" + "github.com/ooni/probe-cli/v3/internal/netxlite" "github.com/ooni/probe-cli/v3/internal/netxlite/quictesting" ) diff --git a/internal/engine/probeservices/checkreportid.go b/internal/engine/probeservices/checkreportid.go index 20e1bed..c6a3f3e 100644 --- a/internal/engine/probeservices/checkreportid.go +++ b/internal/engine/probeservices/checkreportid.go @@ -4,7 +4,7 @@ import ( "context" "net/url" - "github.com/ooni/probe-cli/v3/internal/engine/httpx" + "github.com/ooni/probe-cli/v3/internal/httpx" ) type checkReportIDResponse struct { diff --git a/internal/engine/probeservices/checkreportid_test.go b/internal/engine/probeservices/checkreportid_test.go index 107f49e..d43e3d2 100644 --- a/internal/engine/probeservices/checkreportid_test.go +++ b/internal/engine/probeservices/checkreportid_test.go @@ -8,8 +8,8 @@ import ( "github.com/apex/log" "github.com/ooni/probe-cli/v3/internal/atomicx" - "github.com/ooni/probe-cli/v3/internal/engine/httpx" "github.com/ooni/probe-cli/v3/internal/engine/probeservices" + "github.com/ooni/probe-cli/v3/internal/httpx" "github.com/ooni/probe-cli/v3/internal/kvstore" ) diff --git a/internal/engine/probeservices/measurementmeta.go b/internal/engine/probeservices/measurementmeta.go index 8d03a3d..96b61f0 100644 --- a/internal/engine/probeservices/measurementmeta.go +++ b/internal/engine/probeservices/measurementmeta.go @@ -5,7 +5,7 @@ import ( "net/url" "time" - "github.com/ooni/probe-cli/v3/internal/engine/httpx" + "github.com/ooni/probe-cli/v3/internal/httpx" ) // MeasurementMetaConfig contains configuration for GetMeasurementMeta. diff --git a/internal/engine/probeservices/measurementmeta_test.go b/internal/engine/probeservices/measurementmeta_test.go index 7079578..53589f6 100644 --- a/internal/engine/probeservices/measurementmeta_test.go +++ b/internal/engine/probeservices/measurementmeta_test.go @@ -9,8 +9,8 @@ import ( "github.com/apex/log" "github.com/ooni/probe-cli/v3/internal/atomicx" - "github.com/ooni/probe-cli/v3/internal/engine/httpx" "github.com/ooni/probe-cli/v3/internal/engine/probeservices" + "github.com/ooni/probe-cli/v3/internal/httpx" "github.com/ooni/probe-cli/v3/internal/kvstore" ) diff --git a/internal/engine/probeservices/probeservices.go b/internal/engine/probeservices/probeservices.go index c3e1868..d33e265 100644 --- a/internal/engine/probeservices/probeservices.go +++ b/internal/engine/probeservices/probeservices.go @@ -29,7 +29,7 @@ import ( "net/url" "github.com/ooni/probe-cli/v3/internal/atomicx" - "github.com/ooni/probe-cli/v3/internal/engine/httpx" + "github.com/ooni/probe-cli/v3/internal/httpx" "github.com/ooni/probe-cli/v3/internal/model" ) diff --git a/internal/engine/httpx/httpx.go b/internal/httpx/httpx.go similarity index 100% rename from internal/engine/httpx/httpx.go rename to internal/httpx/httpx.go diff --git a/internal/engine/httpx/httpx_test.go b/internal/httpx/httpx_test.go similarity index 100% rename from internal/engine/httpx/httpx_test.go rename to internal/httpx/httpx_test.go diff --git a/internal/netxlite/filtering/dns_test.go b/internal/netxlite/filtering/dns_test.go index 9e99a89..65b3dc6 100644 --- a/internal/netxlite/filtering/dns_test.go +++ b/internal/netxlite/filtering/dns_test.go @@ -11,8 +11,8 @@ import ( "github.com/apex/log" "github.com/miekg/dns" "github.com/ooni/probe-cli/v3/internal/model" - "github.com/ooni/probe-cli/v3/internal/netxlite" "github.com/ooni/probe-cli/v3/internal/model/mocks" + "github.com/ooni/probe-cli/v3/internal/netxlite" ) func TestDNSProxy(t *testing.T) { diff --git a/internal/netxlite/filtering/tls_test.go b/internal/netxlite/filtering/tls_test.go index dded025..c02e826 100644 --- a/internal/netxlite/filtering/tls_test.go +++ b/internal/netxlite/filtering/tls_test.go @@ -9,8 +9,8 @@ import ( "testing" "github.com/apex/log" - "github.com/ooni/probe-cli/v3/internal/netxlite" "github.com/ooni/probe-cli/v3/internal/model/mocks" + "github.com/ooni/probe-cli/v3/internal/netxlite" ) func TestTLSProxy(t *testing.T) { diff --git a/internal/netxlite/filtering/tproxy_test.go b/internal/netxlite/filtering/tproxy_test.go index e4e99df..ead1a86 100644 --- a/internal/netxlite/filtering/tproxy_test.go +++ b/internal/netxlite/filtering/tproxy_test.go @@ -14,8 +14,8 @@ import ( "github.com/apex/log" "github.com/ooni/probe-cli/v3/internal/model" - "github.com/ooni/probe-cli/v3/internal/netxlite" "github.com/ooni/probe-cli/v3/internal/model/mocks" + "github.com/ooni/probe-cli/v3/internal/netxlite" ) // tProxyDialerAdapter adapts a netxlite.TProxyDialer to be a netxlite.Dialer. diff --git a/internal/ptx/ptx_test.go b/internal/ptx/ptx_test.go index 59839d8..d4b4c79 100644 --- a/internal/ptx/ptx_test.go +++ b/internal/ptx/ptx_test.go @@ -13,8 +13,8 @@ import ( "github.com/apex/log" "github.com/ooni/probe-cli/v3/internal/atomicx" - "github.com/ooni/probe-cli/v3/internal/netxlite" "github.com/ooni/probe-cli/v3/internal/model/mocks" + "github.com/ooni/probe-cli/v3/internal/netxlite" ) func TestListenerLoggerWorks(t *testing.T) {