forked from I2P_Developers/i2p.i2p
/debug:
- Add container divs and styling markup - Add top navigation menu
This commit is contained in:
@@ -15,15 +15,39 @@
|
||||
<%@include file="summary.jsi" %>
|
||||
<h1>Router Debug</h1>
|
||||
<div class="main" id="debug">
|
||||
|
||||
<div class="confignav">
|
||||
<span class="tab"><a href="#debug_portmapper">Port Mapper</a></span>
|
||||
<span class="tab"><a href="#appmanager">App Manager</a></span>
|
||||
<span class="tab"><a href="#updatemanager">Update Manager</a></span>
|
||||
<span class="tab"><a href="#skm">Session Key Manager</a></span>
|
||||
<span class="tab"><a href="#dht">Router DHT</a></span>
|
||||
</div>
|
||||
|
||||
<%
|
||||
/*
|
||||
* Quick and easy place to put debugging stuff
|
||||
*/
|
||||
net.i2p.router.RouterContext ctx = (net.i2p.router.RouterContext) net.i2p.I2PAppContext.getGlobalContext();
|
||||
|
||||
/*
|
||||
* Print out the status for the PortMapper
|
||||
*/
|
||||
ctx.portMapper().renderStatusHTML(out);
|
||||
|
||||
/*
|
||||
* Print out the status for the AppManager
|
||||
*/
|
||||
|
||||
out.print("<div class=\"debug_section\" id=\"appmanager\">");
|
||||
ctx.routerAppManager().renderStatusHTML(out);
|
||||
out.print("</div>");
|
||||
|
||||
|
||||
/*
|
||||
* Print out the status for the UpdateManager
|
||||
*/
|
||||
out.print("<div class=\"debug_section\" id=\"updatemanager\">");
|
||||
net.i2p.app.ClientAppManager cmgr = ctx.clientAppManager();
|
||||
if (cmgr != null) {
|
||||
net.i2p.router.update.ConsoleUpdateManager umgr =
|
||||
@@ -31,37 +55,32 @@
|
||||
if (umgr != null) {
|
||||
umgr.renderStatusHTML(out);
|
||||
}
|
||||
out.print("</div>");
|
||||
}
|
||||
|
||||
/*
|
||||
* Print out the status for the AppManager
|
||||
*/
|
||||
ctx.routerAppManager().renderStatusHTML(out);
|
||||
|
||||
/*
|
||||
* Print out the status for the PortMapper
|
||||
*/
|
||||
ctx.portMapper().renderStatusHTML(out);
|
||||
|
||||
/*
|
||||
* Print out the status for all the SessionKeyManagers
|
||||
*/
|
||||
out.print("<h2>Router SKM</h2>");
|
||||
out.print("<div class=\"debug_section\" id=\"skm\">");
|
||||
out.print("<h2>Router Session Key Manager</h2>");
|
||||
ctx.sessionKeyManager().renderStatusHTML(out);
|
||||
java.util.Set<net.i2p.data.Destination> clients = ctx.clientManager().listClients();
|
||||
out.print("</div>");
|
||||
for (net.i2p.data.Destination dest : clients) {
|
||||
net.i2p.data.Hash h = dest.calculateHash();
|
||||
net.i2p.crypto.SessionKeyManager skm = ctx.clientManager().getClientSessionKeyManager(h);
|
||||
if (skm != null) {
|
||||
out.print("<h2>" + h.toBase64().substring(0,6) + " SKM</h2>");
|
||||
out.print("<div class=\"debug_section\">");
|
||||
out.print("<h2>" + h.toBase64().substring(0,6) + " Session Key Manager</h2>");
|
||||
skm.renderStatusHTML(out);
|
||||
out.print("</div>");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Print out the status for the NetDB
|
||||
*/
|
||||
out.print("<h2>Router DHT</h2>");
|
||||
out.print("<h2 id=\"dht\">Router DHT</h2>");
|
||||
ctx.netDb().renderStatusHTML(out);
|
||||
|
||||
%>
|
||||
|
@@ -730,13 +730,13 @@ public class KBucketSet<T extends SimpleDataStructure> {
|
||||
public void getEntries(SelectionCollector<T> collector) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
public void clear() {}
|
||||
|
||||
public boolean add(T peer) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
public boolean remove(T peer) {
|
||||
return false;
|
||||
}
|
||||
@@ -765,6 +765,7 @@ public class KBucketSet<T extends SimpleDataStructure> {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder(1024);
|
||||
buf.append("<div class=\"debug_container buckets\">");
|
||||
buf.append("<hr><b>Bucket set rooted on:</b> ").append(_us.toString())
|
||||
.append(" K=").append(BUCKET_SIZE)
|
||||
.append(" B=").append(B_VALUE)
|
||||
@@ -779,6 +780,7 @@ public class KBucketSet<T extends SimpleDataStructure> {
|
||||
buf.append(b.toString()).append("<br>\n");
|
||||
}
|
||||
} finally { releaseReadLock(); }
|
||||
buf.append("</div>");
|
||||
return buf.toString();
|
||||
}
|
||||
}
|
||||
|
@@ -179,7 +179,7 @@ public class PortMapper {
|
||||
*/
|
||||
public void renderStatusHTML(Writer out) throws IOException {
|
||||
List<String> services = new ArrayList<String>(_dir.keySet());
|
||||
out.write("<h2>Port Mapper</h2><table><tr><th>Service<th>Host<th>Port\n");
|
||||
out.write("<h2 id=\"debug_portmapper\">Port Mapper</h2><table id=\"portmapper\"><tr><th>Service<th>Host<th>Port\n");
|
||||
Collections.sort(services);
|
||||
for (String s : services) {
|
||||
InetSocketAddress ia = _dir.get(s);
|
||||
|
@@ -1,4 +1,8 @@
|
||||
2017-07-26 str4d
|
||||
* Console:
|
||||
- /debug:
|
||||
- Add container divs and styling markup
|
||||
- Add top navigation menu
|
||||
* I2PSnark:
|
||||
- Mitigate truncation of ratings dropdown in comments section (translations)
|
||||
- light: Reduce contrast of display text
|
||||
|
@@ -89,7 +89,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
private final int _tagsToSend;
|
||||
private final int _lowThreshold;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Let outbound session tags sit around for this long before expiring them.
|
||||
* Inbound tag expiration is set by SESSION_LIFETIME_MAX_MS
|
||||
*/
|
||||
@@ -155,7 +155,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
/** ditto */
|
||||
public static final int LOW_THRESHOLD = 30;
|
||||
|
||||
/**
|
||||
/**
|
||||
* The session key manager should only be constructed and accessed through the
|
||||
* application context. This constructor should only be used by the
|
||||
* appropriate application context itself.
|
||||
@@ -165,7 +165,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
this(context, DEFAULT_TAGS, LOW_THRESHOLD);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @param tagsToSend how many to send at a time, may be lower or higher than lowThreshold. 1-128
|
||||
* @param lowThreshold below this, send more. 1-128
|
||||
* @since 0.9.2
|
||||
@@ -185,7 +185,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
_alive = true;
|
||||
_context.simpleTimer2().addEvent(new CleanupEvent(), 60*1000);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
_alive = false;
|
||||
@@ -408,7 +408,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
else
|
||||
return end - _context.clock().now();
|
||||
}
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -559,7 +559,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
_log.warn("Current tag set creation: " + tagSet + ": key=" + tagSet.getAssociatedKey());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int overage = _inboundTagSets.size() - MAX_INBOUND_SESSION_TAGS;
|
||||
if (overage > 0)
|
||||
clearExcess(overage);
|
||||
@@ -568,7 +568,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
// _log.debug("Received 0 tags for key " + key);
|
||||
//if (false) aggressiveExpire();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* remove a bunch of arbitrarily selected tags, then drop all of
|
||||
* the associated tag sets. this is very time consuming - iterating
|
||||
@@ -616,7 +616,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
_log.logAlways(Log.WARN, "TOO MANY SESSION TAGS! removed " + removed.size()
|
||||
_log.logAlways(Log.WARN, "TOO MANY SESSION TAGS! removed " + removed.size()
|
||||
+ " tag sets arbitrarily, with " + tags + " tags,"
|
||||
+ "where there are " + old + " long lasting sessions, "
|
||||
+ recent + " ones created in the last few minutes, and "
|
||||
@@ -719,7 +719,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
@Override
|
||||
public void renderStatusHTML(Writer out) throws IOException {
|
||||
StringBuilder buf = new StringBuilder(1024);
|
||||
buf.append("<h2>Inbound sessions</h2>" +
|
||||
buf.append("<h3 class=\"debug_inboundsessions\">Inbound sessions</h3>" +
|
||||
"<table>");
|
||||
Set<TagSet> inbound = getInboundTagSets();
|
||||
Map<SessionKey, Set<TagSet>> inboundSets = new HashMap<SessionKey, Set<TagSet>>(inbound.size());
|
||||
@@ -738,18 +738,18 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
SessionKey skey = e.getKey();
|
||||
Set<TagSet> sets = new TreeSet<TagSet>(new TagSetComparator());
|
||||
sets.addAll(e.getValue());
|
||||
buf.append("<tr><td><b>Session key</b>: ").append(skey.toBase64()).append("</td>" +
|
||||
buf.append("<tr><td><b>Session key:</b> ").append(skey.toBase64()).append("</td>" +
|
||||
"<td><b># Sets:</b> ").append(sets.size()).append("</td></tr>" +
|
||||
"<tr><td colspan=\"2\"><ul>");
|
||||
"<tr class=\"expiry\"><td colspan=\"2\"><ul>");
|
||||
for (TagSet ts : sets) {
|
||||
int size = ts.getTags().size();
|
||||
total += size;
|
||||
buf.append("<li><b>ID: ").append(ts.getID());
|
||||
long expires = ts.getDate() - now;
|
||||
if (expires > 0)
|
||||
buf.append(" Expires in:</b> ").append(DataHelper.formatDuration2(expires)).append(" with ");
|
||||
buf.append(" expires in:</b> ").append(DataHelper.formatDuration2(expires)).append(" with ");
|
||||
else
|
||||
buf.append(" Expired:</b> ").append(DataHelper.formatDuration2(0 - expires)).append(" ago with ");
|
||||
buf.append(" expired:</b> ").append(DataHelper.formatDuration2(0 - expires)).append(" ago with ");
|
||||
buf.append(size).append('/').append(ts.getOriginalSize()).append(" tags remaining</li>");
|
||||
}
|
||||
buf.append("</ul></td></tr>\n");
|
||||
@@ -759,7 +759,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
buf.append("<tr><th colspan=\"2\">Total tags: ").append(total).append(" (");
|
||||
buf.append(DataHelper.formatSize2(32*total)).append("B)</th></tr>\n" +
|
||||
"</table>" +
|
||||
"<h2><b>Outbound sessions</b></h2>" +
|
||||
"<h3 class=\"debug_outboundsessions\">Outbound sessions</h3>" +
|
||||
"<table>");
|
||||
total = 0;
|
||||
Set<OutboundSession> outbound = getOutboundSessions();
|
||||
@@ -767,11 +767,11 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
OutboundSession sess = iter.next();
|
||||
Set<TagSet> sets = new TreeSet<TagSet>(new TagSetComparator());
|
||||
sets.addAll(sess.getTagSets());
|
||||
buf.append("<tr><td><b>Target public key:</b> ").append(toString(sess.getTarget())).append("<br>" +
|
||||
buf.append("<tr class=\"debug_outboundtarget\"><td><div class=\"debug_targetinfo\"><b>Target public key:</b> ").append(toString(sess.getTarget())).append("<br>" +
|
||||
"<b>Established:</b> ").append(DataHelper.formatDuration2(now - sess.getEstablishedDate())).append(" ago<br>" +
|
||||
"<b>Ack Received?</b> ").append(sess.getAckReceived()).append("<br>" +
|
||||
"<b>Last Used:</b> ").append(DataHelper.formatDuration2(now - sess.getLastUsedDate())).append(" ago<br>" +
|
||||
"<b>Session key:</b> ").append(sess.getCurrentKey().toBase64()).append("</td>" +
|
||||
"<b>Session key:</b> ").append(sess.getCurrentKey().toBase64()).append("</div></td>" +
|
||||
"<td><b># Sets:</b> ").append(sess.getTagSets().size()).append("</td></tr>" +
|
||||
"<tr><td colspan=\"2\"><ul>");
|
||||
for (Iterator<TagSet> siter = sets.iterator(); siter.hasNext();) {
|
||||
@@ -1162,7 +1162,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
iter.remove();
|
||||
return first;
|
||||
}
|
||||
|
||||
|
||||
//public Exception getCreatedBy() { return _createdBy; }
|
||||
|
||||
/**
|
||||
@@ -1174,7 +1174,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
* For outbound only.
|
||||
*/
|
||||
public boolean getAcked() { return _acked; }
|
||||
|
||||
|
||||
/****** this will return a dup if two in the same ms, so just use java
|
||||
@Override
|
||||
public int hashCode() {
|
||||
@@ -1184,12 +1184,12 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
// no need to hashCode the tags, key + date should be enough
|
||||
return (int) rv;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if ((o == null) || !(o instanceof TagSet)) return false;
|
||||
TagSet ts = (TagSet) o;
|
||||
return DataHelper.eq(ts.getAssociatedKey(), _key)
|
||||
return DataHelper.eq(ts.getAssociatedKey(), _key)
|
||||
//&& DataHelper.eq(ts.getTags(), getTags())
|
||||
&& ts.getDate() == _date;
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ import net.i2p.util.Log;
|
||||
* @since 0.9.4
|
||||
*/
|
||||
public class RouterAppManager extends ClientAppManagerImpl {
|
||||
|
||||
|
||||
private final RouterContext _context;
|
||||
private final Log _log;
|
||||
// client to args
|
||||
@@ -127,7 +127,7 @@ public class RouterAppManager extends ClientAppManagerImpl {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register with the manager under the given name,
|
||||
* so that other clients may find it.
|
||||
@@ -150,7 +150,7 @@ public class RouterAppManager extends ClientAppManagerImpl {
|
||||
// TODO if old app in there is not running and != this app, allow replacement
|
||||
return super.register(app);
|
||||
}
|
||||
|
||||
|
||||
/// end ClientAppManager interface
|
||||
|
||||
/**
|
||||
@@ -187,9 +187,13 @@ public class RouterAppManager extends ClientAppManagerImpl {
|
||||
StringBuilder buf = new StringBuilder(1024);
|
||||
buf.append("<h2>App Manager</h2>");
|
||||
buf.append("<h3>Tracked</h3>");
|
||||
buf.append("<div class=\"debug_container\">");
|
||||
toString1(buf);
|
||||
buf.append("</div>");
|
||||
buf.append("<h3>Registered</h3>");
|
||||
buf.append("<div class=\"debug_container\">");
|
||||
toString2(buf);
|
||||
buf.append("</div>");
|
||||
out.write(buf.toString());
|
||||
}
|
||||
|
||||
@@ -202,7 +206,7 @@ public class RouterAppManager extends ClientAppManagerImpl {
|
||||
for (Map.Entry<ClientApp, String[]> entry : _clients.entrySet()) {
|
||||
ClientApp key = entry.getKey();
|
||||
String[] val = entry.getValue();
|
||||
list.add("[" + key.getName() + "] = [" + key.getClass().getName() + ' ' + Arrays.toString(val) + "] " + key.getState() + "<br>");
|
||||
list.add("[<b>" + key.getName() + "</b>] = [" + key.getClass().getName() + ' ' + Arrays.toString(val) + "] <i>" + key.getState() + "</i><br>");
|
||||
}
|
||||
Collections.sort(list);
|
||||
for (String e : list) {
|
||||
@@ -219,7 +223,7 @@ public class RouterAppManager extends ClientAppManagerImpl {
|
||||
for (Map.Entry<String, ClientApp> entry : _registered.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
ClientApp val = entry.getValue();
|
||||
list.add("[" + key + "] = [" + val.getClass().getName() + "]<br>");
|
||||
list.add("[<b>" + key + "</b>] = [" + val.getClass().getName() + "]<br>");
|
||||
}
|
||||
Collections.sort(list);
|
||||
for (String e : list) {
|
||||
|
Reference in New Issue
Block a user