GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Only return "error" key if "functional" is false.

parent 77e506c1
......@@ -46,19 +46,37 @@ Output
The service responds with the following JSON:
{
"functional": BOOL
"error": "STRING"
"functional": BOOL,
"error": "STRING", (only present if "functional" is false.)
"time": FLOAT
}
If tor could bootstrap over the given bridge line, `functional` is `true` and
`false` otherwise. If `functional` is `false`, "error" will contain an error
string. `time` is a float that represents the number of seconds that
If tor could bootstrap over the given bridge line, "functional" is "true" and
"false" otherwise. If "functional" is "false", "error" will contain an error
string. "time" is a float that represents the number of seconds that
bridgestrap's test took.
Here are a few examples:
* `{"functional":false,"error":"Invalid JSON request.","time":0}`
* `{"functional":false,"error":"Oct 23 17:36:57.000 [warn] Problem bootstrapping. Stuck at 10%: Finishing handshake with directory server. (DONE; DONE; count 1; recommendation warn; host [REDACTED])","time":32.31}`
* `{"functional":false,"error":"Oct 23 17:34:57.680 [warn] Too few items to Bridge line.","time":0.013}`
* `{"functional":true,"error":"","time":13.161}`
{
"functional":false,
"error":"Invalid JSON request.",
"time":0
}
{
"functional":false,
"error":"Oct 23 17:36:57.000 [warn] Problem bootstrapping. Stuck at 10%: Finishing handshake with directory server. (DONE; DONE; count 1; recommendation warn; host [REDACTED])",
"time":32.31
}
{
"functional":false,
"error":"Oct 23 17:34:57.680 [warn] Too few items to Bridge line.",
"time":0.013
}
{
"functional":true,
"time":13.161
}
......@@ -19,7 +19,7 @@ var FailurePage string
// object.
type TestResult struct {
Functional bool `json:"functional"`
Error string `json:"error"`
Error string `json:"error,omitempty"`
Time float64 `json:"time"`
}
......
......@@ -16,7 +16,7 @@ func TestCreateJsonResult(t *testing.T) {
t.Errorf("Got unexpected JSON: %s", json)
}
expected = `{"functional":true,"error":"","time":1}`
expected = `{"functional":true,"time":1}`
now = time.Now()
then = now.Add(time.Duration(-1) * time.Second)
json = createJsonResult(nil, then)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment