I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit d97908b4 authored by zzz's avatar zzz
Browse files

SusiDNS: Add support for multiple dests per hostname

parent 2fb8faa1
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,8 @@ package i2p.susi.dns; ...@@ -24,6 +24,8 @@ package i2p.susi.dns;
import java.io.IOException; import java.io.IOException;
import java.io.Writer; import java.io.Writer;
import java.util.Arrays; import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
...@@ -356,6 +358,34 @@ public class NamingServiceBean extends AddressbookBean ...@@ -356,6 +358,34 @@ public class NamingServiceBean extends AddressbookBean
return rv; return rv;
} }
/**
* @since 0.9.26
*/
public List<AddressBean> getLookupAll() {
if (this.detail == null)
return null;
if (isDirect()) {
// won't work for the published addressbook
AddressBean ab = getLookup();
if (ab != null)
return Collections.singletonList(ab);
return null;
}
Properties nsOptions = new Properties();
List<Properties> propsList = new ArrayList<Properties>(4);
nsOptions.setProperty("list", getFileName());
List<Destination> dests = getNamingService().lookupAll(this.detail, nsOptions, propsList);
if (dests == null)
return null;
List<AddressBean> rv = new ArrayList<AddressBean>(dests.size());
for (int i = 0; i < dests.size(); i++) {
AddressBean ab = new AddressBean(this.detail, dests.get(i).toBase64());
ab.setProperties(propsList.get(i));
rv.add(ab);
}
return rv;
}
/** /**
* @since 0.9.20 * @since 0.9.20
*/ */
......
...@@ -76,11 +76,12 @@ ...@@ -76,11 +76,12 @@
%><p>No host specified</p><% %><p>No host specified</p><%
} else { } else {
detail = net.i2p.data.DataHelper.stripHTML(detail); detail = net.i2p.data.DataHelper.stripHTML(detail);
i2p.susi.dns.AddressBean addr = book.getLookup(); java.util.List<i2p.susi.dns.AddressBean> addrs = book.getLookupAll();
if (addr == null) { if (addrs == null) {
%><p>Not found: <%=detail%></p><% %><p>Not found: <%=detail%></p><%
} else { } else {
String b32 = addr.getB32(); for (i2p.susi.dns.AddressBean addr : addrs) {
String b32 = addr.getB32();
%> %>
<jsp:setProperty name="book" property="trClass" value="0" /> <jsp:setProperty name="book" property="trClass" value="0" />
<table class="book" cellspacing="0" cellpadding="5"> <table class="book" cellspacing="0" cellpadding="5">
...@@ -146,13 +147,17 @@ ...@@ -146,13 +147,17 @@
<img src="/imagegen/id?s=320&amp;c=<%=addr.getB64().replace("=", "%3d")%>" width="320" height="320"> <img src="/imagegen/id?s=320&amp;c=<%=addr.getB64().replace("=", "%3d")%>" width="320" height="320">
</td><td> </td><td>
<img src="/imagegen/qr?s=320&amp;t=<%=addr.getName()%>&amp;c=http%3a%2f%2f<%=addr.getName()%>%2f%3fi2paddresshelper%3d<%=addr.getDestination()%>"> <img src="/imagegen/qr?s=320&amp;t=<%=addr.getName()%>&amp;c=http%3a%2f%2f<%=addr.getName()%>%2f%3fi2paddresshelper%3d<%=addr.getDestination()%>">
</td></tr></table></div> </td></tr></table>
<hr>
<% <%
} // addr == null } // foreach addr
%>
</div>
<%
} // addrs == null
} // detail == null } // detail == null
%> %>
<div id="footer"> <div id="footer">
<hr>
<p class="footer">susidns v${version.version} &copy; <a href="${version.url}" target="_top">susi</a> 2005</p> <p class="footer">susidns v${version.version} &copy; <a href="${version.url}" target="_top">susi</a> 2005</p>
</div> </div>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment