use bundled tor code for desktop, updated bundled tor to 0.3.5.7. update android readme

This commit is contained in:
Dan Ballard 2019-02-14 10:57:44 -08:00
parent 24de8c1c93
commit 8ade3dcd72
3 changed files with 17 additions and 1 deletions

View File

@ -20,7 +20,7 @@ The -local and -debug flags are helpful when developing.
## Android ## Android
A arm-pie version of tor like [tor-0.3.5.7-armeabi-v7a](https://git.openprivacy.ca/openprivacy/buildfiles/src/master/tor/tor-0.3.5.7-armeabi-v7a.so) is required to be placed in `android/libs/armeabi-v7a` with the name `libtor.so` We supply an arm-pie version of tor in `android/libs/armeabi-v7a` with the name `libtor.so`
qtdeploy -docker build android qtdeploy -docker build android
adb install deploy/android/build-debug.apk adb install deploy/android/build-debug.apk

BIN
linux/tor

Binary file not shown.

16
main.go
View File

@ -19,6 +19,7 @@ import (
"os/user" "os/user"
"path" "path"
"runtime" "runtime"
"path/filepath"
) )
func init() { func init() {
@ -72,6 +73,21 @@ func main() {
torpath := "tor" torpath := "tor"
if runtime.GOOS == "android" { if runtime.GOOS == "android" {
torpath = "/data/data/org.qtproject.example.go/lib/libtor.so" torpath = "/data/data/org.qtproject.example.go/lib/libtor.so"
} else {
dir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
if _, err := os.Stat(path.Join(dir, "tor")); os.IsNotExist(err) {
if _, err := os.Stat(path.Join(dir, "deploy", "linux", "tor")); os.IsNotExist(err) {
if _, err := os.Stat(path.Join(dir, "deploy", "windows", "tor")); os.IsNotExist(err) {
log.Warnln("Cannot find bundled Tor")
} else {
torpath = path.Join(dir, "deploy", "windows", "tor")
}
} else {
torpath = path.Join(dir, "deploy", "linux", "tor")
}
} else {
torpath = path.Join(dir, "tor")
}
} }
acn, err := connectivity.StartTor(the.CwtchDir, torpath) acn, err := connectivity.StartTor(the.CwtchDir, torpath)