Small VPN and socket monitoring related fixes
This commit is contained in:
parent
1feda73e3f
commit
933b2e9b4e
|
@ -727,7 +727,7 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
extraLines.append("AutomapHostsOnResolve 1").append('\n');
|
extraLines.append("AutomapHostsOnResolve 1").append('\n');
|
||||||
|
|
||||||
extraLines.append("DisableNetwork 0").append('\n');
|
extraLines.append("DisableNetwork 0").append('\n');
|
||||||
|
|
||||||
//.extraLines.append("CircuitStreamTimeout 60").append('\n');
|
//.extraLines.append("CircuitStreamTimeout 60").append('\n');
|
||||||
|
|
||||||
processSettingsImpl(extraLines);
|
processSettingsImpl(extraLines);
|
||||||
|
@ -974,7 +974,7 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean runTorShellCmd(Shell shell) throws Exception
|
private boolean runTorShellCmd(final Shell shell) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
String torrcPath = new File(appBinHome, TORRC_ASSET_KEY).getCanonicalPath();
|
String torrcPath = new File(appBinHome, TORRC_ASSET_KEY).getCanonicalPath();
|
||||||
|
@ -1005,18 +1005,16 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
|
|
||||||
shellTorCommand = new SimpleCommand(torCmdString);
|
shellTorCommand = new SimpleCommand(torCmdString);
|
||||||
shell.add(shellTorCommand).waitForFinish();
|
shell.add(shellTorCommand).waitForFinish();
|
||||||
|
|
||||||
exitCode = shellTorCommand.getExitCode();
|
exitCode = shellTorCommand.getExitCode();
|
||||||
output = shellTorCommand.getOutput();
|
output = shellTorCommand.getOutput();
|
||||||
|
|
||||||
|
|
||||||
if (exitCode != 0 && output != null && output.length() > 0)
|
if (exitCode != 0 && output != null && output.length() > 0)
|
||||||
{
|
{
|
||||||
logNotice("Tor (" + exitCode + "): " + output);
|
logNotice("Tor (" + exitCode + "): " + output);
|
||||||
//throw new Exception ("unable to start");
|
//throw new Exception ("unable to start");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//now try to connect
|
//now try to connect
|
||||||
mLastProcessId = initControlConnection (100,false);
|
mLastProcessId = initControlConnection (100,false);
|
||||||
|
|
||||||
|
@ -1031,7 +1029,6 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
{
|
{
|
||||||
|
|
||||||
logNotice("Tor started; process id=" + mLastProcessId);
|
logNotice("Tor started; process id=" + mLastProcessId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1749,7 +1746,7 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
|
|
||||||
Proxy proxy = null;
|
Proxy proxy = null;
|
||||||
|
|
||||||
if (mUseVPN)
|
if (!mUseVPN) //if not on the VPN then we should proxy
|
||||||
{
|
{
|
||||||
proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 8118));
|
proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 8118));
|
||||||
conn = new URL(ONIONOO_BASE_URL + mNode.id).openConnection(proxy);
|
conn = new URL(ONIONOO_BASE_URL + mNode.id).openConnection(proxy);
|
||||||
|
@ -2211,13 +2208,14 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
|
|
||||||
if (mUseVPN) //set the proxy here if we aren't using a bridge
|
if (mUseVPN) //set the proxy here if we aren't using a bridge
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (!mIsLollipop)
|
if (!mIsLollipop)
|
||||||
{
|
{
|
||||||
String proxyType = "socks5";
|
String proxyType = "socks5";
|
||||||
String proxyHost = "127.0.0.1";
|
String proxyHost = "127.0.0.1";
|
||||||
extraLines.append(proxyType + "Proxy" + ' ' + proxyHost + ':' + mVpnProxyPort).append('\n');
|
extraLines.append(proxyType + "Proxy" + ' ' + proxyHost + ':' + mVpnProxyPort).append('\n');
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2294,14 +2292,6 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
extraLines.append("Bridge obfs3 192.36.31.74:35870 FEB63CA5EBD805C42DC0E5FBDDE82F3B1CDD80B4\n");
|
|
||||||
extraLines.append("Bridge obfs3 131.72.136.85:52447 1AC601EA50397948DD5FB5B453922EB8A69A5EF6\n");
|
|
||||||
extraLines.append("Bridge obfs3 192.36.31.76:33439 54C59DF0FCEE2D08F789CA04E5B57519071C232B\n");
|
|
||||||
*/
|
|
||||||
|
|
||||||
// extraLines.append("Bridge obfs4 54.66.226.196:18965 95151988DC29FCCB4F610A1C700A1DDF7D5FFBD4 cert=3wYo19iAMNbfO7snEeqVBmsIat+RMmMDV5BV4jDvXuz9BaACXt7XffC8Dz8J1MUvLKHKaQ iat-mode=0\n");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2617,5 +2607,7 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
package org.torproject.android.vpn;
|
package org.torproject.android.vpn;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@ -86,7 +85,9 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLollipop)
|
if (!isLollipop)
|
||||||
|
{
|
||||||
startSocksBypass();
|
startSocksBypass();
|
||||||
|
}
|
||||||
|
|
||||||
setupTun2Socks();
|
setupTun2Socks();
|
||||||
}
|
}
|
||||||
|
@ -114,8 +115,7 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
|
||||||
|
|
||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void startSocksBypass()
|
private void startSocksBypass()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
|
||||||
|
|
||||||
Tun2Socks.Stop();
|
Tun2Socks.Stop();
|
||||||
|
|
||||||
stopSocksBypass ();
|
//stopSocksBypass ();
|
||||||
|
|
||||||
if (mInterface != null){
|
if (mInterface != null){
|
||||||
try
|
try
|
||||||
|
@ -203,6 +203,9 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
|
||||||
Log.d(TAG,"error stopping tun2socks",e);
|
Log.d(TAG,"error stopping tun2socks",e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mThreadVPN = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -310,5 +313,53 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
|
||||||
super.onRevoke();
|
super.onRevoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
private void monitorSocketsFD ()
|
||||||
|
{
|
||||||
|
|
||||||
|
final String fdPath = "/proc/self/fd/";
|
||||||
|
|
||||||
|
new Thread ()
|
||||||
|
{
|
||||||
|
public void run ()
|
||||||
|
{
|
||||||
|
while (mThreadVPN != null)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Thread.sleep(500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
File fileDir = new File(fdPath);
|
||||||
|
File[] files = fileDir.listFiles();
|
||||||
|
if (files != null)
|
||||||
|
for (File file : files)
|
||||||
|
{
|
||||||
|
String cPath = file.getCanonicalPath();
|
||||||
|
|
||||||
|
if (cPath.contains("socket"))
|
||||||
|
{
|
||||||
|
Log.d(TAG,"found FD for socket: " + file.getAbsolutePath());
|
||||||
|
|
||||||
|
protect(Integer.parseInt(file.getName()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.e(TAG,"error getting fd: " + fdPath,e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue