tor error msgs (#17)

This commit is contained in:
davy wybiral 2019-08-08 05:08:29 -05:00 committed by GitHub
parent 81a52e33d1
commit f41f2b823a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -2,6 +2,7 @@
package app
import (
"errors"
"fmt"
"html/template"
"log"
@ -101,7 +102,7 @@ func (a *App) Run() error {
onion.Ports[80] = fmt.Sprintf("%s:%d", cs.Host, cs.Port)
err = a.Tor.Controller.AddOnion(onion)
if err != nil {
return err
return errors.New("unable to start Tor onion service")
}
log.Printf("Onion service: http://%s.onion", onion.ServiceID)
}

View file

@ -1,6 +1,7 @@
package app
import (
"errors"
"fmt"
"os"
@ -17,7 +18,7 @@ func newTor(ct *TorConfig) (*tor, error) {
addr := fmt.Sprintf("%s:%d", ct.Controller.Host, ct.Controller.Port)
ctrl, err := torgo.NewController(addr)
if err != nil {
return nil, err
return nil, errors.New("unable to connect to Tor controller")
}
if len(ct.Controller.Password) > 0 {
err = ctrl.AuthenticatePassword(ct.Controller.Password)
@ -28,7 +29,7 @@ func newTor(ct *TorConfig) (*tor, error) {
}
}
if err != nil {
return nil, err
return nil, errors.New("unable to authenticate to Tor controller")
}
key, err := onionkey.ReadFile("onion.key")
if os.IsNotExist(err) {