Commit ed2e1479 authored by Matthew Finkel's avatar Matthew Finkel Committed by Georg Koppen
Browse files

Bug 33931 - Indicate bridge type in stream

Use the first-byte to indicate if the following data stream contains
default bridges or custom bridges. In addition, if the stream contains
default bridges, then indicate if only one type of bridge should be used
after parsing the stream.
parent 2a7091dd
......@@ -48,6 +48,18 @@ public class CustomTorInstaller extends TorInstaller {
*/
String userDefinedBridgeList = Prefs.getBridgesList();
byte bridgeType = (byte) (userDefinedBridgeList.length() > 5 ? 1 : 0);
// Terrible hack. Must keep in sync with topl::addBridgesFromResources.
if (bridgeType == 0) {
switch (userDefinedBridgeList) {
case "obfs4":
bridgeType = 2;
break;
case "meek":
bridgeType = 3;
break;
}
}
ByteArrayInputStream bridgeTypeStream = new ByteArrayInputStream(new byte[]{bridgeType});
InputStream bridgeStream = (bridgeType == 1) ? new ByteArrayInputStream((userDefinedBridgeList + "\r\n").getBytes())
: context.getResources().getAssets().open("common/bridges.txt");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment