[tor-commits] [orbot/master] updates to properly support tor-tether mode
n8fr8 at torproject.org
n8fr8 at torproject.org
Sat Oct 29 06:55:21 UTC 2011
commit ef5c506fddb76d521493a38bd13fd440156db446
Author: Nathan Freitas <nathan at freitas.net>
Date: Fri Oct 28 23:53:40 2011 -0400
updates to properly support tor-tether mode
---
res/raw/torrc | 8 ++++----
res/raw/torrctether | 14 ++++++++++++++
src/org/torproject/android/Orbot.java | 5 ++++-
.../android/service/TorBinaryInstaller.java | 3 +++
src/org/torproject/android/service/TorService.java | 14 +++++++++++++-
.../android/service/TorServiceConstants.java | 2 ++
src/org/torproject/android/wizard/Permissions.java | 12 ++++++++++++
7 files changed, 52 insertions(+), 6 deletions(-)
diff --git a/res/raw/torrc b/res/raw/torrc
index d1cd7fd..f3d79d2 100644
--- a/res/raw/torrc
+++ b/res/raw/torrc
@@ -1,14 +1,14 @@
SocksPort 9050
SafeSocks 1
Log notice stdout
+ControlListenAddress 127.0.0.1
ControlPort 9051
CookieAuthentication 1
RelayBandwidthRate 20 KBytes
RelayBandwidthBurst 20 KBytes
UseBridges 0
AutomapHostsOnResolve 1
-TransListenAddress 0.0.0.0
+TransListenAddress 127.0.0.1
TransPort 9040
-DNSListenAddress 0.0.0.0
-DNSPort 5400
-
+DNSListenAddress 127.0.0.1
+DNSPort 5400
\ No newline at end of file
diff --git a/res/raw/torrctether b/res/raw/torrctether
new file mode 100644
index 0000000..3edb5c8
--- /dev/null
+++ b/res/raw/torrctether
@@ -0,0 +1,14 @@
+SocksPort 9050
+SafeSocks 1
+Log notice stdout
+ControlListenAddress 127.0.0.1
+ControlPort 9051
+CookieAuthentication 1
+RelayBandwidthRate 20 KBytes
+RelayBandwidthBurst 20 KBytes
+UseBridges 0
+AutomapHostsOnResolve 1
+TransListenAddress 0.0.0.0
+TransPort 9040
+DNSListenAddress 0.0.0.0
+DNSPort 5400
\ No newline at end of file
diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index 5470042..96eb6d6 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -588,7 +588,10 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
lblStatus.setText(lblMsg);
if (torServiceMsg != null && torServiceMsg.length() > 0)
- showAlert("Update", torServiceMsg, false);
+ {
+ // showAlert("Update", torServiceMsg, false);
+ lblStatus.setText(torServiceMsg);
+ }
boolean showFirstTime = prefs.getBoolean("connect_first_time",true);
diff --git a/src/org/torproject/android/service/TorBinaryInstaller.java b/src/org/torproject/android/service/TorBinaryInstaller.java
index b540f0c..a3b1995 100644
--- a/src/org/torproject/android/service/TorBinaryInstaller.java
+++ b/src/org/torproject/android/service/TorBinaryInstaller.java
@@ -50,6 +50,9 @@ public class TorBinaryInstaller implements TorServiceConstants {
is = context.getResources().openRawResource(R.raw.torrc);
streamToFile(is,installFolder, TORRC_ASSET_KEY, false, false);
+ is = context.getResources().openRawResource(R.raw.torrctether);
+ streamToFile(is,installFolder, TORRC_TETHER_KEY, false, false);
+
is = context.getResources().openRawResource(R.raw.privoxy);
streamToFile(is,installFolder, PRIVOXY_ASSET_KEY, false, false);
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index 70b7c9c..c4b7b1f 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -582,6 +582,10 @@ public class TorService extends Service implements TorServiceConstants, TorConst
showAlert("Status", "TransProxy enabled for Tethering!");
TorTransProxy.enableTetheringRules(this);
+
+ // mBinder.updateConfiguration("TransListenAddress", "0.0.0.0", false);
+ // mBinder.updateConfiguration("DNSListenAddress", "0.0.0.0", false);
+
}
}
else
@@ -617,6 +621,14 @@ public class TorService extends Service implements TorServiceConstants, TorConst
String torrcPath = new File(appBinHome, TORRC_ASSET_KEY).getAbsolutePath();
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ boolean transProxyTethering = prefs.getBoolean("pref_transparent_tethering", false);
+
+ if (transProxyTethering)
+ {
+ torrcPath = new File(appBinHome, TORRC_TETHER_KEY).getAbsolutePath();
+ }
+
String[] torCmd = {torBinaryPath + " DataDirectory " + appDataHome.getAbsolutePath() + " -f " + torrcPath + " || exit\n"};
boolean runAsRootFalse = false;
@@ -1430,7 +1442,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
mBinder.updateConfiguration("HiddenServiceDir","", false);
}
-
+
mBinder.saveConfiguration();
return true;
diff --git a/src/org/torproject/android/service/TorServiceConstants.java b/src/org/torproject/android/service/TorServiceConstants.java
index 759d0ce..e47ed71 100644
--- a/src/org/torproject/android/service/TorServiceConstants.java
+++ b/src/org/torproject/android/service/TorServiceConstants.java
@@ -15,6 +15,8 @@ public interface TorServiceConstants {
//torrc (tor config file)
public final static String TORRC_ASSET_KEY = "torrc";
+ public final static String TORRC_TETHER_KEY = "torrctether";
+
public final static String TOR_CONTROL_COOKIE = "control_auth_cookie";
//how to launch tor
diff --git a/src/org/torproject/android/wizard/Permissions.java b/src/org/torproject/android/wizard/Permissions.java
index ecb7b50..f2c24a0 100644
--- a/src/org/torproject/android/wizard/Permissions.java
+++ b/src/org/torproject/android/wizard/Permissions.java
@@ -137,6 +137,18 @@ public class Permissions extends Activity implements TorConstants {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean hasRoot = prefs.getBoolean("has_root",false);
+
+ if (!hasRoot)
+ {
+
+ hasRoot = TorServiceUtils.isRootPossible();
+
+ Editor pEdit = prefs.edit();
+ pEdit.putBoolean(PREF_HAS_ROOT,hasRoot);
+ pEdit.commit();
+
+ }
+
if (hasRoot)
{
try {
More information about the tor-commits
mailing list