forked from I2P_Developers/i2p.i2p
NedDb advanced lookup layout and theme improvements
This commit is contained in:
@ -233,7 +233,7 @@ public class NetDbHelper extends HelperBase {
|
||||
}
|
||||
if (!span)
|
||||
buf.append("</center>");
|
||||
buf.append("</div>");
|
||||
buf.append("</div>\n");
|
||||
_out.write(buf.toString());
|
||||
}
|
||||
|
||||
@ -241,23 +241,25 @@ public class NetDbHelper extends HelperBase {
|
||||
* @since 0.9.28
|
||||
*/
|
||||
private void renderLookupForm() throws IOException {
|
||||
_out.write("<form action=\"/netdb\" method=\"GET\"><p><b>Pick One</b></p>\n" +
|
||||
"Caps <input type=\"text\" name=\"caps\">e.g. f or XOfR<br>\n" +
|
||||
"Cost <input type=\"text\" name=\"cost\"><br>\n" +
|
||||
"Country code <input type=\"text\" name=\"c\">e.g. ru<br>\n" +
|
||||
"Family <input type=\"text\" name=\"fam\"><br>\n" +
|
||||
"Hash prefix <input type=\"text\" name=\"r\"><br>\n" +
|
||||
"IP <input type=\"text\" name=\"ip\">host name, IPv4, or IPv6, /24,/16,/8 suffixes optional for IPv4<br>\n" +
|
||||
"IPv6 Prefix <input type=\"text\" name=\"ipv6\"><br>\n" +
|
||||
"MTU <input type=\"text\" name=\"mtu\"><br>\n" +
|
||||
"Port <input type=\"text\" name=\"port\"><br>\n" +
|
||||
"Sig Type <input type=\"text\" name=\"type\"><br>\n" +
|
||||
"SSU Caps <input type=\"text\" name=\"ssucaps\"><br>\n" +
|
||||
"Version <input type=\"text\" name=\"v\"><br>\n" +
|
||||
"<p><b>Add Sybil analysis (must pick one above):</b></p>\n" +
|
||||
"Sybil close to <input type=\"text\" name=\"sybil2\">Router hash, dest hash, b32, or from address book<br>\n" +
|
||||
"or Sybil close to this router <input type=\"checkbox\" class=\"optbox\" value=\"1\" name=\"sybil\"><br>" +
|
||||
"<p><input type=\"submit\" class=\"search\" value=\"Lookup\"></p>" +
|
||||
"</form>\n");
|
||||
_out.write("<form action=\"/netdb\" method=\"GET\">\n" +
|
||||
"<table id=\"netdblookup\"><tr><th colspan=\"3\">Network Database Search</th></tr>\n" +
|
||||
"<tr><td colspan=\"3\" class=\"subheading\"><b>Select one search field <i>only</i>:</b></td></tr>\n" +
|
||||
"<tr><td>Capabilities:</td><td><input type=\"text\" name=\"caps\"></td><td>e.g. f or XOfR</td></tr>\n" +
|
||||
"<tr><td>Cost:</td><td><input type=\"text\" name=\"cost\"></td><td></td></tr>\n" +
|
||||
"<tr><td>Country Code:</td><td><input type=\"text\" name=\"c\"></td><td>e.g. ru</td></tr>\n" +
|
||||
"<tr><td>Router Family:</td><td><input type=\"text\" name=\"fam\"></td><td></td></tr>\n" +
|
||||
"<tr><td>Hash Prefix:</td><td><input type=\"text\" name=\"r\"></td><td></td></tr>\n" +
|
||||
"<tr><td>IP or Hostname:</td><td><input type=\"text\" name=\"ip\"></td><td>host name, IPv4, or IPv6, /24,/16,/8 suffixes optional for IPv4</td></tr>\n" +
|
||||
"<tr><td>IPv6 Prefix:</td><td><input type=\"text\" name=\"ipv6\"></td><td></td></tr>\n" +
|
||||
"<tr><td>MTU:</td><td><input type=\"text\" name=\"mtu\"></td><td></td></tr>\n" +
|
||||
"<tr><td>Port Number:</td><td><input type=\"text\" name=\"port\"></td><td></td></tr>\n" +
|
||||
"<tr><td>Signature Type:</td><td><input type=\"text\" name=\"type\"></td><td></td></tr>\n" +
|
||||
"<tr><td>SSU Capabilities:</td><td><input type=\"text\" name=\"ssucaps\"></td><td></td></tr>\n" +
|
||||
"<tr><td>Router Version:</td><td><input type=\"text\" name=\"v\"></td><td></td></tr>\n" +
|
||||
"<tr><td colspan=\"3\" class=\"subheading\"><b>Add Sybil analysis (must pick one above):</b></td></tr>\n" +
|
||||
"<tr><td>Sybil close to:</td><td><input type=\"text\" name=\"sybil2\"></td><td>Router hash, dest hash, b32, or from address book</td>\n" +
|
||||
"<tr><td>or Sybil close to this router:</td><td><input type=\"checkbox\" class=\"optbox\" value=\"1\" name=\"sybil\"></td><td></td></tr>\n" +
|
||||
"<tr><td colspan=\"3\" class=\"optionsave\"><button type=\"submit\" class=\"search\" value=\"Lookup\">Lookup</button></td></tr>\n" +
|
||||
"</table>\n</form>\n");
|
||||
}
|
||||
}
|
||||
|
@ -521,8 +521,9 @@ class NetDbRenderer {
|
||||
buf.append("<tr><th align=\"left\">" + _t("Country") + "</th><th>" + _t("Count") + "</th></tr>\n");
|
||||
for (String country : countryList) {
|
||||
int num = countries.count(country);
|
||||
buf.append("<tr><td><img height=\"11\" width=\"16\" alt=\"").append(country.toUpperCase(Locale.US)).append("\"");
|
||||
buf.append(" src=\"/flags.jsp?c=").append(country).append("\"> <a href=\"/netdb?c=").append(country).append("\">");
|
||||
buf.append("<tr><td><a href=\"/netdb?c=").append(country).append("\">");
|
||||
buf.append("<img height=\"11\" width=\"16\" alt=\"").append(country.toUpperCase(Locale.US)).append("\"");
|
||||
buf.append(" src=\"/flags.jsp?c=").append(country).append("\">");
|
||||
buf.append(getTranslatedCountry(country));
|
||||
buf.append("</a></td><td align=\"center\">").append(num).append("</td></tr>\n");
|
||||
}
|
||||
@ -616,9 +617,10 @@ class NetDbRenderer {
|
||||
.append("<td colspan=\"2\">");
|
||||
String country = _context.commSystem().getCountry(info.getIdentity().getHash());
|
||||
if(country != null) {
|
||||
buf.append("<a href=\"/netdb?c=").append(country).append("\">");
|
||||
buf.append("<img height=\"11\" width=\"16\" alt=\"").append(country.toUpperCase(Locale.US)).append('\"');
|
||||
buf.append(" title=\"").append(getTranslatedCountry(country)).append('\"');
|
||||
buf.append(" src=\"/flags.jsp?c=").append(country).append("\"> ");
|
||||
buf.append(" src=\"/flags.jsp?c=").append(country).append("\"> ").append("</a>");
|
||||
}
|
||||
for (RouterAddress addr : info.getAddresses()) {
|
||||
String style = addr.getTransportStyle();
|
||||
|
@ -832,7 +832,7 @@ public class SummaryHelper extends HelperBase {
|
||||
if (allowReseed()) {
|
||||
if (reseedInProgress) {
|
||||
// While reseed occurring, show status message instead
|
||||
buf.append("<i>").append(_context.netDb().reseedChecker().getStatus()).append("</i><br>");
|
||||
buf.append("<div class=\"sb_notice\"><i>").append(_context.netDb().reseedChecker().getStatus()).append("</i></div>");
|
||||
} else {
|
||||
// While no reseed occurring, show reseed link
|
||||
long nonce = _context.random().nextLong();
|
||||
@ -849,7 +849,7 @@ public class SummaryHelper extends HelperBase {
|
||||
if (!reseedInProgress) {
|
||||
String reseedErrorMessage = _context.netDb().reseedChecker().getError();
|
||||
if (reseedErrorMessage.length() > 0) {
|
||||
buf.append("<i>").append(reseedErrorMessage).append("</i><br>");
|
||||
buf.append("<div class=\"sb_notice\"><i>").append(reseedErrorMessage).append("</i></div>");
|
||||
}
|
||||
}
|
||||
if (buf.length() <= 0)
|
||||
|
@ -218,12 +218,12 @@ class SybilRenderer {
|
||||
|
||||
// Distance to our router analysis
|
||||
buf.append("<h3 id=\"ritoday\" class=\"sybils\">Closest Floodfills to Our Routing Key (Where we Store our RI)</h3>");
|
||||
buf.append("<p><a href=\"/netdb?caps=f&sybil\">See all</a></p>");
|
||||
buf.append("<p class=\"sybil_info\"><a href=\"/netdb?caps=f&sybil\">See all</a></p>");
|
||||
renderRouterInfoHTML(out, buf, ourRKey, avgMinDist, ris, points);
|
||||
RouterKeyGenerator rkgen = _context.routerKeyGenerator();
|
||||
Hash nkey = rkgen.getNextRoutingKey(us);
|
||||
buf.append("<h3 id=\"ritmrw\" class=\"sybils\">Closest Floodfills to Tomorrow's Routing Key (Where we will Store our RI)</h3>");
|
||||
buf.append("<p><a href=\"/netdb?caps=f&sybil\">See all</a></p>");
|
||||
buf.append("<p class=\"sybil_info\"><a href=\"/netdb?caps=f&sybil\">See all</a></p>");
|
||||
renderRouterInfoHTML(out, buf, nkey, avgMinDist, ris, points);
|
||||
|
||||
buf.append("<h3 id=\"dht\" class=\"sybils\">Closest Floodfills to Our Router Hash (DHT Neighbors if we are Floodfill)</h3>");
|
||||
@ -247,11 +247,11 @@ class SybilRenderer {
|
||||
TunnelPool in = clientInboundPools.get(client);
|
||||
String name = (in != null) ? in.getSettings().getDestinationNickname() : client.toBase64().substring(0,4);
|
||||
buf.append("<h3 class=\"sybils\">Closest floodfills to the Routing Key for " + DataHelper.escapeHTML(name) + " (where we store our LS)</h3>");
|
||||
buf.append("<p><a href=\"/netdb?caps=f&sybil=" + ls.getHash().toBase64() + "\">See all</a></p>");
|
||||
buf.append("<p class=\"sybil_info\"><a href=\"/netdb?caps=f&sybil=" + ls.getHash().toBase64() + "\">See all</a></p>");
|
||||
renderRouterInfoHTML(out, buf, rkey, avgMinDist, ris, points);
|
||||
nkey = rkgen.getNextRoutingKey(ls.getHash());
|
||||
buf.append("<h3 class=\"sybils\">Closest floodfills to Tomorrow's Routing Key for " + DataHelper.escapeHTML(name) + " (where we will store our LS)</h3>");
|
||||
buf.append("<p><a href=\"/netdb?caps=f&sybil=" + ls.getHash().toBase64() + "\">See all</a></p>");
|
||||
buf.append("<p class=\"sybil_info\"><a href=\"/netdb?caps=f&sybil=" + ls.getHash().toBase64() + "\">See all</a></p>");
|
||||
renderRouterInfoHTML(out, buf, nkey, avgMinDist, ris, points);
|
||||
}
|
||||
|
||||
@ -406,7 +406,7 @@ class SybilRenderer {
|
||||
if (ip == null)
|
||||
continue;
|
||||
if (ip[0] == ourIP[0] && ip[1] == ourIP[1]) {
|
||||
buf.append("<p id=\"sybil_floodfill\"><b>");
|
||||
buf.append("<p id=\"sybil_info\"><b>");
|
||||
if (ip[2] == ourIP[2]) {
|
||||
if (ip[3] == ourIP[3]) {
|
||||
buf.append("Same IP as us");
|
||||
@ -457,7 +457,7 @@ class SybilRenderer {
|
||||
int i2 = (i >> 8) & 0xff;
|
||||
int i3 = i & 0xff;
|
||||
String sip = i0 + "." + i1 + '.' + i2 + '.' + i3;
|
||||
buf.append("<p class=\"sybil floodfill\"><b>").append(count).append(" floodfills with IP <a href=\"/netdb?ip=")
|
||||
buf.append("<p class=\"sybil_info\"><b>").append(count).append(" floodfills with IP <a href=\"/netdb?ip=")
|
||||
.append(sip).append("&sybil\">").append(sip)
|
||||
.append("</a>:</b></p>");
|
||||
for (RouterInfo info : ris) {
|
||||
@ -510,7 +510,7 @@ class SybilRenderer {
|
||||
int i1 = (i >> 8) & 0xff;
|
||||
int i2 = i & 0xff;
|
||||
String sip = i0 + "." + i1 + '.' + i2 + ".0/24";
|
||||
buf.append("<p class=\"sybil floodfill\"><b>").append(count).append(" floodfills with IP <a href=\"/netdb?ip=")
|
||||
buf.append("<p class=\"sybil_info\"><b>").append(count).append(" floodfills with IP <a href=\"/netdb?ip=")
|
||||
.append(sip).append("&sybil\">").append(sip)
|
||||
.append("</a>:</b></p>");
|
||||
for (RouterInfo info : ris) {
|
||||
@ -560,7 +560,7 @@ class SybilRenderer {
|
||||
int i0 = i >> 8;
|
||||
int i1 = i & 0xff;
|
||||
String sip = i0 + "." + i1 + ".0/16";
|
||||
buf.append("<p class=\"sybil floodfill\"><b>").append(count).append(" floodfills with IP <a href=\"/netdb?ip=")
|
||||
buf.append("<p class=\"sybil_info\"><b>").append(count).append(" floodfills with IP <a href=\"/netdb?ip=")
|
||||
.append(sip).append("&sybil\">").append(sip)
|
||||
.append("</a></b></p>");
|
||||
for (RouterInfo info : ris) {
|
||||
@ -728,11 +728,11 @@ class SybilRenderer {
|
||||
if (i == 0) {
|
||||
//buf.append("<p><b>Not to worry, but above router is closer than average minimum distance " + fmt.format(avgMinDist) + "</b></p>");
|
||||
} else if (i == 1) {
|
||||
buf.append("<p><b>Not to worry, but above routers are closer than average minimum distance " + fmt.format(avgMinDist) + "</b></p>");
|
||||
buf.append("<p class=\"sybil_info\"><b>Not to worry, but above routers are closer than average minimum distance " + fmt.format(avgMinDist) + "</b></p>");
|
||||
} else if (i == 2) {
|
||||
buf.append("<p><b>Possible Sybil Warning - above routers are closer than average minimum distance " + fmt.format(avgMinDist) + "</b></p>");
|
||||
buf.append("<p class=\"sybil_info\"><b>Possible Sybil Warning - above routers are closer than average minimum distance " + fmt.format(avgMinDist) + "</b></p>");
|
||||
} else {
|
||||
buf.append("<p><b>Major Sybil Warning - above router is closer than average minimum distance " + fmt.format(avgMinDist) + "</b></p>");
|
||||
buf.append("<p class=\"sybil_info\"><b>Major Sybil Warning - above router is closer than average minimum distance " + fmt.format(avgMinDist) + "</b></p>");
|
||||
}
|
||||
}
|
||||
// this is dumb because they are already sorted
|
||||
@ -884,9 +884,10 @@ class SybilRenderer {
|
||||
buf.append("<tr><td><b>" + _t("Addresses") + ":</b></td><td colspan=\"3\">");
|
||||
String country = _context.commSystem().getCountry(info.getIdentity().getHash());
|
||||
if(country != null) {
|
||||
buf.append("<a href=\"/netdb?c=").append(country).append("\">");
|
||||
buf.append("<img height=\"11\" width=\"16\" alt=\"").append(country.toUpperCase(Locale.US)).append('\"');
|
||||
buf.append(" title=\"").append(getTranslatedCountry(country)).append('\"');
|
||||
buf.append(" src=\"/flags.jsp?c=").append(country).append("\"> ");
|
||||
buf.append(" src=\"/flags.jsp?c=").append(country).append("\"> ").append("</a>");
|
||||
}
|
||||
for (RouterAddress addr : info.getAddresses()) {
|
||||
String style = addr.getTransportStyle();
|
||||
@ -921,7 +922,7 @@ class SybilRenderer {
|
||||
return;
|
||||
final DecimalFormat fmt = new DecimalFormat("#0.00");
|
||||
XORComparator<Hash> xor = new XORComparator<Hash>(Hash.FAKE_HASH);
|
||||
out.write("<h3>Group Distances</h3><table><tr><th>Hash<th>Distance from previous</tr>\n");
|
||||
out.write("<h3 class=\"tabletitle\">Group Distances</h3><table class=\"sybil_distance\"><tr><th>Hash<th>Distance from previous</tr>\n");
|
||||
Collections.sort(sybils, xor);
|
||||
Hash prev = null;
|
||||
for (Hash h : sybils) {
|
||||
@ -952,8 +953,8 @@ class SybilRenderer {
|
||||
prev = null;
|
||||
final int limit = Math.min(10, sybils.size());
|
||||
for (int i = start; i <= days; i++) {
|
||||
out.write("<h3>Distance for " + new Date(now) +
|
||||
"</h3><table><tr><th>Hash<th>Distance<th>Distance from previous</tr>\n");
|
||||
out.write("<h3 class=\"tabletitle\">Distance for " + new Date(now) +
|
||||
"</h3><table class=\"sybil_distance\"><tr><th>Hash<th>Distance<th>Distance from previous</tr>\n");
|
||||
Hash rkey = rkgen.getRoutingKey(from, now);
|
||||
xor = new XORComparator<Hash>(rkey);
|
||||
Collections.sort(sybils, xor);
|
||||
|
Reference in New Issue
Block a user