Merge pull request #4 from Unpublished/remove_polipo

remove polipo
This commit is contained in:
Nathan Freitas 2018-04-20 00:20:08 -04:00 committed by GitHub
commit 9897c1208e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 22 additions and 126 deletions

4
.gitmodules vendored
View File

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

@ -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 vendored
View File

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

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

View File

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

View File

@ -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);
}
}
/*

View File

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