GeoIP: Add to CLI

This commit is contained in:
zzz
2020-05-09 19:37:28 +00:00
parent 565e7f4d67
commit ab7e428624
2 changed files with 13 additions and 3 deletions

View File

@ -26,6 +26,7 @@ public class CommandLine extends net.i2p.util.CommandLine {
"net.i2p.router.peermanager.ProfileOrganizer",
"net.i2p.router.tasks.CryptoChecker",
"net.i2p.router.time.NtpClient",
"net.i2p.router.transport.GeoIP",
"net.i2p.router.transport.GeoIPv6",
"net.i2p.router.transport.udp.MTU",
"net.i2p.router.transport.UPnP"

View File

@ -718,9 +718,13 @@ public class GeoIP {
return _codeToName.get(code);
}
/***
public static void main(String args[]) {
if (args.length <= 0) {
System.out.println("Usage: GeoIP ip...");
System.exit(1);
}
GeoIP g = new GeoIP(I2PAppContext.getGlobalContext());
/***
String tests[] = {"0.0.0.0", "0.0.0.1", "0.0.0.2", "0.0.0.255", "1.0.0.0",
"94.3.3.3", "77.1.2.3", "127.0.0.0", "127.127.127.127", "128.0.0.0",
"89.8.9.3", "72.5.6.8", "217.4.9.7", "175.107.027.107", "135.6.5.2",
@ -730,12 +734,17 @@ public class GeoIP {
};
for (int i = 0; i < tests.length; i++)
g.add(tests[i]);
***/
for (int i = 0; i < args.length; i++)
g.add(args[i]);
long start = System.currentTimeMillis();
g.blockingLookup();
System.out.println("Lookup took " + (System.currentTimeMillis() - start));
/***
for (int i = 0; i < tests.length; i++)
System.out.println(tests[i] + " : " + g.get(tests[i]));
}
***/
for (int i = 0; i < args.length; i++)
System.out.println(args[i] + " : " + g.get(args[i]));
}
}