Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove polipo #4

Merged
merged 1 commit into from
Apr 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
28 changes: 3 additions & 25 deletions external/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -280,46 +279,25 @@ 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


#------------------------------------------------------------------------------#
# 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
Expand Down
1 change: 0 additions & 1 deletion external/polipo
Submodule polipo deleted from bdbc16
Binary file not shown.
23 changes: 0 additions & 23 deletions tor-android-binary/src/main/assets/common/torpolipo.conf

This file was deleted.

Binary file removed tor-android-binary/src/main/assets/x86/polipo.mp3
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@

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;
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;
Expand Down Expand Up @@ -60,9 +57,6 @@ public void deleteDirectory(File file) {
*/
public boolean installResources () throws IOException, TimeoutException
{

InputStream is;
File outFile;

String cpuPath = "armeabi";

Expand All @@ -73,29 +67,15 @@ public boolean installResources () throws IOException, TimeoutException

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())
Expand All @@ -113,57 +93,31 @@ public boolean updateTorConfigCustom (File fileTorRcCustom, String extraLines) t

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);
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down