-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: more changes to facilitate debugging
- Loading branch information
1 parent
6e72744
commit a372027
Showing
2 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
//go:build ooni_libtor | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"net/http" | ||
"time" | ||
|
||
"github.com/apex/log" | ||
"github.com/ooni/probe-cli/v3/internal/experiment/torsf" | ||
"github.com/ooni/probe-cli/v3/internal/kvstore" | ||
"github.com/ooni/probe-cli/v3/internal/model" | ||
"github.com/ooni/probe-cli/v3/internal/model/mocks" | ||
"github.com/ooni/probe-cli/v3/internal/runtimex" | ||
) | ||
|
||
func runit() { | ||
measurer := torsf.NewExperimentMeasurer(torsf.Config{ | ||
DisablePersistentDatadir: false, | ||
DisableProgress: false, | ||
RendezvousMethod: "", | ||
}) | ||
meas := &model.Measurement{} | ||
err := measurer.Run( | ||
context.Background(), | ||
&model.ExperimentArgs{ | ||
Callbacks: model.NewPrinterCallbacks(model.DiscardLogger), | ||
Measurement: meas, | ||
Session: &mocks.Session{ | ||
MockDefaultHTTPClient: func() model.HTTPClient { | ||
return http.DefaultClient | ||
}, | ||
MockKeyValueStore: func() model.KeyValueStore { | ||
return &kvstore.Memory{} | ||
}, | ||
MockLogger: func() model.Logger { | ||
return log.Log | ||
}, | ||
MockSoftwareName: func() string { | ||
return "miniooni" | ||
}, | ||
MockSoftwareVersion: func() string { | ||
return "0.1.0-dev" | ||
}, | ||
MockTempDir: func() string { | ||
return "x/tmp" | ||
}, | ||
MockTunnelDir: func() string { | ||
return "x/tunnel" | ||
}, | ||
MockUserAgent: func() string { | ||
return model.HTTPHeaderUserAgent | ||
}, | ||
}, | ||
}, | ||
) | ||
runtimex.PanicOnError(err, "measurer.Run failed") | ||
tk := meas.TestKeys.(*torsf.TestKeys) | ||
runtimex.Assert(tk.Success, "did not succeed") | ||
} | ||
|
||
func main() { | ||
for { | ||
runit() | ||
log.Info("************* now let's wait a bit ********************************") | ||
time.Sleep(45 * time.Second) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
//go:build ooni_libtor && android | ||
//go:build ooni_libtor && (android || linux) | ||
|
||
package tunnel | ||
|
||
|