Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: prepare for renaming all experiments #1032

Merged
merged 3 commits into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

//
// DNS analysis
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

//
// HTTP core analysis
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

//
// HTTP diff analysis
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

//
// TCP/IP analysis
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

//
// TLS analysis
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

//
// CleartextFlow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

//
// Config
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

import "sync"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

//
// DNSResolvers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

//
// Input parsing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

//
// Extensions to incrementally stream-reading a response body.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

//
// Measurer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

//
// Determine which connection(s) are allowed to fetch the webpage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

import "sync/atomic"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

//
// SecureFlow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

//
// Summary
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webconnectivity
package webconnectivitylte

//
// TestKeys for web_connectivity.
Expand Down
8 changes: 4 additions & 4 deletions internal/registry/webconnectivityv05.go
Original file line number Diff line number Diff line change
Expand Up @@ -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["[email protected]"] = &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,
}
Expand Down
36 changes: 36 additions & 0 deletions script/gorenamepkg.bash
Original file line number Diff line number Diff line change
@@ -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