libcwtch-go/utils/errorACN.go

53 lines
1.2 KiB
Go

package utils
import (
"errors"
"git.openprivacy.ca/openprivacy/connectivity"
"net"
)
// ErrorACN is a stub ACN handler used when no other valid ACN can be found. This is a critical error and as such
// this is only used when the only course of action is to close Cwtch and fix the underlying discovery problem...
type ErrorACN struct {
}
func (e ErrorACN) GetBootstrapStatus() (int, string) {
return -1, "could not find tor"
}
func (e ErrorACN) WaitTillBootstrapped() {
// instant
}
func (e ErrorACN) SetStatusCallback(callback func(int, string)) {
callback(-1, "could not find tor please restart cwtch with an active Tor in path")
}
func (e ErrorACN) Restart() {
// does nothing
}
func (e ErrorACN) Open(hostname string) (net.Conn, string, error) {
return nil,"", errors.New("could not find tor")
}
func (e ErrorACN) Listen(identity connectivity.PrivateKey, port int) (connectivity.ListenService, error) {
return nil, errors.New("could not find tor")
}
func (e ErrorACN) GetPID() (int, error) {
return 0, errors.New("could not find tor")
}
func (e ErrorACN) GetVersion() string {
return "could not find tor"
}
func (e ErrorACN) Close() {
// does nothing
}