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.

Make bridge test timeout configurable.

parent 933d6234
...@@ -120,6 +120,7 @@ func main() { ...@@ -120,6 +120,7 @@ func main() {
var cacheFile string var cacheFile string
var templatesDir string var templatesDir string
var torBinary string var torBinary string
var testTimeout int
flag.StringVar(&addr, "addr", ":5000", "Address to listen on.") flag.StringVar(&addr, "addr", ":5000", "Address to listen on.")
flag.BoolVar(&web, "web", false, "Enable the web interface (in addition to the JSON API).") flag.BoolVar(&web, "web", false, "Enable the web interface (in addition to the JSON API).")
...@@ -131,6 +132,7 @@ func main() { ...@@ -131,6 +132,7 @@ func main() {
flag.StringVar(&cacheFile, "cache", "bridgestrap-cache.bin", "Cache file that contains test results.") flag.StringVar(&cacheFile, "cache", "bridgestrap-cache.bin", "Cache file that contains test results.")
flag.StringVar(&templatesDir, "templates", "templates", "Path to directory that contains our web templates.") flag.StringVar(&templatesDir, "templates", "templates", "Path to directory that contains our web templates.")
flag.StringVar(&torBinary, "tor", "tor", "Path to tor executable.") flag.StringVar(&torBinary, "tor", "tor", "Path to tor executable.")
flag.IntVar(&testTimeout, "timeout", 60, "Test timeout in seconds.")
flag.Parse() flag.Parse()
if showVersion { if showVersion {
...@@ -165,6 +167,8 @@ func main() { ...@@ -165,6 +167,8 @@ func main() {
return return
} }
TorTestTimeout = time.Duration(testTimeout) * time.Second
log.Printf("Setting Tor test timeout to %s.", TorTestTimeout)
torCtx = &TorContext{TorBinary: torBinary} torCtx = &TorContext{TorBinary: torBinary}
if err = torCtx.Start(); err != nil { if err = torCtx.Start(); err != nil {
log.Printf("Failed to start Tor process: %s", err) log.Printf("Failed to start Tor process: %s", err)
......
...@@ -23,12 +23,13 @@ const ( ...@@ -23,12 +23,13 @@ const (
DefaultBridge1 = "obfs4 192.95.36.142:443 CDF2E852BF539B82BD10E27E9115A31734E378C2 cert=qUVQ0srL1JI/vO6V6m/24anYXiJD3QP2HgzUKQtQ7GRqqUvs7P+tG43RtAqdhLOALP7DJQ iat-mode=1" DefaultBridge1 = "obfs4 192.95.36.142:443 CDF2E852BF539B82BD10E27E9115A31734E378C2 cert=qUVQ0srL1JI/vO6V6m/24anYXiJD3QP2HgzUKQtQ7GRqqUvs7P+tG43RtAqdhLOALP7DJQ iat-mode=1"
DefaultBridge2 = "obfs4 193.11.166.194:27015 2D82C2E354D531A68469ADF7F878FA6060C6BACA cert=4TLQPJrTSaDffMK7Nbao6LC7G9OW/NHkUwIdjLSS3KYf0Nv4/nQiiI8dY2TcsQx01NniOg iat-mode=0" DefaultBridge2 = "obfs4 193.11.166.194:27015 2D82C2E354D531A68469ADF7F878FA6060C6BACA cert=4TLQPJrTSaDffMK7Nbao6LC7G9OW/NHkUwIdjLSS3KYf0Nv4/nQiiI8dY2TcsQx01NniOg iat-mode=0"
DefaultBridge3 = "obfs4 37.218.245.14:38224 D9A82D2F9C2F65A18407B1D2B764F130847F8B5D cert=bjRaMrr1BRiAW8IE9U5z27fQaYgOhX1UCmOpg2pFpoMvo6ZgQMzLsaTzzQNTlm7hNcb+Sg iat-mode=0" DefaultBridge3 = "obfs4 37.218.245.14:38224 D9A82D2F9C2F65A18407B1D2B764F130847F8B5D cert=bjRaMrr1BRiAW8IE9U5z27fQaYgOhX1UCmOpg2pFpoMvo6ZgQMzLsaTzzQNTlm7hNcb+Sg iat-mode=0"
// The amount of time we give Tor to test a batch of bridges.
TorTestTimeout = time.Minute
// The maximum amount of bridges per batch. // The maximum amount of bridges per batch.
MaxBridgesPerReq = 100 MaxBridgesPerReq = 100
) )
// The amount of time we give Tor to test a batch of bridges.
var TorTestTimeout time.Duration
// getBridgeIdentifier turns the given bridgeLine into a canonical identifier // getBridgeIdentifier turns the given bridgeLine into a canonical identifier
// that we use to look for relevant ORCONN events. If the given bridge line // that we use to look for relevant ORCONN events. If the given bridge line
// contains a fingerprint, the function returns $FINGERPRINT. If it doesn't, // contains a fingerprint, the function returns $FINGERPRINT. If it doesn't,
......
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