diff --git a/.gitmodules b/.gitmodules index 18d62ab9..3bfadef9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,10 +10,6 @@ path = external/openssl url = https://github.com/openssl/openssl.git ignore = dirty -[submodule "external/polipo"] - path = external/polipo - url = https://github.com/jech/polipo.git - ignore = dirty [submodule "external/zstd"] path = external/zstd url = https://github.com/facebook/zstd.git diff --git a/BUILD b/BUILD index 9b5a32be..96c8e3c8 100644 --- a/BUILD +++ b/BUILD @@ -8,8 +8,6 @@ Orbot includes, in the external directory, git repo submodules of: - LibEvent - JTorControl: The Tor Control Library for Java -The Orbot repo also includes the Polipo source code of a recent stable release. - Please install the following prerequisites (instructions for each follows): ant: http://ant.apache.org/ Android Native Dev Kit or NDK (for C/C++ code): diff --git a/external/Makefile b/external/Makefile index 612f6d24..5eaea36f 100644 --- a/external/Makefile +++ b/external/Makefile @@ -103,8 +103,7 @@ endif libevent libevent-clean \ lzma lzma-clean \ zstd zstd-clean \ - tor tor-clean \ - polipo polipo-clean + tor tor-clean all: assets @@ -280,38 +279,17 @@ tor-clean: -cd tor && \ git reset HEAD --hard -#------------------------------------------------------------------------------# -# polipo - -polipo-build-stamp: - CC="$(CC)" CFLAGS="$(PIEFLAGS)" LDFLAGS="$(PIEFLAGS)" $(MAKE) -C polipo - touch polipo-build-stamp - -polipo: polipo-build-stamp - test -d bin || mkdir bin - cp polipo/polipo bin - -polipo-clean: - $(MAKE) -C polipo clean - -rm -f polipo/polipo - -rm -f bin/polipo - -rm -f polipo-build-stamp - - #------------------------------------------------------------------------------# #create and clean assets: FYI - tor is stored as a ZIP file with an mp3 extension #in order to stop Android OS (older devices) from trying to compress/decompress it #this is related to a bug in compression of assets and resources > 1MB -assets: tor polipo +assets: tor install -d ../tor-android-binary/src/main/assets/$(APP_ABI) - -$(STRIP) bin/polipo - -zip ../tor-android-binary/src/main/assets/$(APP_ABI)/polipo.mp3 bin/polipo -$(STRIP) bin/tor -zip ../tor-android-binary/src/main/assets/$(APP_ABI)/tor.mp3 bin/tor assets-clean: - -rm ../tor-android-binary/src/main/assets/$(APP_ABI)/polipo.mp3 -rm ../tor-android-binary/src/main/assets/$(APP_ABI)/tor.mp3 @@ -319,7 +297,7 @@ assets-clean: # cleanup, cleanup, put the toys away ##clean: openssl-clean libevent-clean tor-clean polipo-clean assets-clean -clean: openssl-clean libevent-clean lzma-clean zstd-clean tor-clean polipo-clean +clean: openssl-clean libevent-clean lzma-clean zstd-clean tor-clean #------------------------------------------------------------------------------# # debugging stuff diff --git a/external/polipo b/external/polipo deleted file mode 160000 index bdbc1603..00000000 --- a/external/polipo +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bdbc1603d05801205dcf47898c9f07dbcfc6febf diff --git a/tor-android-binary/src/main/assets/armeabi/polipo.mp3 b/tor-android-binary/src/main/assets/armeabi/polipo.mp3 deleted file mode 100644 index cc5edb52..00000000 Binary files a/tor-android-binary/src/main/assets/armeabi/polipo.mp3 and /dev/null differ diff --git a/tor-android-binary/src/main/assets/common/torpolipo.conf b/tor-android-binary/src/main/assets/common/torpolipo.conf deleted file mode 100644 index 0aeaf632..00000000 --- a/tor-android-binary/src/main/assets/common/torpolipo.conf +++ /dev/null @@ -1,23 +0,0 @@ -proxyAddress = "127.0.0.1" -proxyPort = 8118 -allowedClients = 127.0.0.1 -allowedPorts = 1-65535 -proxyName = "127.0.0.1" -cacheIsShared = false -socksParentProxy = "127.0.0.1:9050" -socksProxyType = socks5 -diskCacheRoot = "" -localDocumentRoot = "" -disableLocalInterface = true -disableConfiguration = true -dnsUseGethostbyname = yes -disableVia = true -censoredHeaders = from,accept-language,x-pad,link -censorReferer = maybe -maxConnectionAge = 5m -maxConnectionRequests = 120 -serverMaxSlots = 8 -serverSlots = 2 -tunnelAllowedPorts = 1-65535 -chunkHighMark = 512000 -objectHighMark = 128 \ No newline at end of file diff --git a/tor-android-binary/src/main/assets/x86/polipo.mp3 b/tor-android-binary/src/main/assets/x86/polipo.mp3 deleted file mode 100644 index 8982ee02..00000000 Binary files a/tor-android-binary/src/main/assets/x86/polipo.mp3 and /dev/null differ diff --git a/tor-android-binary/src/main/java/org/torproject/android/binary/TorResourceInstaller.java b/tor-android-binary/src/main/java/org/torproject/android/binary/TorResourceInstaller.java index 059283ae..20c27b41 100644 --- a/tor-android-binary/src/main/java/org/torproject/android/binary/TorResourceInstaller.java +++ b/tor-android-binary/src/main/java/org/torproject/android/binary/TorResourceInstaller.java @@ -3,8 +3,6 @@ package org.torproject.android.binary; -import java.io.DataInputStream; -import java.io.DataOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; @@ -12,7 +10,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; -import java.io.StringBufferInputStream; import java.util.concurrent.TimeoutException; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -60,9 +57,6 @@ public class TorResourceInstaller implements TorServiceConstants { */ public boolean installResources () throws IOException, TimeoutException { - - InputStream is; - File outFile; String cpuPath = "armeabi"; @@ -73,29 +67,15 @@ public class TorResourceInstaller implements TorServiceConstants { installFolder.mkdirs(); - is = context.getAssets().open(COMMON_ASSET_KEY + TORRC_ASSET_KEY); - outFile = new File(installFolder, TORRC_ASSET_KEY); - streamToFile(is,outFile, false, false); + assetToFile(COMMON_ASSET_KEY + TORRC_ASSET_KEY, TORRC_ASSET_KEY, false, false); - is = context.getAssets().open(COMMON_ASSET_KEY + POLIPOCONFIG_ASSET_KEY); - outFile = new File(installFolder, POLIPOCONFIG_ASSET_KEY); - streamToFile(is,outFile, false, false); - - is = context.getAssets().open(cpuPath + '/' + TOR_ASSET_KEY + MP3_EXT); - outFile = new File(installFolder, TOR_ASSET_KEY); - streamToFile(is,outFile, false, true); - setExecutable(outFile); + assetToFile(cpuPath + '/' + TOR_ASSET_KEY + MP3_EXT, TOR_ASSET_KEY, true, true); - is = context.getAssets().open(cpuPath + '/' + POLIPO_ASSET_KEY + MP3_EXT); - outFile = new File(installFolder, POLIPO_ASSET_KEY); - streamToFile(is,outFile, false, true); - setExecutable(outFile); - installGeoIP(); return true; } - + public boolean updateTorConfigCustom (File fileTorRcCustom, String extraLines) throws IOException, FileNotFoundException, TimeoutException { if (fileTorRcCustom.exists()) @@ -113,58 +93,32 @@ public class TorResourceInstaller implements TorServiceConstants { return true; } - - public boolean updatePolipoConfig (File filePolipo, String extraLines) throws IOException, FileNotFoundException, TimeoutException - { - - InputStream is; - is = context.getAssets().open(COMMON_ASSET_KEY + POLIPOCONFIG_ASSET_KEY); - streamToFile(is,filePolipo, false, false); - - if (extraLines != null && extraLines.length() > 0) - { - StringBufferInputStream sbis = new StringBufferInputStream('\n' + extraLines + '\n'); - streamToFile(sbis,filePolipo,true,false); - } - - - return true; - } - - public boolean installPolipoConf () throws IOException, FileNotFoundException, TimeoutException - { - - InputStream is; - File outFile; - - is = context.getAssets().open(COMMON_ASSET_KEY + POLIPOCONFIG_ASSET_KEY); - outFile = new File(installFolder, POLIPOCONFIG_ASSET_KEY); - streamToFile(is,outFile, false, false); - - return true; - } - /* * Extract the Tor binary from the APK file using ZIP */ private boolean installGeoIP () throws IOException { - - InputStream is; - File outFile; - - outFile = new File(installFolder, GEOIP_ASSET_KEY); - is = context.getAssets().open(COMMON_ASSET_KEY + GEOIP_ASSET_KEY); - streamToFile(is, outFile, false, false); - is = context.getAssets().open(COMMON_ASSET_KEY + GEOIP6_ASSET_KEY); - outFile = new File(installFolder, GEOIP6_ASSET_KEY); - streamToFile(is, outFile, false, false); - + assetToFile(COMMON_ASSET_KEY + GEOIP_ASSET_KEY, GEOIP_ASSET_KEY, false, false); + + assetToFile(COMMON_ASSET_KEY + GEOIP6_ASSET_KEY, GEOIP6_ASSET_KEY, false, false); + return true; } + + /* + * Reads file from assetPath/assetKey writes it to the install folder + */ + private void assetToFile(String assetPath, String assetKey, boolean isZipped, boolean isExecutable) throws IOException { + InputStream is = context.getAssets().open(assetPath); + File outFile = new File(installFolder, assetKey); + streamToFile(is, outFile, false, isZipped); + if (isExecutable) { + setExecutable(outFile); + } + } /* diff --git a/tor-android-binary/src/main/java/org/torproject/android/binary/TorServiceConstants.java b/tor-android-binary/src/main/java/org/torproject/android/binary/TorServiceConstants.java index e8b96eef..d70656fe 100644 --- a/tor-android-binary/src/main/java/org/torproject/android/binary/TorServiceConstants.java +++ b/tor-android-binary/src/main/java/org/torproject/android/binary/TorServiceConstants.java @@ -14,12 +14,6 @@ public interface TorServiceConstants { String COMMON_ASSET_KEY = "common/"; - //privoxy - String POLIPO_ASSET_KEY = "polipo"; - - //privoxy.config - String POLIPOCONFIG_ASSET_KEY = "torpolipo.conf"; - //geoip data file asset key String GEOIP_ASSET_KEY = "geoip"; String GEOIP6_ASSET_KEY = "geoip6";