VPN code cleanup and ensure DNS is listening on all interfaces

This commit is contained in:
Nathan Freitas 2016-03-07 14:02:07 -05:00
parent 4892f93531
commit cec82ec0de
2 changed files with 4 additions and 42 deletions

View File

@ -776,13 +776,6 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
shellRoot.close();
}
/**
if (Prefs.useVpn()) //we need to turn on VPN here so the proxy is running
{
enableVpnProxy();
}*/
getHiddenServiceHostname ();
}
else
@ -1204,6 +1197,8 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
Prefs.putUseVpn(true);
processTransparentProxying();
updateConfiguration("DNSPort",TOR_VPN_DNS_LISTEN_ADDRESS + ":" + TorServiceConstants.TOR_DNS_PORT_DEFAULT,false);
Intent intent = new Intent(TorService.this, OrbotVpnService.class);
intent.setAction("start");
@ -1213,36 +1208,6 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
}
public void refreshVpnProxy () {
debug ("refreshing VPN Proxy");
try
{
conn.setConf("DisableNetwork", "1");
Intent intent = new Intent(TorService.this, OrbotVpnService.class);
intent.setAction("refresh");
startService(intent);
//updateConfiguration("DNSPort",TOR_VPN_DNS_LISTEN_ADDRESS + ":" + TorServiceConstants.TOR_DNS_PORT_DEFAULT,false);
//updateConfiguration("DNSPort",TorServiceConstants.TOR_DNS_PORT_DEFAULT+"",false);
updateConfiguration("DisableNetwork","0", false);
saveConfiguration();
conn.setConf("DisableNetwork", "0");
}
catch (Exception ioe)
{
Log.e(TAG,"error restarting network",ioe);
}
}
public void clearVpnProxy ()
{
debug ("clearing VPN Proxy");
@ -1853,9 +1818,6 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
shell.close();
}
// else if (Prefs.useVpn()) //we need to turn on VPN here so the proxy is running
// refreshVpnProxy();
}
}

View File

@ -77,8 +77,8 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
private final static boolean mIsLollipop = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
//this is the actual DNS server we talk with over TCP/IP
private final static String DEFAULT_ACTUAL_DNS_HOST = "127.0.0.1";//"8.8.8.8";//use Google here, or 8.8.4.4 as backup?
//this is the actual DNS server we talk to over UDP or TCP (now using Tor's DNS port)
private final static String DEFAULT_ACTUAL_DNS_HOST = "127.0.0.1";
private final static int DEFAULT_ACTUAL_DNS_PORT = TorServiceConstants.TOR_DNS_PORT_DEFAULT;
private boolean isRestart = false;