commit b278b66b6247160325db6cbfeba22a487eb0f8c1 Author: Nathan Freitas nathan@freitas.net Date: Mon Mar 9 15:53:02 2015 -0400
switch obfsclient to obfs4 proxy includes supporting SOCKS outbound proxy for VPN mode --- src/org/torproject/android/OrbotMainActivity.java | 6 ++++++ src/org/torproject/android/service/TorResourceInstaller.java | 2 +- src/org/torproject/android/service/TorService.java | 10 ++++++---- src/org/torproject/android/service/TorServiceConstants.java | 6 ++---- src/org/torproject/android/vpn/OrbotVpnService.java | 8 +++++--- 5 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/src/org/torproject/android/OrbotMainActivity.java b/src/org/torproject/android/OrbotMainActivity.java index 8c83cf8..1a405d2 100644 --- a/src/org/torproject/android/OrbotMainActivity.java +++ b/src/org/torproject/android/OrbotMainActivity.java @@ -705,6 +705,12 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC } else { + Editor e = mPrefs.edit(); + e.putString("pref_proxy_host", "localhost"); + e.putInt("pref_proxy_port", 8118); + e.putString("prof_proxy_type","HTTP"); + e.commit(); + //use the built-in browser Intent intentBrowser = new Intent(this, Browser.class); intentBrowser.setAction(Intent.ACTION_VIEW); diff --git a/src/org/torproject/android/service/TorResourceInstaller.java b/src/org/torproject/android/service/TorResourceInstaller.java index c361e80..6f81f97 100644 --- a/src/org/torproject/android/service/TorResourceInstaller.java +++ b/src/org/torproject/android/service/TorResourceInstaller.java @@ -94,7 +94,7 @@ public class TorResourceInstaller implements TorServiceConstants { shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); streamToFile(is,outFile, false, true);
- is = context.getResources().openRawResource(R.raw.obfsclient); + is = context.getResources().openRawResource(R.raw.obfs4proxy); outFile = new File(installFolder, OBFSCLIENT_ASSET_KEY); shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); streamToFile(is,outFile, false, true); diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java index ff07c1b..86ca7a1 100644 --- a/src/org/torproject/android/service/TorService.java +++ b/src/org/torproject/android/service/TorService.java @@ -806,7 +806,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
if (useBridges) if (mUseVPN) - customEnv.add("TOR_PT_PROXY=http://127.0.0.1:9998"); + customEnv.add("TOR_PT_PROXY=socks5://127.0.0.1:9999");
String baseDirectory = fileTor.getParent(); Shell shellUser = Shell.startShell(customEnv, baseDirectory); @@ -2165,6 +2165,8 @@ public class TorService extends Service implements TorServiceConstants, TorConst debug ("Using bridges"); String bridgeCfgKey = "Bridge";
+ updateConfiguration("UseBridges", "1", false); + String bridgeList = prefs.getString(TorConstants.PREF_BRIDGES_LIST,null);
if (bridgeList != null && bridgeList.length() > 1) //longer then 1 = some real values here @@ -2192,8 +2194,9 @@ public class TorService extends Service implements TorServiceConstants, TorConst
if (obfsBridges) { - String bridgeConfig = "obfs2,obfs3,scramblesuit exec " + fileObfsclient.getCanonicalPath(); - + // String bridgeConfig = "obfs3,scramblesuit,obfs4 exec " + fileObfsclient.getCanonicalPath(); + String bridgeConfig = "obfs3,obfs4 exec " + fileObfsclient.getCanonicalPath(); + debug ("Using OBFUSCATED bridges: " + bridgeConfig); updateConfiguration("ClientTransportPlugin",bridgeConfig, false); @@ -2263,7 +2266,6 @@ public class TorService extends Service implements TorServiceConstants, TorConst
// updateConfiguration("UpdateBridgesFromAuthority", "0", false); - updateConfiguration("UseBridges", "1", false);
} diff --git a/src/org/torproject/android/service/TorServiceConstants.java b/src/org/torproject/android/service/TorServiceConstants.java index 0c2adf5..1dc25d5 100644 --- a/src/org/torproject/android/service/TorServiceConstants.java +++ b/src/org/torproject/android/service/TorServiceConstants.java @@ -86,17 +86,15 @@ public interface TorServiceConstants { public static final String CMD_UPDATE = "update";
- public static final String BINARY_TOR_VERSION = "0.2.5.10-openssl1.0.1i-PIE-bridgepatch"; + public static final String BINARY_TOR_VERSION = "0.2.5.10-openssl1.0.1i-PIE-bridgepatch-obfs4proxy"; public static final String PREF_BINARY_TOR_VERSION_INSTALLED = "BINARY_TOR_VERSION_INSTALLED";
//obfsproxy - public static final String OBFSCLIENT_ASSET_KEY = "obfsclient"; + public static final String OBFSCLIENT_ASSET_KEY = "obfs4proxy";
public static final String MEEK_ASSET_KEY = "meek-client";
- - public static final int MESSAGE_TRAFFIC_COUNT = 5;
diff --git a/src/org/torproject/android/vpn/OrbotVpnService.java b/src/org/torproject/android/vpn/OrbotVpnService.java index f78f720..56f3b1d 100644 --- a/src/org/torproject/android/vpn/OrbotVpnService.java +++ b/src/org/torproject/android/vpn/OrbotVpnService.java @@ -51,7 +51,7 @@ public class OrbotVpnService extends VpnService implements Handler.Callback { private ProxyServer mSocksProxyServer; private Thread mThreadProxy;
- private HttpProxy mHttpProxyServer; + // private HttpProxy mHttpProxyServer;
private final static int VPN_MTU = 1500;
@@ -121,11 +121,12 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
mThreadProxy.start();
+ /** mHttpProxyServer = new HttpProxy(9998); HttpProxy.setVpnService(OrbotVpnService.this); mHttpProxyServer.setDebug(5, System.out); mHttpProxyServer.start(); - + */ }
@@ -142,10 +143,11 @@ public class OrbotVpnService extends VpnService implements Handler.Callback { mSocksProxyServer = null; }
+ /* if (mHttpProxyServer != null) { mHttpProxyServer.closeSocket(); - } + }*/
if (mInterface != null){ onRevoke();
tor-commits@lists.torproject.org