commit c6321626cf04db74a8c08af19331c686757adc85
Author: Arthur Edelstein <arthuredelstein(a)gmail.com>
Date: Sat Mar 21 16:32:07 2015 -0700
Bug 14937: Show meek and flashproxy bridges in tor circuit display
---
src/chrome/content/tor-circuit-display.js | 37 ++++++++++++++++-------------
src/modules/tor-control-port.js | 4 +---
2 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/src/chrome/content/tor-circuit-display.js b/src/chrome/content/tor-circuit-display.js
index a4ba919..8997757 100644
--- a/src/chrome/content/tor-circuit-display.js
+++ b/src/chrome/content/tor-circuit-display.js
@@ -47,7 +47,7 @@ let credentialsToNodeDataMap = {},
// __trimQuotes(s)__.
// Removes quotation marks around a quoted string.
-let trimQuotes = s => s ? s.match(/^\"(.*)\"$/)[1] : undefined;
+let trimQuotes = s => s ? s.match(/^"(.*)"$/)[1] : undefined;
// __getBridge(id)__.
// Gets the bridge parameters for a given node ID. If the node
@@ -89,7 +89,8 @@ let nodeDataForID = function* (controller, id) {
if (result.ip) {
// Get the country code for the node's IP address.
try {
- result.countryCode = yield controller.getInfo("ip-to-country/" + result.ip);
+ let countryCode = yield controller.getInfo("ip-to-country/" + result.ip);
+ result.countryCode = countryCode === "??" ? null : countryCode;
} catch (e) { }
}
return result;
@@ -190,22 +191,24 @@ let showCircuitDisplay = function (show) {
let nodeLines = function (nodeData) {
let result = [];
for (let {ip, countryCode, type, bridgeType} of nodeData) {
- let bridge = type === "bridge";
+ let bridge = type === "bridge",
+ country = countryCode ? localizedCountryNameFromCode(countryCode) : null;
result.push(
- // For each relay, show its apparent host country.
- (countryCode ? localizedCountryNameFromCode(countryCode)
- : uiString("unknown_country")) +
- (bridge ?
- // As we have a bridge, don't show the IP address
- // but show the bridge type.
- " (" + uiString("tor_bridge") +
- ((bridgeType !== "vanilla") ? (": " + bridgeType) : "") + ")"
- :
- // As we don't have a bridge, show the IP address
- // of the node. Use unicode escapes to ensure that
- // parentheses behave properly in both left-to-right
- // and right-to-left languages.
- " ‭ (" + (ip || uiString("ip_unknown")) + ")‬"));
+ bridge ?
+ // As we have a bridge, don't show the IP address
+ // but show the bridge type.
+ (uiString("tor_bridge") +
+ ((bridgeType !== "vanilla") ? (": " + bridgeType) : "") +
+ (country ? " (" + country + ")" : ""))
+ :
+ // For each non-bridge relay, show its host country and IP.
+ (country || uiString("unknown_country")) +
+ // As we don't have a bridge, show the IP address
+ // of the node. Use unicode escapes to ensure that
+ // parentheses behave properly in both left-to-right
+ // and right-to-left languages.
+ " ‭ (" + (ip || uiString("ip_unknown")) + ")‬"
+ );
}
return result;
};
diff --git a/src/modules/tor-control-port.js b/src/modules/tor-control-port.js
index a55a0d8..710643e 100644
--- a/src/modules/tor-control-port.js
+++ b/src/modules/tor-control-port.js
@@ -476,11 +476,9 @@ info.bridgeParser = function(bridgeLine) {
// Several bridge types have a similar format:
} else {
result.type = tokens[0];
- if (["fte", "obfs3", "obfs4", "scramblesuit"]
+ if (["flashproxy", "fte", "meek", "obfs3", "obfs4", "scramblesuit"]
.indexOf(result.type) >= 0) {
[result.address, result.ID] = tokens.slice(1);
- } else if (result.type === "meek") {
- // do nothing for now
}
}
return result.type ? result : null;