commit 6e4b7008035b2bf1a9035b730aad178bfd424f85 Author: Tad tad@spotco.us Date: Thu Nov 2 03:23:56 2017 -0400
Expose *ConnectionPadding --- app/src/main/res/values/strings.xml | 4 ++++ app/src/main/res/xml/preferences.xml | 16 ++++++++++++++++ .../org/torproject/android/service/OrbotConstants.java | 3 +++ .../java/org/torproject/android/service/TorService.java | 9 +++++++++ 4 files changed, 32 insertions(+)
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7dbc47c0..0a6c8db1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -384,4 +384,8 @@ <string name="pref_isolate_dest_summary">Use a different circuit for each destination address</string> <string name="no_transproxy_warning_short">WARNING: Transproxying no longer supported</string> <string name="no_transproxy_warning">WARNING: Transparent proxying not supported. Use Orbot Apps VPN instead.</string> + <string name="pref_connection_padding">Connection padding</string> + <string name="pref_connection_padding_summary">Always enables connection padding to defend against some forms of traffic analysis. Default: auto</string> + <string name="pref_reduced_connection_padding">Reduced connection padding</string> + <string name="pref_reduced_connection_padding_summary">Closes relay connections sooner and sends less padding packets to reduce data and battery usage</string> </resources> diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 869bb0d5..3efc1c44 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -166,6 +166,22 @@ android:summary="@string/pref_isolate_dest_summary" android:enabled="true"></CheckBoxPreference> </PreferenceCategory>
+<PreferenceCategory android:title="ConnectionPadding"> +<CheckBoxPreference +android:key="pref_connection_padding" +android:defaultValue="false" +android:title="@string/pref_connection_padding" +android:summary="@string/pref_connection_padding_summary" +android:enabled="true"></CheckBoxPreference> +<CheckBoxPreference +android:key="pref_reduced_connection_padding" +android:defaultValue="true" +android:title="@string/pref_reduced_connection_padding" +android:summary="@string/pref_reduced_connection_padding_summary" +android:enabled="true"></CheckBoxPreference> +</PreferenceCategory> + + <PreferenceCategory android:title="@string/pref_proxy_title"> <EditTextPreference android:key="pref_proxy_type" android:title="@string/pref_proxy_type_title" diff --git a/orbotservice/src/main/java/org/torproject/android/service/OrbotConstants.java b/orbotservice/src/main/java/org/torproject/android/service/OrbotConstants.java index 175ebf81..06b1da83 100644 --- a/orbotservice/src/main/java/org/torproject/android/service/OrbotConstants.java +++ b/orbotservice/src/main/java/org/torproject/android/service/OrbotConstants.java @@ -36,4 +36,7 @@ public interface OrbotConstants {
public final static String PREF_ISOLATE_DEST = "pref_isolate_dest";
+ public final static String PREF_CONNECTION_PADDING = "pref_connection_padding"; + public final static String PREF_REDUCED_CONNECTION_PADDING = "pref_reduced_connection_padding"; + } 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 012625b8..6c20a23e 100644 --- a/orbotservice/src/main/java/org/torproject/android/service/TorService.java +++ b/orbotservice/src/main/java/org/torproject/android/service/TorService.java @@ -672,6 +672,15 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon extraLines.append("TestSocks 0").append('\n'); extraLines.append("WarnUnsafeSocks 1").append('\n');
+ if(prefs.getBoolean(OrbotConstants.PREF_CONNECTION_PADDING, false)) + { + extraLines.append("ConnectionPadding 1").append('\n'); + } + if(prefs.getBoolean(OrbotConstants.PREF_REDUCED_CONNECTION_PADDING, true)) + { + extraLines.append("ReducedConnectionPadding 1").append('\n'); + } + String transPort = prefs.getString("pref_transport", TorServiceConstants.TOR_TRANSPROXY_PORT_DEFAULT+""); String dnsPort = prefs.getString("pref_dnsport", TorServiceConstants.TOR_DNS_PORT_DEFAULT+"");