feat(torsf): collect tor logs, select rendezvous method, count bytes (#683)
This diff contains significant improvements over the previous implementation of the torsf experiment. We add support for configuring different rendezvous methods after the convo at https://github.com/ooni/probe/issues/2004. In doing that, I've tried to use a terminology that is consistent with the names being actually used by tor developers. In terms of what to do next, this diff basically instruments torsf to always rendezvous using domain fronting. Yet, it's also possible to change the rendezvous method from the command line, when using miniooni, which allows to experiment a bit more. In the same vein, by default we use a persistent tor datadir, but it's also possible to use a temporary datadir using the cmdline. Here's how a generic invocation of `torsf` looks like: ```bash ./miniooni -O DisablePersistentDatadir=true \ -O RendezvousMethod=amp \ -O DisableProgress=true \ torsf ``` (The default is `DisablePersistentDatadir=false` and `RendezvousMethod=domain_fronting`.) With this implementation, we can start measuring whether snowflake and tor together can boostrap, which seems the most important thing to focus on at the beginning. Understanding why the bootstrap most often does not converge with a temporary datadir on Android devices remains instead an open problem for now. (I'll also update the relevant issues or create new issues after commit this.) We also address some methodology improvements that were proposed in https://github.com/ooni/probe/issues/1686. Namely: 1. we record the tor version; 2. we include the bootstrap percentage by reading the logs; 3. we set the anomaly key correctly; 4. we measure the bytes send and received (by `tor` not by `snowflake`, since doing it for snowflake seems more complex at this stage). What remains to be done is the possibility of including Snowflake events into the measurement, which is not possible until the new improvements at common/event in snowflake.git are included into a tagged version of snowflake itself. (I'll make sure to mention this aspect to @cohosh in https://github.com/ooni/probe/issues/2004.)
This commit is contained in:
parent
4e5f9bd254
commit
85664f1e31
40 changed files with 1124 additions and 308 deletions
|
|
@ -74,6 +74,22 @@ var ErrEmptyTunnelDir = errors.New("TunnelDir is empty")
|
|||
// is not supported by this package.
|
||||
var ErrUnsupportedTunnelName = errors.New("unsupported tunnel name")
|
||||
|
||||
// DebugInfo contains information useful to debug issues
|
||||
// when starting up a given tunnel fails.
|
||||
type DebugInfo struct {
|
||||
// LogFilePath is the path to the log file, which MAY
|
||||
// be empty in case we don't have a log file.
|
||||
LogFilePath string
|
||||
|
||||
// Name is the name of the tunnel and will always
|
||||
// be properly set by the code.
|
||||
Name string
|
||||
|
||||
// Version is the tunnel version. This field MAY be
|
||||
// empty if we don't know the version.
|
||||
Version string
|
||||
}
|
||||
|
||||
// Start starts a new tunnel by name or returns an error. We currently
|
||||
// support the following tunnels:
|
||||
//
|
||||
|
|
@ -94,7 +110,15 @@ var ErrUnsupportedTunnelName = errors.New("unsupported tunnel name")
|
|||
// The "fake" tunnel is a fake tunnel that just exposes a
|
||||
// SOCKS5 proxy and then connects directly to server. We use
|
||||
// this special kind of tunnel to implement tests.
|
||||
func Start(ctx context.Context, config *Config) (Tunnel, error) {
|
||||
//
|
||||
// The return value is a triple:
|
||||
//
|
||||
// 1. a valid Tunnel on success, nil on failure;
|
||||
//
|
||||
// 2. debugging information (both on success and failure);
|
||||
//
|
||||
// 3. nil on success, an error on failure.
|
||||
func Start(ctx context.Context, config *Config) (Tunnel, DebugInfo, error) {
|
||||
switch config.Name {
|
||||
case "fake":
|
||||
return fakeStart(ctx, config)
|
||||
|
|
@ -103,6 +127,7 @@ func Start(ctx context.Context, config *Config) (Tunnel, error) {
|
|||
case "tor":
|
||||
return torStart(ctx, config)
|
||||
default:
|
||||
return nil, fmt.Errorf("%w: %s", ErrUnsupportedTunnelName, config.Name)
|
||||
di := DebugInfo{}
|
||||
return nil, di, fmt.Errorf("%w: %s", ErrUnsupportedTunnelName, config.Name)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue