Skip to content

Commit

Permalink
VPN code cleanup and ensure DNS is listening on all interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
n8fr8 committed Mar 7, 2016
1 parent 4892f93 commit cec82ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 42 deletions.
42 changes: 2 additions & 40 deletions src/org/torproject/android/service/TorService.java
Original file line number Diff line number Diff line change
Expand Up @@ -776,13 +776,6 @@ private void startTor() {
shellRoot.close();
}

/**
if (Prefs.useVpn()) //we need to turn on VPN here so the proxy is running
{
enableVpnProxy();
}*/


getHiddenServiceHostname ();
}
else
Expand Down Expand Up @@ -1204,6 +1197,8 @@ public void enableVpnProxy () {
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");

Expand All @@ -1213,36 +1208,6 @@ public void enableVpnProxy () {

}

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");
Expand Down Expand Up @@ -1853,9 +1818,6 @@ public void onReceive(Context context, Intent intent) {

shell.close();
}
// else if (Prefs.useVpn()) //we need to turn on VPN here so the proxy is running
// refreshVpnProxy();

}
}

Expand Down
4 changes: 2 additions & 2 deletions src/org/torproject/android/vpn/OrbotVpnService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cec82ec

Please sign in to comment.