Fix errorAcn reference issues + add support for Tor specific shared library path #43
|
@ -4,4 +4,6 @@ tor/tor/
|
|||
vendor/
|
||||
*.cover.out
|
||||
tmp/
|
||||
testing/tor/*
|
||||
testing/tor/*
|
||||
tor/data-dir*
|
||||
testing/data-dir*
|
|
@ -7,6 +7,10 @@ A library providing an ACN (Anonymous Communication Network
|
|||
|
||||
* Tor v3 Onion Services
|
||||
|
||||
## Environment Variables
|
||||
|
||||
- `TOR_LD_LIBRARY_PATH` - override the library path given to the Tor process as different from the one given to the parent process.
|
||||
|
||||
## Requirements for ACN Support
|
||||
|
||||
* Reference an EndPoint via a string / hostname
|
||||
|
|
20
error_acn.go
20
error_acn.go
|
@ -15,11 +15,11 @@ type ErrorACN struct {
|
|||
versionCallbackCache func(string)
|
||||
}
|
||||
|
||||
func (e ErrorACN) GetStatusCallback() func(int, string) {
|
||||
func (e *ErrorACN) GetStatusCallback() func(int, string) {
|
||||
return e.statusCallbackCache
|
||||
}
|
||||
|
||||
func (e ErrorACN) GetVersionCallback() func(string) {
|
||||
func (e *ErrorACN) GetVersionCallback() func(string) {
|
||||
return e.versionCallbackCache
|
||||
}
|
||||
|
||||
|
@ -27,11 +27,11 @@ func (e *ErrorACN) GetInfo(addr string) (map[string]string, error) {
|
|||
return nil, errors.New(acnError)
|
||||
}
|
||||
|
||||
func (e ErrorACN) GetBootstrapStatus() (int, string) {
|
||||
func (e *ErrorACN) GetBootstrapStatus() (int, string) {
|
||||
return -1, acnError
|
||||
}
|
||||
|
||||
func (e ErrorACN) WaitTillBootstrapped() error {
|
||||
func (e *ErrorACN) WaitTillBootstrapped() error {
|
||||
return errors.New(acnError)
|
||||
}
|
||||
|
||||
|
@ -43,24 +43,24 @@ func (e *ErrorACN) SetVersionCallback(callback func(string)) {
|
|||
e.versionCallbackCache = callback
|
||||
}
|
||||
|
||||
func (e ErrorACN) Restart() {
|
||||
func (e *ErrorACN) Restart() {
|
||||
}
|
||||
|
||||
func (e ErrorACN) Open(hostname string) (net.Conn, string, error) {
|
||||
func (e *ErrorACN) Open(hostname string) (net.Conn, string, error) {
|
||||
return nil, "", fmt.Errorf(acnError)
|
||||
}
|
||||
|
||||
func (e ErrorACN) Listen(identity PrivateKey, port int) (ListenService, error) {
|
||||
func (e *ErrorACN) Listen(identity PrivateKey, port int) (ListenService, error) {
|
||||
return nil, fmt.Errorf(acnError)
|
||||
}
|
||||
|
||||
func (e ErrorACN) GetPID() (int, error) {
|
||||
func (e *ErrorACN) GetPID() (int, error) {
|
||||
return -1, fmt.Errorf(acnError)
|
||||
}
|
||||
|
||||
func (e ErrorACN) GetVersion() string {
|
||||
func (e *ErrorACN) GetVersion() string {
|
||||
return acnError
|
||||
}
|
||||
|
||||
func (e ErrorACN) Close() {
|
||||
func (e *ErrorACN) Close() {
|
||||
}
|
||||
|
|
|
@ -442,10 +442,19 @@ func newHideCmd(exePath string) process.Creator {
|
|||
loggerDebug := &logWriter{log.LevelDebug}
|
||||
loggerError := &logWriter{log.LevelError}
|
||||
|
||||
|
||||
cmd := exec.CommandContext(ctx, exePath, args...)
|
||||
cmd.Stdout = loggerDebug
|
||||
cmd.Stderr = loggerError
|
||||
cmd.SysProcAttr = sysProcAttr
|
||||
|
||||
// override tor ld_library_path if requested
|
||||
torLdLibPath,exists := os.LookupEnv("TOR_LD_LIBRARY_PATH")
|
||||
if exists {
|
||||
ldLibPath := fmt.Sprintf("LD_LIBRARY_PATH=%v", torLdLibPath)
|
||||
cmd.Env = append([]string{ldLibPath},os.Environ()...)
|
||||
}
|
||||
|
||||
return cmd, nil
|
||||
})
|
||||
}
|
||||
|
@ -656,4 +665,4 @@ func dialControlPort(port int) (*control.Conn, error) {
|
|||
return nil, err
|
||||
}
|
||||
return control.NewConn(textConn), nil
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue