Merge branch 'kensan/obfsbridge-prefs' into obfs

Conflicts:
	src/org/torproject/android/service/TorService.java
This commit is contained in:
Nathan Freitas 2012-02-12 13:05:19 -05:00
commit f255420782
4 changed files with 23 additions and 8 deletions

View File

@ -209,7 +209,9 @@
<string name="use_only_these_specified_nodes">Use *only* these specified nodes</string> <string name="use_only_these_specified_nodes">Use *only* these specified nodes</string>
<string name="bridges">Bridges</string> <string name="bridges">Bridges</string>
<string name="use_bridges">Use Bridges</string> <string name="use_bridges">Use Bridges</string>
<string name="bridges_obfuscated">Obfuscated Bridges</string>
<string name="enable_alternate_entrance_nodes_into_the_tor_network">Enable alternate entrance nodes into the Tor Network</string> <string name="enable_alternate_entrance_nodes_into_the_tor_network">Enable alternate entrance nodes into the Tor Network</string>
<string name="enable_if_configured_bridges_are_obfuscated_bridges">Enable if configured bridges are obfuscated bridges</string>
<string name="ip_address_and_port_of_bridges">IP address and port of bridges</string> <string name="ip_address_and_port_of_bridges">IP address and port of bridges</string>
<string name="enter_bridge_addresses">Enter Bridge Addresses</string> <string name="enter_bridge_addresses">Enter Bridge Addresses</string>
<string name="relays">Relays</string> <string name="relays">Relays</string>

View File

@ -94,8 +94,11 @@ android:summary="@string/use_only_these_specified_nodes"/>
<CheckBoxPreference android:defaultValue="true" <CheckBoxPreference android:defaultValue="true"
android:title="@string/use_bridges" android:key="pref_bridges_enabled" android:title="@string/use_bridges" android:key="pref_bridges_enabled"
android:summary="@string/enable_alternate_entrance_nodes_into_the_tor_network"></CheckBoxPreference> android:summary="@string/enable_alternate_entrance_nodes_into_the_tor_network"/>
<CheckBoxPreference android:key="pref_bridges_obfuscated"
android:title="@string/bridges_obfuscated"
android:summary="@string/enable_if_configured_bridges_are_obfuscated_bridges"/>
<EditTextPreference android:key="pref_bridges_list" <EditTextPreference android:key="pref_bridges_list"
android:title="@string/bridges" android:title="@string/bridges"
@ -103,10 +106,9 @@ android:summary="@string/ip_address_and_port_of_bridges"
android:dialogTitle="@string/enter_bridge_addresses" android:dialogTitle="@string/enter_bridge_addresses"
android:defaultValue="@string/default_bridges" android:defaultValue="@string/default_bridges"
/> />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:title="@string/relays"> <PreferenceCategory android:title="@string/relays">
<CheckBoxPreference android:key="pref_or" <CheckBoxPreference android:key="pref_or"
android:defaultValue="false" android:defaultValue="false"

View File

@ -32,6 +32,7 @@ public interface TorConstants {
public final static String PREF_BRIDGES_ENABLED = "pref_bridges_enabled"; public final static String PREF_BRIDGES_ENABLED = "pref_bridges_enabled";
public final static String PREF_BRIDGES_UPDATED = "pref_bridges_enabled"; public final static String PREF_BRIDGES_UPDATED = "pref_bridges_enabled";
public final static String PREF_BRIDGES_LIST = "pref_bridges_list"; public final static String PREF_BRIDGES_LIST = "pref_bridges_list";
public final static String PREF_BRIDGES_OBFUSCATED = "pref_bridges_obfuscated";
public final static String PREF_OR = "pref_or"; public final static String PREF_OR = "pref_or";
public final static String PREF_OR_PORT = "pref_or_port"; public final static String PREF_OR_PORT = "pref_or_port";
public final static String PREF_OR_NICKNAME = "pref_or_nickname"; public final static String PREF_OR_NICKNAME = "pref_or_nickname";

View File

@ -1462,18 +1462,28 @@ public class TorService extends Service implements TorServiceConstants, TorConst
showToolbarNotification(getString(R.string.notification_using_bridges) + ": " + bridgeList, TRANSPROXY_NOTIFY_ID, R.drawable.tornotification, -1); showToolbarNotification(getString(R.string.notification_using_bridges) + ": " + bridgeList, TRANSPROXY_NOTIFY_ID, R.drawable.tornotification, -1);
boolean obfsBridges = prefs.getBoolean(TorConstants.PREF_BRIDGES_OBFUSCATED, false);
String bridgeCfgKey = "bridge";
if (obfsBridges)
{
bridgeCfgKey = bridgeCfgKey + " obfs2";
}
StringTokenizer st = new StringTokenizer(bridgeList,bridgeDelim); StringTokenizer st = new StringTokenizer(bridgeList,bridgeDelim);
while (st.hasMoreTokens()) while (st.hasMoreTokens())
{ {
mBinder.updateConfiguration("bridge", st.nextToken(), false); mBinder.updateConfiguration(bridgeCfgKey, st.nextToken(), false);
} }
mBinder.updateConfiguration("ClientTransportPlugin","obfs2 exec /data/data/org.torproject.android/app_bin/obfsproxy --managed",false); if (obfsBridges)
{
mBinder.updateConfiguration("ClientTransportPlugin","obfs2 exec " + fileObfsProxy.getAbsolutePath() + " --managed", false);
}
mBinder.updateConfiguration("UpdateBridgesFromAuthority", "0", false); mBinder.updateConfiguration("UpdateBridgesFromAuthority", "0", false);
} }
else else
{ {