Spring cleanup: remove unused/unneded code (#761)
* cleanup: remove the archival package See https://github.com/ooni/probe/issues/2116 * cleanup: remove websteps fall 2021 edition See https://github.com/ooni/probe/issues/2116 * cleanup: remove JavaScript based testing framework https://github.com/ooni/probe/issues/2116 * cleanup: remove the unused ooapi package See https://github.com/ooni/probe/issues/2116
This commit is contained in:
@@ -20,9 +20,6 @@ import (
|
||||
"github.com/ooni/probe-cli/v3/internal/kvstore"
|
||||
"github.com/ooni/probe-cli/v3/internal/legacy/assetsdir"
|
||||
"github.com/ooni/probe-cli/v3/internal/model"
|
||||
"github.com/ooni/probe-cli/v3/internal/netxlite"
|
||||
"github.com/ooni/probe-cli/v3/internal/netxlite/filtering"
|
||||
"github.com/ooni/probe-cli/v3/internal/runtimex"
|
||||
"github.com/ooni/probe-cli/v3/internal/version"
|
||||
"github.com/pborman/getopt/v2"
|
||||
)
|
||||
@@ -30,7 +27,6 @@ import (
|
||||
// Options contains the options you can set from the CLI.
|
||||
type Options struct {
|
||||
Annotations []string
|
||||
Censor string
|
||||
ExtraOptions []string
|
||||
HomeDir string
|
||||
Inputs []string
|
||||
@@ -65,10 +61,6 @@ func init() {
|
||||
getopt.FlagLong(
|
||||
&globalOptions.Annotations, "annotation", 'A', "Add annotaton", "KEY=VALUE",
|
||||
)
|
||||
getopt.FlagLong(
|
||||
&globalOptions.Censor, "censor", 0,
|
||||
"Specifies censorship rules to apply for QA purposes", "FILE",
|
||||
)
|
||||
getopt.FlagLong(
|
||||
&globalOptions.ExtraOptions, "option", 'O',
|
||||
"Pass an option to the experiment", "KEY=VALUE",
|
||||
@@ -316,17 +308,6 @@ func MainWithConfiguration(experimentName string, currentOptions Options) {
|
||||
}
|
||||
log.Log = logger
|
||||
|
||||
if currentOptions.Censor != "" {
|
||||
config, err := filtering.NewTProxyConfig(currentOptions.Censor)
|
||||
runtimex.PanicOnError(err, "cannot parse --censor file as JSON")
|
||||
tproxy, err := filtering.NewTProxy(config, log.Log)
|
||||
runtimex.PanicOnError(err, "cannot create tproxy instance")
|
||||
defer tproxy.Close()
|
||||
netxlite.TProxy = tproxy
|
||||
log.Infof("miniooni: disabling submission with --censor to avoid pulluting OONI data")
|
||||
currentOptions.NoCollector = true
|
||||
}
|
||||
|
||||
//Mon Jan 2 15:04:05 -0700 MST 2006
|
||||
log.Infof("Current time: %s", time.Now().Format("2006-01-02 15:04:05 MST"))
|
||||
|
||||
|
||||
@@ -11,9 +11,7 @@ import (
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/ooni/probe-cli/v3/internal/cmd/oohelper/internal"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/experiment/webstepsx"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx"
|
||||
"github.com/ooni/probe-cli/v3/internal/measurex"
|
||||
"github.com/ooni/probe-cli/v3/internal/model"
|
||||
"github.com/ooni/probe-cli/v3/internal/runtimex"
|
||||
)
|
||||
@@ -25,7 +23,6 @@ var (
|
||||
resolver model.Resolver
|
||||
server = flag.String("server", "", "URL of the test helper")
|
||||
target = flag.String("target", "", "Target URL for the test helper")
|
||||
fwebsteps = flag.Bool("websteps", false, "Use the websteps TH")
|
||||
)
|
||||
|
||||
func newhttpclient() *http.Client {
|
||||
@@ -54,34 +51,12 @@ func main() {
|
||||
}
|
||||
flag.Parse()
|
||||
log.SetLevel(logmap[*debug])
|
||||
apimap := map[bool]func() interface{}{
|
||||
false: wcth,
|
||||
true: webstepsth,
|
||||
}
|
||||
cresp := apimap[*fwebsteps]()
|
||||
cresp := wcth()
|
||||
data, err := json.MarshalIndent(cresp, "", " ")
|
||||
runtimex.PanicOnError(err, "json.MarshalIndent failed")
|
||||
fmt.Printf("%s\n", string(data))
|
||||
}
|
||||
|
||||
func webstepsth() interface{} {
|
||||
serverURL := *server
|
||||
if serverURL == "" {
|
||||
serverURL = "https://1.th.ooni.org/api/v1/websteps"
|
||||
}
|
||||
clnt := &webstepsx.THClient{
|
||||
DNServers: []*measurex.ResolverInfo{{
|
||||
Network: "udp",
|
||||
Address: "8.8.4.4:53",
|
||||
}},
|
||||
HTTPClient: httpClient,
|
||||
ServerURL: serverURL,
|
||||
}
|
||||
cresp, err := clnt.Run(ctx, *target)
|
||||
runtimex.PanicOnError(err, "client.Run failed")
|
||||
return cresp
|
||||
}
|
||||
|
||||
func wcth() interface{} {
|
||||
serverURL := *server
|
||||
if serverURL == "" {
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/ooni/probe-cli/v3/internal/cmd/oohelperd/internal/webconnectivity"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/experiment/webstepsx"
|
||||
"github.com/ooni/probe-cli/v3/internal/engine/netx"
|
||||
"github.com/ooni/probe-cli/v3/internal/model"
|
||||
"github.com/ooni/probe-cli/v3/internal/runtimex"
|
||||
@@ -58,7 +57,6 @@ func main() {
|
||||
|
||||
func testableMain() {
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle("/api/v1/websteps", &webstepsx.THHandler{})
|
||||
mux.Handle("/", webconnectivity.Handler{
|
||||
Client: httpx,
|
||||
Dialer: dialer,
|
||||
|
||||
Reference in New Issue
Block a user