clean up Start logs and err
This commit is contained in:
parent
a0770a3f1b
commit
9ab706cf02
|
@ -341,7 +341,7 @@ func newHideCmd(exePath string) process.Creator {
|
|||
|
||||
func (tp *torProvider) checkVersion() error {
|
||||
// attempt connect to system tor
|
||||
log.Debugf("dialing system tor control port")
|
||||
log.Debugf("dialing tor control port")
|
||||
controlport, err := dialControlPort(tp.controlPort)
|
||||
if err == nil {
|
||||
defer controlport.Close()
|
||||
|
@ -373,11 +373,11 @@ func startTor(appDirectory string, bundledTorPath string, controlPort int, authe
|
|||
|
||||
tp := &torProvider{authenticator: authenticator, controlPort: controlPort, appDirectory: appDirectory, bundeledTorPath: bundledTorPath, childListeners: make(map[string]*onionListenService), breakChan: make(chan bool), statusCallback: nil, lastRestartTime: time.Now().Add(-restartCooldown)}
|
||||
|
||||
log.Debugf("launching system tor")
|
||||
log.Debugf("checking if there is a running system tor")
|
||||
if err := tp.checkVersion(); err == nil {
|
||||
controlport, err := dialControlPort(tp.controlPort)
|
||||
if err == nil {
|
||||
log.Debugf("creating tor handler fom system tor")
|
||||
log.Debugf("creating tor handler from system tor")
|
||||
tp.t = createFromExisting(controlport, dataDir)
|
||||
}
|
||||
tp.dialer, err = tp.t.Dialer(context.TODO(), &tor.DialConf{Authenticator: tp.authenticator})
|
||||
|
@ -392,6 +392,7 @@ func startTor(appDirectory string, bundledTorPath string, controlPort int, authe
|
|||
}
|
||||
|
||||
// if not, try running system tor
|
||||
log.Debugln("checking if we can run system installed tor or bundled tor")
|
||||
if checkCmdlineTorVersion("tor") {
|
||||
t, err := tor.Start(context.TODO(), &tor.StartConf{ControlPort: tp.controlPort, DisableCookieAuth: true, UseEmbeddedControlConn: false, DisableEagerAuth: true, EnableNetwork: true, DataDir: dataDir, TorrcFile: path.Join(torDir, "torrc"), DebugWriter: nil, ProcessCreator: newHideCmd("tor")})
|
||||
if err != nil {
|
||||
|
@ -400,13 +401,16 @@ func startTor(appDirectory string, bundledTorPath string, controlPort int, authe
|
|||
}
|
||||
tp.t = t
|
||||
} else if bundledTorPath != "" && checkCmdlineTorVersion(bundledTorPath) {
|
||||
log.Debugln("attempting using bundled tor '" + bundledTorPath + "'")
|
||||
log.Debugln("bundled tor appears viable, attempting to use '" + bundledTorPath + "'")
|
||||
t, err := tor.Start(context.TODO(), &tor.StartConf{ControlPort: tp.controlPort, DisableCookieAuth: true, UseEmbeddedControlConn: false, DisableEagerAuth: true, EnableNetwork: true, DataDir: dataDir, TorrcFile: path.Join(torDir, "torrc"), ExePath: bundledTorPath, DebugWriter: nil, ProcessCreator: newHideCmd(bundledTorPath)})
|
||||
if err != nil {
|
||||
log.Debugf("Error running bundled tor %v\n", err)
|
||||
return nil, err
|
||||
}
|
||||
tp.t = t
|
||||
} else {
|
||||
log.Debugln("Could not find a viable tor running or to run")
|
||||
return nil, fmt.Errorf("Could not connect to or start Tor that met requirements (min Tor version 0.3.5.x)")
|
||||
}
|
||||
|
||||
err = tp.checkVersion()
|
||||
|
@ -415,7 +419,7 @@ func startTor(appDirectory string, bundledTorPath string, controlPort int, authe
|
|||
tp.dialer, err = tp.t.Dialer(context.TODO(), &tor.DialConf{Authenticator: tp.authenticator})
|
||||
return tp, err
|
||||
}
|
||||
return nil, fmt.Errorf("could not connect to or start Tor that met requirments (min Tor version 0.3.5.x): %v", err)
|
||||
return nil, fmt.Errorf("could not connect to running tor: %v", err)
|
||||
}
|
||||
|
||||
func (tp *torProvider) GetPID() (int, error) {
|
||||
|
|
Loading…
Reference in New Issue