Compare commits

...

1 Commits

View File

@ -96,6 +96,23 @@ public class LookupDest {
return rv; return rv;
} }
private static boolean deleteHostname(I2PAppContext ctx, String hostname) {
try {
Destination dest = lookupHostname(I2PAppContext.getGlobalContext(), hostname);
if (dest == null)
System.err.println("Destination not found!");
else {
NamingService ns = I2PAppContext.getGlobalContext().namingService();
if (ns != null)
return ns.remove(hostname, dest);
System.err.print("ns is null");
}
} catch (I2PSessionException ise) {
ise.printStackTrace();
}
return false;
}
/** /**
* @since 0.9.40 split out from above * @since 0.9.40 split out from above
*/ */
@ -130,14 +147,22 @@ public class LookupDest {
System.err.println("Usage: LookupDest hostname|b32"); System.err.println("Usage: LookupDest hostname|b32");
System.exit(1); System.exit(1);
} }
try { if (args[0].length() == 1) {
Destination dest = lookupHostname(I2PAppContext.getGlobalContext(), args[0]); try {
if (dest == null) Destination dest = lookupHostname(I2PAppContext.getGlobalContext(), args[0]);
System.err.println("Destination not found!"); if (dest == null)
else System.err.println("Destination not found!");
System.out.println(dest.toBase64()); else
} catch (I2PSessionException ise) { System.out.println(dest.toBase64());
ise.printStackTrace(); } catch (I2PSessionException ise) {
ise.printStackTrace();
}
} }
if (args[0].length() == 2) {
if (args[0] == "-d") {
deleteHostname(I2PAppContext.getGlobalContext(), args[1]);
}
}
} }
} }