use of net.i2p.router.transport.Transport in project i2p.i2p by i2p.
the class PeerHelper method renderStatusHTML.
/**
* Warning - blocking, very slow, queries the active UPnP router,
* will take many seconds if it has vanished.
*
* @since 0.9.31 moved from TransportManager
*/
private void renderStatusHTML(Writer out, String urlBase, int sortFlags) throws IOException {
if (isAdvanced()) {
out.write("<p id=\"upnpstatus\"><b>");
out.write(_t("Status"));
out.write(": ");
out.write(_t(_context.commSystem().getStatus().toStatusString()));
out.write("</b></p>");
}
SortedMap<String, Transport> transports = _context.commSystem().getTransports();
for (Map.Entry<String, Transport> e : transports.entrySet()) {
String style = e.getKey();
Transport t = e.getValue();
if (style.equals("NTCP")) {
NTCPTransport nt = (NTCPTransport) t;
render(nt, out, urlBase, sortFlags);
} else if (style.equals("SSU")) {
UDPTransport ut = (UDPTransport) t;
render(ut, out, urlBase, sortFlags);
} else {
// pluggable (none yet)
t.renderStatusHTML(out, urlBase, sortFlags);
}
}
if (!transports.isEmpty()) {
out.write(getTransportsLegend());
}
StringBuilder buf = new StringBuilder(4 * 1024);
buf.append("<h3 id=\"transports\">").append(_t("Router Transport Addresses")).append("</h3><pre id=\"transports\">\n");
for (Transport t : transports.values()) {
if (t.hasCurrentAddress()) {
for (RouterAddress ra : t.getCurrentAddresses()) {
buf.append(ra.toString());
buf.append("\n\n");
}
} else {
buf.append(_t("{0} is used for outbound connections only", t.getStyle()));
buf.append("\n\n");
}
}
buf.append("</pre>\n");
out.write(buf.toString());
// UPnP Status
_context.commSystem().renderStatusHTML(_out, _urlBase, _sortFlags);
out.write("</p>\n");
out.flush();
}
Aggregations