* config.jsp: Add some reachability help

* configpeer.jsp: Add blocklist info
    * help.jsp: Add link to German FAQ
    * tunnels.jsp: Fix inactive participating count
This commit is contained in:
zzz
2008-09-23 18:48:59 +00:00
parent fbad8a1e8e
commit 52d38e0452
8 changed files with 112 additions and 9 deletions

View File

@@ -631,7 +631,7 @@ public class Blocklist {
}
private String toStr(long entry) {
StringBuffer buf = new StringBuffer(128);
StringBuffer buf = new StringBuffer(32);
for (int i = 7; i >= 0; i--) {
buf.append((entry >> (8*i)) & 0xff);
if (i == 4)
@@ -642,6 +642,16 @@ public class Blocklist {
return buf.toString();
}
private String toStr(int ip) {
StringBuffer buf = new StringBuffer(16);
for (int i = 3; i >= 0; i--) {
buf.append((ip >> (8*i)) & 0xff);
if (i > 0)
buf.append('.');
}
return buf.toString();
}
/**
* We don't keep the comment field in-memory,
* so we have to go back out to the file to find it.
@@ -744,6 +754,40 @@ public class Blocklist {
// We already shitlisted in shitlist(peer), that's good enough
}
public void renderStatusHTML(Writer out) throws IOException {
StringBuffer buf = new StringBuffer(1024);
buf.append("<h2>IP Blocklist</h2>");
Set singles = new TreeSet();
synchronized(_singleIPBlocklist) {
singles.addAll(_singleIPBlocklist);
}
if (singles.size() > 0) {
buf.append("<table><tr><td><b>Transient IPs</b></td></tr>");
for (Iterator iter = singles.iterator(); iter.hasNext(); ) {
int ip = ((Integer) iter.next()).intValue();
buf.append("<tr><td>").append(toStr(ip)).append("</td></tr>\n");
}
buf.append("</table>");
}
if (_blocklistSize > 0) {
buf.append("<table><tr><td align=center colspan=2><b>IPs from Blocklist File</b></td></tr><tr><td align=center><b>From</b></td><td align=center><b>To</b></td></tr>");
for (int i = 0; i < _blocklistSize; i++) {
int from = getFrom(_blocklist[i]);
buf.append("<tr><td align=right>").append(toStr(from)).append("</td><td align=right>");
int to = getTo(_blocklist[i]);
if (to != from)
buf.append(toStr(to)).append("</td></tr>\n");
else
buf.append("&nbsp</td></tr>\n");
}
buf.append("</table>");
} else {
buf.append("<br>No blocklist file entries");
}
out.write(buf.toString());
out.flush();
}
public static void main(String args[]) {
Blocklist b = new Blocklist();
if ( (args != null) && (args.length == 1) )

View File

@@ -17,7 +17,7 @@ import net.i2p.CoreVersion;
public class RouterVersion {
public final static String ID = "$Revision: 1.548 $ $Date: 2008-06-07 23:00:00 $";
public final static String VERSION = "0.6.3";
public final static long BUILD = 8;
public final static long BUILD = 9;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@@ -3,13 +3,12 @@ package net.i2p.router.tunnel.pool;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import net.i2p.data.DataHelper;
import net.i2p.data.Destination;
@@ -447,8 +446,8 @@ public class TunnelPoolManager implements TunnelManagerFacade {
renderPool(out, in, outPool);
}
Set participating = new TreeSet(new TunnelComparator());
participating.addAll(_context.tunnelDispatcher().listParticipatingTunnels());
List participating = _context.tunnelDispatcher().listParticipatingTunnels();
Collections.sort(participating, new TunnelComparator());
out.write("<h2><a name=\"participating\">Participating tunnels</a>:</h2><table border=\"1\">\n");
out.write("<tr><td><b>Receive on</b></td><td><b>From</b></td><td>"
+ "<b>Send on</b></td><td><b>To</b></td><td><b>Expiration</b></td>"
@@ -458,8 +457,8 @@ public class TunnelPoolManager implements TunnelManagerFacade {
if (rs != null)
processed = (long)rs.getRate(10*60*1000).getLifetimeTotalValue();
int inactive = 0;
for (Iterator iter = participating.iterator(); iter.hasNext(); ) {
HopConfig cfg = (HopConfig)iter.next();
for (int i = 0; i < participating.size(); i++) {
HopConfig cfg = (HopConfig)participating.get(i);
if (cfg.getProcessedMessagesCount() <= 0) {
inactive++;
continue;