2021-12-15 14:16:22 +01:00
|
|
|
//go:build !android && !ios
|
|
|
|
|
|
|
|
package tunnel
|
|
|
|
|
|
|
|
// This file implements our strategy for running tor on desktop.
|
|
|
|
|
2022-01-25 20:43:27 +01:00
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/cretz/bine/tor"
|
|
|
|
)
|
2021-12-15 14:16:22 +01:00
|
|
|
|
|
|
|
// getTorStartConf in this configuration uses torExePath to get a
|
|
|
|
// suitable tor binary and then executes it.
|
|
|
|
func getTorStartConf(config *Config, dataDir string, extraArgs []string) (*tor.StartConf, error) {
|
|
|
|
exePath, err := config.torBinary()
|
|
|
|
if err != nil {
|
2022-01-25 20:43:27 +01:00
|
|
|
config.logger().Warnf("cannot find tor binary: %s", err.Error())
|
2021-12-15 14:16:22 +01:00
|
|
|
return nil, err
|
|
|
|
}
|
2022-01-25 20:43:27 +01:00
|
|
|
config.logger().Infof("tunnel: tor: exec: %s %s %s", exePath,
|
|
|
|
dataDir, strings.Join(extraArgs, " "))
|
2021-12-15 14:16:22 +01:00
|
|
|
return &tor.StartConf{
|
|
|
|
ExePath: exePath,
|
|
|
|
DataDir: dataDir,
|
|
|
|
ExtraArgs: extraArgs,
|
|
|
|
NoHush: true,
|
|
|
|
}, nil
|
|
|
|
}
|