Rename the shitlist and blocklist

This commit is contained in:
zzz
2009-08-08 17:14:30 +00:00
parent d3a0c91398
commit 4cf376ec1d
5 changed files with 18 additions and 18 deletions

View File

@@ -20,22 +20,22 @@ public class ConfigPeerHandler extends FormHandler {
if ("Save Configuration".equals(_action)) { if ("Save Configuration".equals(_action)) {
_context.router().saveConfig(); _context.router().saveConfig();
addFormNotice("Settings saved - not really!!!!!"); addFormNotice("Settings saved - not really!!!!!");
} else if (_action.startsWith("Shitlist")) { } else if (_action.startsWith("Ban")) {
Hash h = getHash(); Hash h = getHash();
if (h != null) { if (h != null) {
_context.shitlist().shitlistRouterForever(h, "Manually shitlisted via <a href=\"configpeer.jsp\">configpeer.jsp</a>"); _context.shitlist().shitlistRouterForever(h, "Manually banned via <a href=\"configpeer.jsp\">configpeer.jsp</a>");
addFormNotice("Peer " + _peer + " shitlisted forever"); addFormNotice("Peer " + _peer + " banned until restart");
return; return;
} }
addFormError("Invalid peer"); addFormError("Invalid peer");
} else if (_action.startsWith("Unshitlist")) { } else if (_action.startsWith("Unban")) {
Hash h = getHash(); Hash h = getHash();
if (h != null) { if (h != null) {
if (_context.shitlist().isShitlisted(h)) { if (_context.shitlist().isShitlisted(h)) {
_context.shitlist().unshitlistRouter(h); _context.shitlist().unshitlistRouter(h);
addFormNotice("Peer " + _peer + " unshitlisted"); addFormNotice("Peer " + _peer + " unbanned");
} else } else
addFormNotice("Peer " + _peer + " is not currently shitlisted"); addFormNotice("Peer " + _peer + " is not currently banned");
return; return;
} }
addFormError("Invalid peer"); addFormError("Invalid peer");

View File

@@ -39,11 +39,11 @@
<h2>Manual Peer Controls</h2> <h2>Manual Peer Controls</h2>
Router Hash: Router Hash:
<input type="text" size="55" name="peer" value="<%=peer%>" /> <input type="text" size="55" name="peer" value="<%=peer%>" />
<h3>Manually Shitlist / Unshitlist a Router</h3> <h3>Manually Ban / Unban a Peer</h3>
Shitlisting will prevent the participation of this peer in tunnels you create. Shitlisting will prevent the participation of this peer in tunnels you create.
<p> <p>
<input type="submit" name="action" value="Shitlist peer until restart" /> <input type="submit" name="action" value="Ban peer until restart" />
<input type="submit" name="action" value="Unshitlist peer" /> <input type="submit" name="action" value="Unban peer" />
<% if (! "".equals(peer)) { %> <% if (! "".equals(peer)) { %>
<font color="blue">&lt;---- click to verify action</font> <font color="blue">&lt;---- click to verify action</font>
<% } %> <% } %>

View File

@@ -111,7 +111,7 @@ public class Blocklist {
} }
for (Iterator iter = _peerBlocklist.keySet().iterator(); iter.hasNext(); ) { for (Iterator iter = _peerBlocklist.keySet().iterator(); iter.hasNext(); ) {
Hash peer = (Hash) iter.next(); Hash peer = (Hash) iter.next();
String reason = "Blocklisted by router hash"; String reason = "Banned by router hash";
String comment = (String) _peerBlocklist.get(peer); String comment = (String) _peerBlocklist.get(peer);
if (comment != null) if (comment != null)
reason = reason + ": " + comment; reason = reason + ": " + comment;
@@ -659,7 +659,7 @@ public class Blocklist {
*/ */
public void shitlist(Hash peer) { public void shitlist(Hash peer) {
// Temporary reason, until the job finishes // Temporary reason, until the job finishes
_context.shitlist().shitlistRouterForever(peer, "IP Blocklisted"); _context.shitlist().shitlistRouterForever(peer, "IP Banned");
if (! "true".equals( _context.getProperty(PROP_BLOCKLIST_DETAIL, "true"))) if (! "true".equals( _context.getProperty(PROP_BLOCKLIST_DETAIL, "true")))
return; return;
boolean shouldRunJob; boolean shouldRunJob;
@@ -682,7 +682,7 @@ public class Blocklist {
super(_context); super(_context);
_peer = p; _peer = p;
} }
public String getName() { return "Shitlist Peer Forever"; } public String getName() { return "Ban Peer by IP"; }
public void runJob() { public void runJob() {
shitlistForever(_peer); shitlistForever(_peer);
synchronized (_inProcess) { synchronized (_inProcess) {
@@ -735,7 +735,7 @@ public class Blocklist {
if (i != 3) if (i != 3)
reason = reason + '.'; reason = reason + '.';
} }
reason = reason + " blocklisted by entry \"" + buf + "\""; reason = reason + " banned by " + BLOCKLIST_FILE_DEFAULT + " entry \"" + buf + "\"";
if (_log.shouldLog(Log.WARN)) if (_log.shouldLog(Log.WARN))
_log.warn("Shitlisting " + peer + " " + reason); _log.warn("Shitlisting " + peer + " " + reason);
_context.shitlist().shitlistRouterForever(peer, reason); _context.shitlist().shitlistRouterForever(peer, reason);
@@ -755,7 +755,7 @@ public class Blocklist {
/** write directly to the stream so we don't OOM on a huge list */ /** write directly to the stream so we don't OOM on a huge list */
public void renderStatusHTML(Writer out) throws IOException { public void renderStatusHTML(Writer out) throws IOException {
out.write("<h2>IP Blocklist</h2>"); out.write("<h2>Banned IPs</h2>");
Set singles = new TreeSet(); Set singles = new TreeSet();
singles.addAll(_singleIPBlocklist); singles.addAll(_singleIPBlocklist);
if (singles.size() > 0) { if (singles.size() > 0) {

View File

@@ -65,7 +65,7 @@ public class Shitlist {
_toUnshitlist = new ArrayList(4); _toUnshitlist = new ArrayList(4);
getTiming().setStartAfter(ctx.clock().now() + SHITLIST_CLEANER_START_DELAY); getTiming().setStartAfter(ctx.clock().now() + SHITLIST_CLEANER_START_DELAY);
} }
public String getName() { return "Cleanup shitlist"; } public String getName() { return "Expire banned peers"; }
public void runJob() { public void runJob() {
_toUnshitlist.clear(); _toUnshitlist.clear();
long now = getContext().clock().now(); long now = getContext().clock().now();
@@ -253,7 +253,7 @@ public class Shitlist {
public void renderStatusHTML(Writer out) throws IOException { public void renderStatusHTML(Writer out) throws IOException {
StringBuilder buf = new StringBuilder(1024); StringBuilder buf = new StringBuilder(1024);
buf.append("<h2>Shitlist</h2>"); buf.append("<h2>Banned Peers</h2>");
Map<Hash, Entry> entries = new TreeMap(new HashComparator()); Map<Hash, Entry> entries = new TreeMap(new HashComparator());
entries.putAll(_entries); entries.putAll(_entries);
@@ -273,7 +273,7 @@ public class Shitlist {
buf.append("<br />\n"); buf.append("<br />\n");
buf.append(entry.cause); buf.append(entry.cause);
} }
buf.append(" (<a href=\"configpeer.jsp?peer=").append(key.toBase64()).append("#unsh\">unshitlist now</a>)"); buf.append(" (<a href=\"configpeer.jsp?peer=").append(key.toBase64()).append("#unsh\">unban now</a>)");
buf.append("</li>\n"); buf.append("</li>\n");
} }
buf.append("</ul>\n"); buf.append("</ul>\n");

View File

@@ -138,7 +138,7 @@ class ProfileOrganizerRenderer {
} }
buf.append("</td><td align=\"right\">").append(num(prof.getIntegrationValue())); buf.append("</td><td align=\"right\">").append(num(prof.getIntegrationValue()));
buf.append("</td><td align=\"center\">"); buf.append("</td><td align=\"center\">");
if (_context.shitlist().isShitlisted(peer)) buf.append("Shitlist"); if (_context.shitlist().isShitlisted(peer)) buf.append("Banned");
if (prof.getIsFailing()) buf.append(" Failing"); if (prof.getIsFailing()) buf.append(" Failing");
if (_context.commSystem().wasUnreachable(peer)) buf.append(" Unreachable"); if (_context.commSystem().wasUnreachable(peer)) buf.append(" Unreachable");
Rate failed = prof.getTunnelHistory().getFailedRate().getRate(30*60*1000); Rate failed = prof.getTunnelHistory().getFailedRate().getRate(30*60*1000);