diff --git a/apps/routerconsole/java/src/net/i2p/router/web/helpers/NetDbHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/helpers/NetDbHelper.java index a5e4987986d7b608656bc2fa2825662b8b86c92c..ad93818bd4e0c8cacdad7ba0aa6696abb4a49203 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/helpers/NetDbHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/helpers/NetDbHelper.java @@ -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" + diff --git a/apps/routerconsole/java/src/net/i2p/router/web/helpers/NetDbRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/helpers/NetDbRenderer.java index 52f56b9f10155332231b0af3dbd7d8f6b6087b10..11b2faf03ac394c0315add737f38d1c041f9efed 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/helpers/NetDbRenderer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/helpers/NetDbRenderer.java @@ -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) { diff --git a/apps/routerconsole/jsp/netdb.jsp b/apps/routerconsole/jsp/netdb.jsp index 95c5957df25c112f086b4c7baa7ccfd7bb3bcc11..1cffbbac377dfcfc28ccf81944a5d5ba12cbc154 100644 --- a/apps/routerconsole/jsp/netdb.jsp +++ b/apps/routerconsole/jsp/netdb.jsp @@ -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>