diff --git a/internal/experiment/webconnectivity/README.md b/internal/experiment/webconnectivitylte/README.md similarity index 100% rename from internal/experiment/webconnectivity/README.md rename to internal/experiment/webconnectivitylte/README.md diff --git a/internal/experiment/webconnectivity/analysiscore.go b/internal/experiment/webconnectivitylte/analysiscore.go similarity index 99% rename from internal/experiment/webconnectivity/analysiscore.go rename to internal/experiment/webconnectivitylte/analysiscore.go index ebcf69c2c8..35c91a3bb6 100644 --- a/internal/experiment/webconnectivity/analysiscore.go +++ b/internal/experiment/webconnectivitylte/analysiscore.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte import ( "fmt" diff --git a/internal/experiment/webconnectivity/analysisdns.go b/internal/experiment/webconnectivitylte/analysisdns.go similarity index 99% rename from internal/experiment/webconnectivity/analysisdns.go rename to internal/experiment/webconnectivitylte/analysisdns.go index e32bfc2b5a..c28f315854 100644 --- a/internal/experiment/webconnectivity/analysisdns.go +++ b/internal/experiment/webconnectivitylte/analysisdns.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte // // DNS analysis diff --git a/internal/experiment/webconnectivity/analysishttpcore.go b/internal/experiment/webconnectivitylte/analysishttpcore.go similarity index 98% rename from internal/experiment/webconnectivity/analysishttpcore.go rename to internal/experiment/webconnectivitylte/analysishttpcore.go index 5bebfdaae0..8d7d34c9e2 100644 --- a/internal/experiment/webconnectivity/analysishttpcore.go +++ b/internal/experiment/webconnectivitylte/analysishttpcore.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte // // HTTP core analysis diff --git a/internal/experiment/webconnectivity/analysishttpdiff.go b/internal/experiment/webconnectivitylte/analysishttpdiff.go similarity index 99% rename from internal/experiment/webconnectivity/analysishttpdiff.go rename to internal/experiment/webconnectivitylte/analysishttpdiff.go index b8f4258afa..cf0562b302 100644 --- a/internal/experiment/webconnectivity/analysishttpdiff.go +++ b/internal/experiment/webconnectivitylte/analysishttpdiff.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte // // HTTP diff analysis diff --git a/internal/experiment/webconnectivity/analysistcpip.go b/internal/experiment/webconnectivitylte/analysistcpip.go similarity index 98% rename from internal/experiment/webconnectivity/analysistcpip.go rename to internal/experiment/webconnectivitylte/analysistcpip.go index 718117693b..5fa2bc3179 100644 --- a/internal/experiment/webconnectivity/analysistcpip.go +++ b/internal/experiment/webconnectivitylte/analysistcpip.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte // // TCP/IP analysis diff --git a/internal/experiment/webconnectivity/analysistls.go b/internal/experiment/webconnectivitylte/analysistls.go similarity index 98% rename from internal/experiment/webconnectivity/analysistls.go rename to internal/experiment/webconnectivitylte/analysistls.go index 9a74e85deb..a0f46c460c 100644 --- a/internal/experiment/webconnectivity/analysistls.go +++ b/internal/experiment/webconnectivitylte/analysistls.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte // // TLS analysis diff --git a/internal/experiment/webconnectivity/cleartextflow.go b/internal/experiment/webconnectivitylte/cleartextflow.go similarity index 99% rename from internal/experiment/webconnectivity/cleartextflow.go rename to internal/experiment/webconnectivitylte/cleartextflow.go index 4ad342280d..20348e0c3b 100644 --- a/internal/experiment/webconnectivity/cleartextflow.go +++ b/internal/experiment/webconnectivitylte/cleartextflow.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte // // CleartextFlow diff --git a/internal/experiment/webconnectivity/config.go b/internal/experiment/webconnectivitylte/config.go similarity index 78% rename from internal/experiment/webconnectivity/config.go rename to internal/experiment/webconnectivitylte/config.go index f5b6bc248d..f907725592 100644 --- a/internal/experiment/webconnectivity/config.go +++ b/internal/experiment/webconnectivitylte/config.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte // // Config diff --git a/internal/experiment/webconnectivity/control.go b/internal/experiment/webconnectivitylte/control.go similarity index 99% rename from internal/experiment/webconnectivity/control.go rename to internal/experiment/webconnectivitylte/control.go index ea0d4934e4..42c764d3f7 100644 --- a/internal/experiment/webconnectivity/control.go +++ b/internal/experiment/webconnectivitylte/control.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte import ( "context" diff --git a/internal/experiment/webconnectivity/dnscache.go b/internal/experiment/webconnectivitylte/dnscache.go similarity index 97% rename from internal/experiment/webconnectivity/dnscache.go rename to internal/experiment/webconnectivitylte/dnscache.go index 18dce1f1e2..34793c841f 100644 --- a/internal/experiment/webconnectivity/dnscache.go +++ b/internal/experiment/webconnectivitylte/dnscache.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte import "sync" diff --git a/internal/experiment/webconnectivity/dnsresolvers.go b/internal/experiment/webconnectivitylte/dnsresolvers.go similarity index 99% rename from internal/experiment/webconnectivity/dnsresolvers.go rename to internal/experiment/webconnectivitylte/dnsresolvers.go index 0d35d71586..8a2a582636 100644 --- a/internal/experiment/webconnectivity/dnsresolvers.go +++ b/internal/experiment/webconnectivitylte/dnsresolvers.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte // // DNSResolvers diff --git a/internal/experiment/webconnectivity/dnswhoami.go b/internal/experiment/webconnectivitylte/dnswhoami.go similarity index 98% rename from internal/experiment/webconnectivity/dnswhoami.go rename to internal/experiment/webconnectivitylte/dnswhoami.go index 3a0636cacd..1dc1b770d2 100644 --- a/internal/experiment/webconnectivity/dnswhoami.go +++ b/internal/experiment/webconnectivitylte/dnswhoami.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte import ( "context" diff --git a/internal/experiment/webconnectivity/doc.go b/internal/experiment/webconnectivitylte/doc.go similarity index 70% rename from internal/experiment/webconnectivity/doc.go rename to internal/experiment/webconnectivitylte/doc.go index 0c713d1373..2ecb64d84e 100644 --- a/internal/experiment/webconnectivity/doc.go +++ b/internal/experiment/webconnectivitylte/doc.go @@ -1,7 +1,7 @@ -// Package webconnectivity implements the web_connectivity experiment. +// Package webconnectivitylte implements the web_connectivity experiment. // // Spec: https://github.com/ooni/spec/blob/master/nettests/ts-017-web-connectivity.md. // // This implementation, in particular, contains extensions over the original model, // which we document at https://github.com/ooni/probe/issues/2237. -package webconnectivity +package webconnectivitylte diff --git a/internal/experiment/webconnectivity/inputparser.go b/internal/experiment/webconnectivitylte/inputparser.go similarity index 98% rename from internal/experiment/webconnectivity/inputparser.go rename to internal/experiment/webconnectivitylte/inputparser.go index a8b055e225..54dd6b4ffd 100644 --- a/internal/experiment/webconnectivity/inputparser.go +++ b/internal/experiment/webconnectivitylte/inputparser.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte // // Input parsing diff --git a/internal/experiment/webconnectivity/iox.go b/internal/experiment/webconnectivitylte/iox.go similarity index 98% rename from internal/experiment/webconnectivity/iox.go rename to internal/experiment/webconnectivitylte/iox.go index 09f425b094..5063e0db73 100644 --- a/internal/experiment/webconnectivity/iox.go +++ b/internal/experiment/webconnectivitylte/iox.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte // // Extensions to incrementally stream-reading a response body. diff --git a/internal/experiment/webconnectivity/measurer.go b/internal/experiment/webconnectivitylte/measurer.go similarity index 99% rename from internal/experiment/webconnectivity/measurer.go rename to internal/experiment/webconnectivitylte/measurer.go index 2322323549..f1a8073a1d 100644 --- a/internal/experiment/webconnectivity/measurer.go +++ b/internal/experiment/webconnectivitylte/measurer.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte // // Measurer diff --git a/internal/experiment/webconnectivity/priority.go b/internal/experiment/webconnectivitylte/priority.go similarity index 99% rename from internal/experiment/webconnectivity/priority.go rename to internal/experiment/webconnectivitylte/priority.go index 6c043dd010..eaa6416b2d 100644 --- a/internal/experiment/webconnectivity/priority.go +++ b/internal/experiment/webconnectivitylte/priority.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte // // Determine which connection(s) are allowed to fetch the webpage diff --git a/internal/experiment/webconnectivity/redirects.go b/internal/experiment/webconnectivitylte/redirects.go similarity index 94% rename from internal/experiment/webconnectivity/redirects.go rename to internal/experiment/webconnectivitylte/redirects.go index 963daa3851..882a05d0be 100644 --- a/internal/experiment/webconnectivity/redirects.go +++ b/internal/experiment/webconnectivitylte/redirects.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte import "sync/atomic" diff --git a/internal/experiment/webconnectivity/secureflow.go b/internal/experiment/webconnectivitylte/secureflow.go similarity index 99% rename from internal/experiment/webconnectivity/secureflow.go rename to internal/experiment/webconnectivitylte/secureflow.go index d3999e5007..bda5f3306e 100644 --- a/internal/experiment/webconnectivity/secureflow.go +++ b/internal/experiment/webconnectivitylte/secureflow.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte // // SecureFlow diff --git a/internal/experiment/webconnectivity/summary.go b/internal/experiment/webconnectivitylte/summary.go similarity index 95% rename from internal/experiment/webconnectivity/summary.go rename to internal/experiment/webconnectivitylte/summary.go index 2865c88cff..a47bee822a 100644 --- a/internal/experiment/webconnectivity/summary.go +++ b/internal/experiment/webconnectivitylte/summary.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte // // Summary diff --git a/internal/experiment/webconnectivity/testkeys.go b/internal/experiment/webconnectivitylte/testkeys.go similarity index 99% rename from internal/experiment/webconnectivity/testkeys.go rename to internal/experiment/webconnectivitylte/testkeys.go index 5cd917f7b5..5e7d0ea9b7 100644 --- a/internal/experiment/webconnectivity/testkeys.go +++ b/internal/experiment/webconnectivitylte/testkeys.go @@ -1,4 +1,4 @@ -package webconnectivity +package webconnectivitylte // // TestKeys for web_connectivity. diff --git a/internal/registry/webconnectivityv05.go b/internal/registry/webconnectivityv05.go index 823a70d5b0..7697113f61 100644 --- a/internal/registry/webconnectivityv05.go +++ b/internal/registry/webconnectivityv05.go @@ -7,18 +7,18 @@ package registry // import ( - "github.com/ooni/probe-cli/v3/internal/experiment/webconnectivity" + "github.com/ooni/probe-cli/v3/internal/experiment/webconnectivitylte" "github.com/ooni/probe-cli/v3/internal/model" ) func init() { AllExperiments["web_connectivity@v0.5"] = &Factory{ build: func(config any) model.ExperimentMeasurer { - return webconnectivity.NewExperimentMeasurer( - config.(*webconnectivity.Config), + return webconnectivitylte.NewExperimentMeasurer( + config.(*webconnectivitylte.Config), ) }, - config: &webconnectivity.Config{}, + config: &webconnectivitylte.Config{}, interruptible: false, inputPolicy: model.InputOrQueryBackend, } diff --git a/script/gorenamepkg.bash b/script/gorenamepkg.bash new file mode 100755 index 0000000000..676929f3c8 --- /dev/null +++ b/script/gorenamepkg.bash @@ -0,0 +1,36 @@ +#!/bin/bash +set -euo pipefail + +if [[ $# -ne 2 ]]; then + echo "usage: $0 {name-before} {name-after}" 1>&2 + exit 1 +fi +name_before=$1 +shift +name_after=$1 +shift + +basename_before=$(basename $name_before) +basename_after=$(basename $name_after) + +echo "git mv $name_before $name_after" +git mv $name_before $name_after + +for file in $(find $name_after -type f -name \*.go); do + echo "replacing the package name of $file" + cat $file | sed -e "s|^package $basename_before|package $basename_after|g" \ + -e "s|^// Package $basename_before|// Package $basename_after|g" > $file.tmp + cat $file.tmp > $file + rm $file.tmp +done + +pkg_prefix=github.com/ooni/probe-cli/v3 +pkg_before=$pkg_prefix/$name_before +pkg_after=$pkg_prefix/$name_after + +for file in $(find . -type f -name \*.go); do + echo "editing the import path of $file" + cat $file | sed -e "s|\"$pkg_before\"|\"$pkg_after\"|g" > $file.tmp + cat $file.tmp > $file + rm $file.tmp +done