standardize network port constant variables

use consistent naming and types for code clarity
This commit is contained in:
Hans-Christoph Steiner 2015-06-11 16:31:39 -04:00
parent 775135d07a
commit 623084548d
4 changed files with 13 additions and 19 deletions

View File

@ -559,12 +559,12 @@ public class OrbotMainActivity extends Activity
startTor();
Intent resultIntent = new Intent(intent);
resultIntent.putExtra("socks_proxy", "socks://127.0.0.1:" + TorServiceConstants.PORT_SOCKS_DEFAULT);
resultIntent.putExtra("socks_proxy", "socks://127.0.0.1:" + TorServiceConstants.SOCKS_PROXY_PORT_DEFAULT);
resultIntent.putExtra("socks_proxy_host", "127.0.0.1");
resultIntent.putExtra("socks_proxy_port", TorServiceConstants.PORT_SOCKS_DEFAULT);
resultIntent.putExtra("http_proxy", "http://127.0.0.1" + TorServiceConstants.PORT_HTTP);
resultIntent.putExtra("socks_proxy_port", TorServiceConstants.SOCKS_PROXY_PORT_DEFAULT);
resultIntent.putExtra("http_proxy", "http://127.0.0.1" + TorServiceConstants.HTTP_PROXY_PORT_DEFAULT);
resultIntent.putExtra("http_proxy_host", "127.0.0.1");
resultIntent.putExtra("http_proxy_port", TorServiceConstants.PORT_HTTP);
resultIntent.putExtra("http_proxy_port", TorServiceConstants.HTTP_PROXY_PORT_DEFAULT);
setResult(RESULT_OK, resultIntent);
finish();
} catch (RemoteException e) {

View File

@ -1168,7 +1168,8 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
String socksPortPref = prefs.getString(OrbotConstants.PREF_SOCKS, TorServiceConstants.PORT_SOCKS_DEFAULT);
String socksPortPref = prefs.getString(OrbotConstants.PREF_SOCKS,
String.valueOf(TorServiceConstants.SOCKS_PROXY_PORT_DEFAULT));
if (socksPortPref.indexOf(':')!=-1)
socksPortPref = socksPortPref.split(":")[1];

View File

@ -50,19 +50,14 @@ public interface TorServiceConstants {
public final static int FILE_WRITE_BUFFER_SIZE = 1024;
//HTTP Proxy server port
public static int PORT_HTTP = 8118; //just like Privoxy!
//Socks port client connects to, server is the Tor binary
public static String PORT_SOCKS_DEFAULT = "9050";
//what is says!
public final static String IP_LOCALHOST = "127.0.0.1";
public final static int UPDATE_TIMEOUT = 1000;
public final static int TOR_TRANSPROXY_PORT_DEFAULT = 9040;
public final static int STANDARD_DNS_PORT = 53;
public final static int TOR_DNS_PORT_DEFAULT = 5400;
public final static int CONTROL_PORT_DEFAULT = 9051;
public final static int HTTP_PROXY_PORT_DEFAULT = 8118; // like Privoxy!
public final static int SOCKS_PROXY_PORT_DEFAULT = 9050;
//path to check Tor against
public final static String URL_TOR_CHECK = "https://check.torproject.org";
@ -128,7 +123,4 @@ public interface TorServiceConstants {
//name of the iptables binary
public final static String IPTABLES_ASSET_KEY = "xtables";
public final static int DEFAULT_CONTROL_PORT = 9051;
}

View File

@ -241,7 +241,8 @@ public class OrbotVpnService extends VpnService implements Handler.Callback {
final String virtualGateway = "10.0.0.1";
final String virtualIP = "10.0.0.2";
final String virtualNetMask = "255.255.255.0";
final String localSocks = "127.0.0.1:" + TorServiceConstants.PORT_SOCKS_DEFAULT;
final String localSocks = "127.0.0.1:"
+ String.valueOf(TorServiceConstants.SOCKS_PROXY_PORT_DEFAULT);
final String localDNS = "10.0.0.1:" + TorServiceConstants.TOR_DNS_PORT_DEFAULT;
Builder builder = new Builder();