Console: Lookup RI by caps

stub out lookup by IP
This commit is contained in:
zzz
2016-11-23 16:00:36 +00:00
parent 8146f6fdb6
commit 89733251d4
3 changed files with 22 additions and 5 deletions

View File

@ -7,7 +7,7 @@ public class NetDbHelper extends HelperBase {
private String _routerPrefix;
private String _version;
private String _country;
private String _family;
private String _family, _caps, _ip;
private int _full;
private boolean _lease;
private boolean _debug;
@ -56,6 +56,18 @@ public class NetDbHelper extends HelperBase {
_family = DataHelper.stripHTML(c); // XSS
}
/** @since 0.9.28 */
public void setCaps(String c) {
if (c != null)
_caps = DataHelper.stripHTML(c); // XSS
}
/** @since 0.9.28 */
public void setIp(String c) {
if (c != null)
_ip = DataHelper.stripHTML(c); // XSS
}
public void setFull(String f) {
try {
_full = Integer.parseInt(f);
@ -82,8 +94,9 @@ public class NetDbHelper extends HelperBase {
NetDbRenderer renderer = new NetDbRenderer(_context);
try {
renderNavBar();
if (_routerPrefix != null || _version != null || _country != null || _family != null)
renderer.renderRouterInfoHTML(_out, _routerPrefix, _version, _country, _family);
if (_routerPrefix != null || _version != null || _country != null ||
_family != null || _caps != null || _ip != null)
renderer.renderRouterInfoHTML(_out, _routerPrefix, _version, _country, _family, _caps, _ip);
else if (_lease)
renderer.renderLeaseSetHTML(_out, _debug);
else if (_full == 3)

View File

@ -88,7 +88,7 @@ class NetDbRenderer {
* @param family may be null
*/
public void renderRouterInfoHTML(Writer out, String routerPrefix, String version,
String country, String family) throws IOException {
String country, String family, String caps, String ip) throws IOException {
StringBuilder buf = new StringBuilder(4*1024);
if (".".equals(routerPrefix)) {
renderRouterInfo(buf, _context.router().getRouterInfo(), true, true);
@ -100,9 +100,11 @@ class NetDbRenderer {
if ((routerPrefix != null && key.toBase64().startsWith(routerPrefix)) ||
(version != null && version.equals(ri.getVersion())) ||
(country != null && country.equals(_context.commSystem().getCountry(key))) ||
(family != null && family.equals(ri.getOption("family")))) {
(family != null && family.equals(ri.getOption("family"))) ||
(caps != null && caps.equals(ri.getCapabilities()))) {
renderRouterInfo(buf, ri, false, true);
notFound = false;
// } else { ip TODO
}
}
if (notFound) {