forked from I2P_Developers/i2p.i2p
Console: Add support for IPv6 prefix lookup
This commit is contained in:
@ -258,7 +258,7 @@ public class NetDbHelper extends HelperBase {
|
|||||||
"<tr><td>Country Code:</td><td><input type=\"text\" name=\"c\"></td><td>e.g. ru</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>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>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>IP or Hostname:</td><td><input type=\"text\" name=\"ip\"></td><td>host name, 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>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>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>Port Number:</td><td><input type=\"text\" name=\"port\"></td><td></td></tr>\n" +
|
||||||
|
@ -111,11 +111,15 @@ class NetDbRenderer {
|
|||||||
ipMode = 2;
|
ipMode = 2;
|
||||||
} else if (ip.endsWith("/8")) {
|
} else if (ip.endsWith("/8")) {
|
||||||
ipMode = 3;
|
ipMode = 3;
|
||||||
|
} else if (ip.indexOf(':') > 0) {
|
||||||
|
ipMode = 4;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < ipMode; i++) {
|
if (ipMode > 0 && ipMode < 4) {
|
||||||
int last = ip.substring(0, ip.length() - 1).lastIndexOf('.');
|
for (int i = 0; i < ipMode; i++) {
|
||||||
if (last > 0)
|
int last = ip.substring(0, ip.length() - 1).lastIndexOf('.');
|
||||||
ip = ip.substring(0, last + 1);
|
if (last > 0)
|
||||||
|
ip = ip.substring(0, last + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (RouterInfo ri : routers) {
|
for (RouterInfo ri : routers) {
|
||||||
|
Reference in New Issue
Block a user