GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still and

Add -tor switch that uses custom tor.

For reasons outlined in #2, we want to be
able to use a custom tor for now.  This patch introduces a new command
line switch, -tor, which makes this possible.
parent fa6c8fc4
......@@ -119,6 +119,7 @@ func main() {
var certFilename, keyFilename string
var cacheFile string
var templatesDir string
var torBinary string
var numSecs int
flag.StringVar(&addr, "addr", ":5000", "Address to listen on.")
......@@ -130,6 +131,7 @@ func main() {
flag.StringVar(&keyFilename, "key", "", "TLS private key file.")
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(&torBinary, "tor", "tor", "Path to tor executable.")
flag.IntVar(&numSecs, "seconds", 0, "Number of seconds after two subsequent requests are handled.")
......@@ -165,7 +167,7 @@ func main() {
torCtx = &TorContext{}
torCtx = &TorContext{TorBinary: torBinary}
if err = torCtx.Start(); err != nil {
log.Printf("Failed to start Tor process: %s", err)
......@@ -105,6 +105,7 @@ type TorContext struct {
DataDir string
Cancel context.CancelFunc
Context context.Context
TorBinary string
eventChan chan *bulb.Response
......@@ -158,7 +159,7 @@ func (c *TorContext) Start() error {
// Start our Tor process.
c.Context, c.Cancel = context.WithCancel(context.Background())
cmd := exec.CommandContext(c.Context, "tor", "-f", tmpFh.Name())
cmd := exec.CommandContext(c.Context, c.TorBinary, "-f", tmpFh.Name())
if err = cmd.Start(); err != nil {
return err
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