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

View File

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

View File

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

View File

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

View File

@ -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();