feat: use ooni/probe-engine@286613b74e and cleanup (#177)
* feat: use ooni/probe-engine@286613b74e and cleanup 1. zap unused configuration settings from the config file but do not bump the version number because doing that _may_ interact in unexpected ways with probe-desktop (hence https://github.com/ooni/probe/issues/1297) and also because we've just _removed_ stuff for now, therefore any previous configuration file will continue to work, except that we'll be ignoring a bunch of options. In a future version of probe-cli I'll spend some time to further improve config file management. 2. accordingly, make sure all current configuration files that are around in the tree are current and only feature supported options. 3. update to ooni/probe-engine@286613b74e, which contains a bunch of APIs that should allow us to simplify the interaction between the cli and the engine, by sharing code more cleverly. 4. zap GetTestKeys because now we use code in probe-engine instead. 5. zap LogSummary because it was not being used. 6. the main change related to cleaning up the config and to the update to the latest probe-engine is that include_{cc,asn,ip} settings are gone and we now share the CC and the ASN and we never share the IP addr. Reference issue: https://github.com/ooni/probe/issues/1283. After this change is landed, there's a bunch more work to do to further unify cli and engine. The final state will be that the cli uses ~the code used by miniooni, so it will have a bunch of desirable options. * fix: bindata after recent changes
This commit is contained in:
parent
e4ef279b80
commit
95906fbcce
21 changed files with 13 additions and 495 deletions
|
|
@ -14,59 +14,3 @@ func (h Tor) Run(ctl *Controller) error {
|
|||
}
|
||||
return ctl.Run(builder, []string{""})
|
||||
}
|
||||
|
||||
// TorTestKeys contains the test keys
|
||||
type TorTestKeys struct {
|
||||
DirPortTotal int64 `json:"dir_port_total"`
|
||||
DirPortAccessible int64 `json:"dir_port_accessible"`
|
||||
IsAnomaly bool `json:"-"`
|
||||
OBFS4Total int64 `json:"obfs4_total"`
|
||||
OBFS4Accessible int64 `json:"obfs4_accessible"`
|
||||
ORPortDirauthTotal int64 `json:"or_port_dirauth_total"`
|
||||
ORPortDirauthAccessible int64 `json:"or_port_dirauth_accessible"`
|
||||
ORPortTotal int64 `json:"or_port_total"`
|
||||
ORPortAccessible int64 `json:"or_port_accessible"`
|
||||
}
|
||||
|
||||
// GetTestKeys generates a summary for a test run
|
||||
func (h Tor) GetTestKeys(tk map[string]interface{}) (interface{}, error) {
|
||||
testKeys := TorTestKeys{IsAnomaly: false}
|
||||
// Implementation note: when Go marshals into an interface, it marshals to
|
||||
// float64 rather than int64, so we need to do some more work here.
|
||||
//
|
||||
// See <https://golang.org/pkg/encoding/json/#Unmarshal>.
|
||||
if tk["dir_port_total"] != nil {
|
||||
testKeys.DirPortTotal = int64(tk["dir_port_total"].(float64))
|
||||
}
|
||||
if tk["dir_port_accessible"] != nil {
|
||||
testKeys.DirPortAccessible = int64(tk["dir_port_accessible"].(float64))
|
||||
}
|
||||
if tk["obfs4_total"] != nil {
|
||||
testKeys.OBFS4Total = int64(tk["obfs4_total"].(float64))
|
||||
}
|
||||
if tk["obfs4_accessible"] != nil {
|
||||
testKeys.OBFS4Accessible = int64(tk["obfs4_accessible"].(float64))
|
||||
}
|
||||
if tk["or_port_dirauth_total"] != nil {
|
||||
testKeys.ORPortDirauthTotal = int64(tk["or_port_dirauth_total"].(float64))
|
||||
}
|
||||
if tk["or_port_dirauth_accessible"] != nil {
|
||||
testKeys.ORPortDirauthAccessible = int64(tk["or_port_dirauth_accessible"].(float64))
|
||||
}
|
||||
if tk["or_port_total"] != nil {
|
||||
testKeys.ORPortTotal = int64(tk["or_port_total"].(float64))
|
||||
}
|
||||
if tk["or_port_accessible"] != nil {
|
||||
testKeys.ORPortAccessible = int64(tk["or_port_accessible"].(float64))
|
||||
}
|
||||
testKeys.IsAnomaly = ((testKeys.DirPortAccessible <= 0 && testKeys.DirPortTotal > 0) ||
|
||||
(testKeys.OBFS4Accessible <= 0 && testKeys.OBFS4Total > 0) ||
|
||||
(testKeys.ORPortDirauthAccessible <= 0 && testKeys.ORPortDirauthTotal > 0) ||
|
||||
(testKeys.ORPortAccessible <= 0 && testKeys.ORPortTotal > 0))
|
||||
return testKeys, nil
|
||||
}
|
||||
|
||||
// LogSummary writes the summary to the standard output
|
||||
func (h Tor) LogSummary(s string) error {
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue