forked from I2P_Developers/i2p.i2p
Console: Add netdb search by introducer count
This commit is contained in:
@@ -26,7 +26,7 @@ public class NetDbHelper extends FormHandler {
|
||||
private String _version;
|
||||
private String _country;
|
||||
private String _family, _caps, _ip, _sybil, _mtu, _ssucaps, _ipv6, _transport, _hostname, _sort;
|
||||
private int _full, _port, _cost, _page, _mode, _highPort;
|
||||
private int _full, _port, _cost, _page, _mode, _highPort, _icount;
|
||||
private long _date;
|
||||
private int _limit = DEFAULT_LIMIT;
|
||||
private boolean _lease;
|
||||
@@ -226,12 +226,18 @@ public class NetDbHelper extends FormHandler {
|
||||
} catch (NumberFormatException nfe) {}
|
||||
}
|
||||
|
||||
|
||||
/** @since 0.9.57 */
|
||||
public void setSort(String f) {
|
||||
_sort = f;
|
||||
}
|
||||
|
||||
/** @since 0.9.58 */
|
||||
public void setIntros(String f) {
|
||||
try {
|
||||
_icount = Integer.parseInt(f);
|
||||
} catch (NumberFormatException nfe) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* call for non-text-mode browsers
|
||||
* @since 0.9.1
|
||||
@@ -305,11 +311,12 @@ public class NetDbHelper extends FormHandler {
|
||||
if (_routerPrefix != null || _version != null || _country != null ||
|
||||
_family != null || _caps != null || _ip != null || _sybil != null ||
|
||||
_port != 0 || _type != null || _mtu != null || _ipv6 != null ||
|
||||
_ssucaps != null || _transport != null || _cost != 0 || _etype != null) {
|
||||
_ssucaps != null || _transport != null || _cost != 0 || _etype != null ||
|
||||
_icount > 0) {
|
||||
renderer.renderRouterInfoHTML(_out, _limit, _page,
|
||||
_routerPrefix, _version, _country,
|
||||
_family, _caps, _ip, _sybil, _port, _highPort, _type, _etype,
|
||||
_mtu, _ipv6, _ssucaps, _transport, _cost);
|
||||
_mtu, _ipv6, _ssucaps, _transport, _cost, _icount);
|
||||
} else if (_lease) {
|
||||
renderer.renderLeaseSetHTML(_out, _debug);
|
||||
} else if (_hostname != null) {
|
||||
@@ -428,6 +435,7 @@ public class NetDbHelper extends FormHandler {
|
||||
"<tr><td>" + _t("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>" + _t("Full destination, name, Base32, or hash") + ":</td><td><input type=\"text\" name=\"ls\"></td><td></td></tr>\n" +
|
||||
"<tr><td>Min. Introducer Count:</td><td><input type=\"text\" name=\"i\"></td><td></td></tr>\n" +
|
||||
"<tr><td>IP:</td><td><input type=\"text\" name=\"ip\"></td><td>IPv4 or IPv6, /24,/16,/8 suffixes optional for IPv4, prefix ok for IPv6</td></tr>\n" +
|
||||
"<tr><td>IPv6 Prefix:</td><td><input type=\"text\" name=\"ipv6\"></td><td></td></tr>\n" +
|
||||
"<tr><td>" + _t("MTU") + ":</td><td><input type=\"text\" name=\"mtu\"></td><td></td></tr>\n" +
|
||||
|
@@ -110,7 +110,7 @@ class NetDbRenderer {
|
||||
String country, String family, String caps,
|
||||
String ip, String sybil, int port, int highPort, SigType type, EncType etype,
|
||||
String mtu, String ipv6, String ssucaps,
|
||||
String tr, int cost) throws IOException {
|
||||
String tr, int cost, int icount) throws IOException {
|
||||
StringBuilder buf = new StringBuilder(4*1024);
|
||||
List<Hash> sybils = sybil != null ? new ArrayList<Hash>(128) : null;
|
||||
if (".".equals(routerPrefix)) {
|
||||
@@ -185,6 +185,13 @@ class NetDbRenderer {
|
||||
ubuf.append("&cost=").append(cost);
|
||||
if (sybil != null)
|
||||
ubuf.append("&sybil=").append(sybil);
|
||||
String itag;
|
||||
if (icount > 0) {
|
||||
ubuf.append("&i=").append(icount);
|
||||
itag = "itag" + (icount - 1);
|
||||
} else {
|
||||
itag = null;
|
||||
}
|
||||
if (page > 0) {
|
||||
buf.append("<div class=\"netdbnotfound\">" +
|
||||
"<a href=\"/netdb?pg=").append(page)
|
||||
@@ -447,6 +454,24 @@ class NetDbRenderer {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (itag != null) {
|
||||
for (RouterAddress ra : ri.getAddresses()) {
|
||||
if (ra.getOption(itag) != null) {
|
||||
if (skipped < toSkip) {
|
||||
skipped++;
|
||||
break;
|
||||
}
|
||||
if (written++ >= pageSize) {
|
||||
morePages = true;
|
||||
break outerloop;
|
||||
}
|
||||
renderRouterInfo(buf, ri, false, true);
|
||||
if (sybil != null)
|
||||
sybils.add(key);
|
||||
notFound = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (notFound) {
|
||||
@@ -484,6 +509,8 @@ class NetDbRenderer {
|
||||
buf.append("Caps ").append(ssucaps).append(' ');
|
||||
if (tr != null)
|
||||
buf.append(_t("Transport")).append(' ').append(tr).append(' ');
|
||||
if (icount > 0)
|
||||
buf.append("with ").append(icount).append(" introducers ");
|
||||
buf.append(_t("not found in network database"));
|
||||
buf.append("</div>");
|
||||
} else if (page > 0 || morePages) {
|
||||
|
@@ -39,6 +39,7 @@
|
||||
<jsp:setProperty name="formhandler" property="date" value="<%=request.getParameter(\"date\")%>" />
|
||||
<jsp:setProperty name="formhandler" property="leaseset" value="<%=request.getParameter(\"ls\")%>" />
|
||||
<jsp:setProperty name="formhandler" property="sort" value="<%=request.getParameter(\"s\")%>" />
|
||||
<jsp:setProperty name="formhandler" property="intros" value="<%=request.getParameter(\"i\")%>" />
|
||||
<%@include file="formhandler.jsi" %>
|
||||
<jsp:getProperty name="formhandler" property="netDbSummary" />
|
||||
</div></body></html>
|
||||
|
Reference in New Issue
Block a user