[tor-commits] [orbot/master] choose up to 2 bridges from default list randomly
n8fr8 at torproject.org
n8fr8 at torproject.org
Tue Jan 26 03:13:47 UTC 2016
commit 2a728140b43bdf5ca8a19e6236f585741700d5bc
Author: Nathan Freitas <nathan at freitas.net>
Date: Mon Jan 25 22:09:26 2016 -0500
choose up to 2 bridges from default list randomly
---
assets/bridges.txt | 2 +-
src/org/torproject/android/OrbotMainActivity.java | 15 +++++++++++++--
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/assets/bridges.txt b/assets/bridges.txt
index 06472cf..693c3be 100644
--- a/assets/bridges.txt
+++ b/assets/bridges.txt
@@ -11,4 +11,4 @@ obfs4 104.131.108.182:56880 EF577C30B9F788B0E1801CF7E433B3B77792B77A cert=0SFhfD
obfs4 109.105.109.147:13764 BBB28DF0F201E706BE564EFE690FE9577DD8386D cert=KfMQN/tNMFdda61hMgpiMI7pbwU1T+wxjTulYnfw+4sgvG0zSH7N7fwT10BI8MUdAD7iJA iat-mode=0
meek 0.0.2.0:1 46D4A71197B8FA515A826C6B017C522FE264655B url=https://meek-reflect.appspot.com/ front=www.google.com
meek 0.0.2.0:2 B9E7141C594AF25699E0079C1F0146F409495296 url=https://d2zfqthxsdq309.cloudfront.net/ front=a0.awsstatic.com
-meek 0.0.2.0:3 A2C13B7DFCAB1CBF3A884B6EB99A98067AB6EF44 url=https://az786092.vo.msecnd.net/ front=ajax.aspnetcdn.com
+meek 0.0.2.0:3 A2C13B7DFCAB1CBF3A884B6EB99A98067AB6EF44 url=https://az786092.vo.msecnd.net/ front=ajax.aspnetcdn.com
\ No newline at end of file
diff --git a/src/org/torproject/android/OrbotMainActivity.java b/src/org/torproject/android/OrbotMainActivity.java
index ae9a8dc..4165a21 100644
--- a/src/org/torproject/android/OrbotMainActivity.java
+++ b/src/org/torproject/android/OrbotMainActivity.java
@@ -1410,15 +1410,26 @@ public class OrbotMainActivity extends AppCompatActivity
long seed = System.nanoTime();
Collections.shuffle(alBridges, new Random(seed));
+ //let's just pull up to 2 bridges from the defaults at time
+ int maxBridges = 2;
+ int bridgeCount = 0;
+
//now go through the list to find the bridges we want
for (Bridge b : alBridges)
{
if (b.type.equals(type))
{
+
sbConfig.append(b.type);
sbConfig.append(' ');
- sbConfig.append(b.config);
- sbConfig.append('\n');
+ sbConfig.append(b.config);
+
+ bridgeCount++;
+
+ if (bridgeCount == maxBridges)
+ break;
+ else
+ sbConfig.append("\n");
}
}
More information about the tor-commits
mailing list