tor error msgs (#17)
This commit is contained in:
parent
81a52e33d1
commit
f41f2b823a
2 changed files with 5 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"log"
|
"log"
|
||||||
|
@ -101,7 +102,7 @@ func (a *App) Run() error {
|
||||||
onion.Ports[80] = fmt.Sprintf("%s:%d", cs.Host, cs.Port)
|
onion.Ports[80] = fmt.Sprintf("%s:%d", cs.Host, cs.Port)
|
||||||
err = a.Tor.Controller.AddOnion(onion)
|
err = a.Tor.Controller.AddOnion(onion)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return errors.New("unable to start Tor onion service")
|
||||||
}
|
}
|
||||||
log.Printf("Onion service: http://%s.onion", onion.ServiceID)
|
log.Printf("Onion service: http://%s.onion", onion.ServiceID)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
@ -17,7 +18,7 @@ func newTor(ct *TorConfig) (*tor, error) {
|
||||||
addr := fmt.Sprintf("%s:%d", ct.Controller.Host, ct.Controller.Port)
|
addr := fmt.Sprintf("%s:%d", ct.Controller.Host, ct.Controller.Port)
|
||||||
ctrl, err := torgo.NewController(addr)
|
ctrl, err := torgo.NewController(addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, errors.New("unable to connect to Tor controller")
|
||||||
}
|
}
|
||||||
if len(ct.Controller.Password) > 0 {
|
if len(ct.Controller.Password) > 0 {
|
||||||
err = ctrl.AuthenticatePassword(ct.Controller.Password)
|
err = ctrl.AuthenticatePassword(ct.Controller.Password)
|
||||||
|
@ -28,7 +29,7 @@ func newTor(ct *TorConfig) (*tor, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, errors.New("unable to authenticate to Tor controller")
|
||||||
}
|
}
|
||||||
key, err := onionkey.ReadFile("onion.key")
|
key, err := onionkey.ReadFile("onion.key")
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
|
|
Loading…
Reference in a new issue