commit 51216a45157aa6cac470903edb9b9d2ef6f3405a Author: Bjarni R. Einarsson bre@klaki.net Date: Mon Dec 25 23:00:59 2017 +0100
Add new preference: pref_open_proxy_on_all_interfaces
If set, this configures Tor to listen on 0.0.0.0 instead of 127.0.0.1.
The primary use-case for this, is to share Orbot with tethered devices or others on the same LAN. This is particularly useful when trying to access the Internet using a mobile plan that restricts or blocks tethered devices. --- app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/preferences.xml | 6 ++++++ .../src/main/java/org/torproject/android/service/TorService.java | 2 ++ .../src/main/java/org/torproject/android/service/util/Prefs.java | 5 +++++ 4 files changed, 15 insertions(+)
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f8e55528..64c4a975 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -128,6 +128,8 @@ <string name="pref_entrance_node_dialog">Enter Entrance Nodes</string> <string name="pref_allow_background_starts_title">Allow Background Starts</string> <string name="pref_allow_background_starts_summary">Let any app tell Orbot to start Tor and related services</string> + <string name="pref_open_proxy_on_all_interfaces_title">Open Proxy on All Interfaces</string> + <string name="pref_open_proxy_on_all_interfaces_summary">Allow Wifi peers, tethered devices and anyone else who can connect to your IP, to access Tor</string>
<string name="button_proxy_all">Proxy All</string> <string name="button_proxy_none">Proxy None</string> diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 3efc1c44..89e9e035 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -28,6 +28,12 @@ android:key="pref_allow_background_starts" android:summary="@string/pref_allow_background_starts_summary" android:title="@string/pref_allow_background_starts_title"/>
+<CheckBoxPreference +android:defaultValue="false" +android:key="pref_open_proxy_on_all_interfaces" +android:summary="@string/pref_open_proxy_on_all_interfaces_summary" +android:title="@string/pref_open_proxy_on_all_interfaces_title"/> + <ListPreference android:title="@string/set_locale_title" android:key="pref_default_locale" android:summary="@string/set_locale_summary" diff --git a/orbotservice/src/main/java/org/torproject/android/service/TorService.java b/orbotservice/src/main/java/org/torproject/android/service/TorService.java index 77fa1cdf..71ce1d8b 100644 --- a/orbotservice/src/main/java/org/torproject/android/service/TorService.java +++ b/orbotservice/src/main/java/org/torproject/android/service/TorService.java @@ -659,6 +659,8 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon extraLines.append("SafeSocks 0").append('\n'); extraLines.append("TestSocks 0").append('\n'); extraLines.append("WarnUnsafeSocks 1").append('\n'); + if (Prefs.openProxyOnAllInterfaces()) + extraLines.append("SocksListenAddress 0.0.0.0").append('\n');
if(prefs.getBoolean(OrbotConstants.PREF_CONNECTION_PADDING, false)) { diff --git a/orbotservice/src/main/java/org/torproject/android/service/util/Prefs.java b/orbotservice/src/main/java/org/torproject/android/service/util/Prefs.java index bd5c3d6f..bdfe1a96 100644 --- a/orbotservice/src/main/java/org/torproject/android/service/util/Prefs.java +++ b/orbotservice/src/main/java/org/torproject/android/service/util/Prefs.java @@ -17,6 +17,7 @@ public class Prefs { private final static String PREF_PERSIST_NOTIFICATIONS = "pref_persistent_notifications"; private final static String PREF_START_ON_BOOT = "pref_start_boot"; private final static String PREF_ALLOW_BACKGROUND_STARTS = "pref_allow_background_starts"; + private final static String PREF_OPEN_PROXY_ON_ALL_INTERFACES = "pref_open_proxy_on_all_interfaces"; private final static String PREF_TRANSPARENT = "pref_transparent"; private final static String PREF_TRANSPARENT_ALL = "pref_transparent_all"; private final static String PREF_TRANSPARENT_TETHERING = "pref_transparent_tethering"; @@ -108,6 +109,10 @@ public class Prefs { return prefs.getBoolean(PREF_ALLOW_BACKGROUND_STARTS, true); }
+ public static boolean openProxyOnAllInterfaces() { + return prefs.getBoolean(PREF_OPEN_PROXY_ON_ALL_INTERFACES, false); + } + public static boolean useVpn() { return prefs.getBoolean(PREF_USE_VPN, true); }
tor-commits@lists.torproject.org