feat(miniooni): implement torsf tunnel (#921)

This diff adds to miniooni support for using the torsf tunnel. Such a
tunnel consists of a snowflake pluggable transport in front of a custom
instance of tor and requires tor to be installed.

The usage is like:

```
./miniooni --tunnel=torsf [...]
```

The default snowflake rendezvous method is "domain_fronting". You can
select the AMP cache instead using "amp":

```
./miniooni --snowflake-rendezvous=amp --tunnel=torsf [...]
```

Part of https://github.com/ooni/probe/issues/1955
This commit is contained in:
Simone Basso
2022-10-03 16:52:20 +02:00
committed by GitHub
parent 5466f30526
commit 18a9523496
10 changed files with 438 additions and 57 deletions
+28 -20
View File
@@ -25,25 +25,26 @@ import (
// Options contains the options you can set from the CLI.
type Options struct {
Annotations []string
Emoji bool
ExtraOptions []string
HomeDir string
Inputs []string
InputFilePaths []string
MaxRuntime int64
NoJSON bool
NoCollector bool
ProbeServicesURL string
Proxy string
Random bool
RepeatEvery int64
ReportFile string
TorArgs []string
TorBinary string
Tunnel string
Verbose bool
Yes bool
Annotations []string
Emoji bool
ExtraOptions []string
HomeDir string
Inputs []string
InputFilePaths []string
MaxRuntime int64
NoJSON bool
NoCollector bool
ProbeServicesURL string
Proxy string
Random bool
RepeatEvery int64
ReportFile string
SnowflakeRendezvous string
TorArgs []string
TorBinary string
Tunnel string
Verbose bool
Yes bool
}
// main is the main function of miniooni.
@@ -125,6 +126,13 @@ func main() {
"set the output report file path (default: \"report.jsonl\")",
)
flags.StringVar(
&globalOptions.SnowflakeRendezvous,
"snowflake-rendezvous",
"domain_fronting",
"rendezvous method for --tunnel=torsf (one of: \"domain_fronting\" and \"amp\")",
)
flags.StringSliceVar(
&globalOptions.TorArgs,
"tor-args",
@@ -143,7 +151,7 @@ func main() {
&globalOptions.Tunnel,
"tunnel",
"",
"tunnel to use to communicate with the OONI backend (one of: tor, psiphon)",
"tunnel to use to communicate with the OONI backend (one of: psiphon, tor, torsf)",
)
flags.BoolVarP(
+9 -8
View File
@@ -36,14 +36,15 @@ func newSessionOrPanic(ctx context.Context, currentOptions *Options,
runtimex.PanicOnError(err, "cannot create tunnelDir")
config := engine.SessionConfig{
KVStore: kvstore,
Logger: logger,
ProxyURL: proxyURL,
SoftwareName: softwareName,
SoftwareVersion: softwareVersion,
TorArgs: currentOptions.TorArgs,
TorBinary: currentOptions.TorBinary,
TunnelDir: tunnelDir,
KVStore: kvstore,
Logger: logger,
ProxyURL: proxyURL,
SnowflakeRendezvous: currentOptions.SnowflakeRendezvous,
SoftwareName: softwareName,
SoftwareVersion: softwareVersion,
TorArgs: currentOptions.TorArgs,
TorBinary: currentOptions.TorBinary,
TunnelDir: tunnelDir,
}
if currentOptions.ProbeServicesURL != "" {
config.AvailableProbeServices = []model.OOAPIService{{