Use cached Destinations

Specify min I2P version of 0.9.9 for Destination.create()
This commit is contained in:
zzz
2014-08-09 16:21:02 +00:00
parent ab882f8582
commit f33303f394
2 changed files with 6 additions and 2 deletions

View File

@ -8,3 +8,4 @@ updateURL=http://stats.i2p/i2p/plugins/zzzot-update.xpi2p
websiteURL=http://zzz.i2p/forums/16
license=Apache 2.0
min-jetty-version=7
min-i2p-version=0.9.9

View File

@ -1,4 +1,4 @@
<%@page import="java.util.ArrayList" %><%@page import="java.util.Collections" %><%@page import="java.util.List" %><%@page import="java.util.Map" %><%@page import="java.util.HashMap" %><%@page import="net.i2p.data.Base64" %><%@page import="net.i2p.data.Destination" %><%@page import="net.i2p.zzzot.*" %><%@page import="org.klomp.snark.bencode.BEncoder" %><%
<%@page import="java.io.ByteArrayInputStream,java.util.ArrayList,java.util.Collections,java.util.List,java.util.Map,java.util.HashMap,net.i2p.data.Base64,net.i2p.data.Destination,net.i2p.zzzot.*,org.klomp.snark.bencode.BEncoder" %><%
/*
* Above one-liner is so there is no whitespace -> IllegalStateException
@ -94,7 +94,10 @@
try {
if (ip.endsWith(".i2p"))
ip = ip.substring(0, ip.length() - 4);
d = new Destination(ip); // from b64 string
byte[] b = Base64.decode(ip);
if (b == null)
throw new Exception();
d = Destination.create(new ByteArrayInputStream(b)); // cache
} catch (Exception e) {
fail = true;
msg = "bad dest " + e;