Commit 5ac0bb12 authored by Georg Koppen's avatar Georg Koppen
Browse files

Merge remote-tracking branch 'arthur/14937+7'

parents 55d3976e c6321626
......@@ -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;
};
......
......@@ -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;
......
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