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.

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.")
flag.Parse()
......@@ -165,7 +167,7 @@ func main() {
return
}
torCtx = &TorContext{}
torCtx = &TorContext{TorBinary: torBinary}
if err = torCtx.Start(); err != nil {
log.Printf("Failed to start Tor process: %s", err)
return
......
......@@ -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