switch obfsclient to obfs4 proxy

includes supporting SOCKS outbound proxy for VPN mode
This commit is contained in:
Nathan Freitas 2015-03-09 15:53:02 -04:00
parent 0f0a36883d
commit b278b66b62
5 changed files with 20 additions and 12 deletions

View File

@ -705,6 +705,12 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
} }
else 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 //use the built-in browser
Intent intentBrowser = new Intent(this, Browser.class); Intent intentBrowser = new Intent(this, Browser.class);
intentBrowser.setAction(Intent.ACTION_VIEW); intentBrowser.setAction(Intent.ACTION_VIEW);

View File

@ -94,7 +94,7 @@ public class TorResourceInstaller implements TorServiceConstants {
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true); 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); outFile = new File(installFolder, OBFSCLIENT_ASSET_KEY);
shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish(); shell.add(new SimpleCommand(COMMAND_RM_FORCE + outFile.getAbsolutePath())).waitForFinish();
streamToFile(is,outFile, false, true); streamToFile(is,outFile, false, true);

View File

@ -806,7 +806,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
if (useBridges) if (useBridges)
if (mUseVPN) 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(); String baseDirectory = fileTor.getParent();
Shell shellUser = Shell.startShell(customEnv, baseDirectory); Shell shellUser = Shell.startShell(customEnv, baseDirectory);
@ -2165,6 +2165,8 @@ public class TorService extends Service implements TorServiceConstants, TorConst
debug ("Using bridges"); debug ("Using bridges");
String bridgeCfgKey = "Bridge"; String bridgeCfgKey = "Bridge";
updateConfiguration("UseBridges", "1", false);
String bridgeList = prefs.getString(TorConstants.PREF_BRIDGES_LIST,null); String bridgeList = prefs.getString(TorConstants.PREF_BRIDGES_LIST,null);
if (bridgeList != null && bridgeList.length() > 1) //longer then 1 = some real values here if (bridgeList != null && bridgeList.length() > 1) //longer then 1 = some real values here
@ -2192,7 +2194,8 @@ public class TorService extends Service implements TorServiceConstants, TorConst
if (obfsBridges) 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); debug ("Using OBFUSCATED bridges: " + bridgeConfig);
@ -2263,7 +2266,6 @@ public class TorService extends Service implements TorServiceConstants, TorConst
// updateConfiguration("UpdateBridgesFromAuthority", "0", false); // updateConfiguration("UpdateBridgesFromAuthority", "0", false);
updateConfiguration("UseBridges", "1", false);
} }

View File

@ -86,17 +86,15 @@ public interface TorServiceConstants {
public static final String CMD_UPDATE = "update"; 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"; public static final String PREF_BINARY_TOR_VERSION_INSTALLED = "BINARY_TOR_VERSION_INSTALLED";
//obfsproxy //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 String MEEK_ASSET_KEY = "meek-client";
public static final int MESSAGE_TRAFFIC_COUNT = 5; public static final int MESSAGE_TRAFFIC_COUNT = 5;

View File

@ -51,7 +51,7 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
private ProxyServer mSocksProxyServer; private ProxyServer mSocksProxyServer;
private Thread mThreadProxy; private Thread mThreadProxy;
private HttpProxy mHttpProxyServer; // private HttpProxy mHttpProxyServer;
private final static int VPN_MTU = 1500; private final static int VPN_MTU = 1500;
@ -121,11 +121,12 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
mThreadProxy.start(); mThreadProxy.start();
/**
mHttpProxyServer = new HttpProxy(9998); mHttpProxyServer = new HttpProxy(9998);
HttpProxy.setVpnService(OrbotVpnService.this); HttpProxy.setVpnService(OrbotVpnService.this);
mHttpProxyServer.setDebug(5, System.out); mHttpProxyServer.setDebug(5, System.out);
mHttpProxyServer.start(); mHttpProxyServer.start();
*/
} }
@ -142,10 +143,11 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
mSocksProxyServer = null; mSocksProxyServer = null;
} }
/*
if (mHttpProxyServer != null) if (mHttpProxyServer != null)
{ {
mHttpProxyServer.closeSocket(); mHttpProxyServer.closeSocket();
} }*/
if (mInterface != null){ if (mInterface != null){
onRevoke(); onRevoke();