forked from I2P_Developers/i2p.i2p
Change calls from Addresses.getIP() to Addresses.getIPOnly() for peer IPs
getIPOnly() is more efficient for pure IP addresses (no hostnames)
This commit is contained in:
@@ -1258,7 +1258,7 @@ class NetDbRenderer {
|
||||
private static String getAltIPv6(String ip) {
|
||||
if (ip.contains("::")) {
|
||||
// convert to expanded
|
||||
byte[] bip = Addresses.getIP(ip);
|
||||
byte[] bip = Addresses.getIPOnly(ip);
|
||||
if (bip != null)
|
||||
return Addresses.toString(bip);
|
||||
} else if (ip.contains(":0:")) {
|
||||
|
||||
@@ -666,7 +666,7 @@ public class Blocklist {
|
||||
* @param ip IPv4 or IPv6
|
||||
*/
|
||||
public void add(String ip) {
|
||||
byte[] pib = Addresses.getIP(ip);
|
||||
byte[] pib = Addresses.getIPOnly(ip);
|
||||
if (pib == null) return;
|
||||
add(pib, null);
|
||||
}
|
||||
@@ -681,7 +681,7 @@ public class Blocklist {
|
||||
* @since 0.9.57
|
||||
*/
|
||||
public void add(String ip, String source) {
|
||||
byte[] pib = Addresses.getIP(ip);
|
||||
byte[] pib = Addresses.getIPOnly(ip);
|
||||
if (pib == null) return;
|
||||
add(pib, source);
|
||||
}
|
||||
@@ -876,7 +876,7 @@ public class Blocklist {
|
||||
* @param ip IPv4 or IPv6
|
||||
*/
|
||||
public boolean isBlocklisted(String ip) {
|
||||
byte[] pib = Addresses.getIP(ip);
|
||||
byte[] pib = Addresses.getIPOnly(ip);
|
||||
if (pib == null) return false;
|
||||
return isBlocklisted(pib);
|
||||
}
|
||||
|
||||
@@ -559,7 +559,7 @@ public class Analysis extends JobImpl implements RouterApp {
|
||||
String last = _context.getProperty("i2np.lastIP");
|
||||
if (last == null)
|
||||
return;
|
||||
ourIP = Addresses.getIP(last);
|
||||
ourIP = Addresses.getIPOnly(last);
|
||||
if (ourIP == null)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -770,7 +770,7 @@ public class GeoIP {
|
||||
* @param ip IPv4 or IPv6
|
||||
*/
|
||||
public void add(String ip) {
|
||||
byte[] pib = Addresses.getIP(ip);
|
||||
byte[] pib = Addresses.getIPOnly(ip);
|
||||
if (pib == null) return;
|
||||
add(pib);
|
||||
}
|
||||
@@ -812,7 +812,7 @@ public class GeoIP {
|
||||
* @return lower-case code, generally two letters, or null.
|
||||
*/
|
||||
public String get(String ip) {
|
||||
byte[] pib = Addresses.getIP(ip);
|
||||
byte[] pib = Addresses.getIPOnly(ip);
|
||||
if (pib == null) return null;
|
||||
return get(pib);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user