Browse Source

remove polipo

master
Unpublished 4 years ago
parent
commit
8383c1abbc
  1. 4
      .gitmodules
  2. 2
      BUILD
  3. 28
      external/Makefile
  4. 1
      external/polipo
  5. BIN
      tor-android-binary/src/main/assets/armeabi/polipo.mp3
  6. 23
      tor-android-binary/src/main/assets/common/torpolipo.conf
  7. BIN
      tor-android-binary/src/main/assets/x86/polipo.mp3
  8. 82
      tor-android-binary/src/main/java/org/torproject/android/binary/TorResourceInstaller.java
  9. 6
      tor-android-binary/src/main/java/org/torproject/android/binary/TorServiceConstants.java

4
.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

2
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):

28
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

1
external/polipo

@ -1 +0,0 @@
Subproject commit bdbc1603d05801205dcf47898c9f07dbcfc6febf

BIN
tor-android-binary/src/main/assets/armeabi/polipo.mp3

23
tor-android-binary/src/main/assets/common/torpolipo.conf

@ -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

BIN
tor-android-binary/src/main/assets/x86/polipo.mp3

82
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);
is = context.getAssets().open(COMMON_ASSET_KEY + POLIPOCONFIG_ASSET_KEY);
outFile = new File(installFolder, POLIPOCONFIG_ASSET_KEY);
streamToFile(is,outFile, false, false);
assetToFile(COMMON_ASSET_KEY + TORRC_ASSET_KEY, TORRC_ASSET_KEY, 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,57 +93,31 @@ public class TorResourceInstaller implements TorServiceConstants {
return true;
}
/*
* Extract the Tor binary from the APK file using ZIP
*/
public boolean updatePolipoConfig (File filePolipo, String extraLines) throws IOException, FileNotFoundException, TimeoutException
private boolean installGeoIP () throws IOException
{
InputStream is;
is = context.getAssets().open(COMMON_ASSET_KEY + POLIPOCONFIG_ASSET_KEY);
streamToFile(is,filePolipo, false, false);
assetToFile(COMMON_ASSET_KEY + GEOIP_ASSET_KEY, GEOIP_ASSET_KEY, false, false);
if (extraLines != null && extraLines.length() > 0)
{
StringBufferInputStream sbis = new StringBufferInputStream('\n' + extraLines + '\n');
streamToFile(sbis,filePolipo,true,false);
}
assetToFile(COMMON_ASSET_KEY + GEOIP6_ASSET_KEY, GEOIP6_ASSET_KEY, false, 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
* Reads file from assetPath/assetKey writes it to the install folder
*/
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);
return true;
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);
}
}

6
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";

Loading…
Cancel
Save