2005-10-10 dust

* Implemented a new I2PTunnelIRCClient which locally filters inbound and
      outbound IRC commands for anonymity and security purposes, removing all
      CTCP messages except ACTION, as well as stripping the hostname from the
      USER message (while leaving the nick and 'full name').  The IRC proxy
      doesn't use this by default, but you can enable it by creating a new
      "IRC proxy" tunnel on the web interface, or by changing the tunnel type
      to "ircclient" in i2ptunnel.config.
2005-10-10  jrandom
    * I2PTunnel http client config cleanup and stats
    * Minor SSU congestion tweaks and stats
    * Reduced netDb exploration period
This commit is contained in:
jrandom
2005-10-10 22:58:18 +00:00
committed by zzz
parent d4ff34eacb
commit f30dc2b480
15 changed files with 652 additions and 45 deletions

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.262 $ $Date: 2005/10/09 00:46:57 $";
public final static String ID = "$Revision: 1.263 $ $Date: 2005/10/09 06:35:14 $";
public final static String VERSION = "0.6.1.2";
public final static long BUILD = 3;
public final static long BUILD = 4;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@ -27,8 +27,8 @@ class ExploreJob extends SearchJob {
private Log _log;
private PeerSelector _peerSelector;
/** how long each exploration should run for (currently a trivial 20 seconds) */
private static final long MAX_EXPLORE_TIME = 20*1000;
/** how long each exploration should run for (currently a trivial 10 seconds) */
private static final long MAX_EXPLORE_TIME = 10*1000;
/** how many of the peers closest to the key being explored do we want to explicitly say "dont send me this"? */
private static final int NUM_CLOSEST_TO_IGNORE = 3;

View File

@ -170,8 +170,8 @@ public class PeerState {
* of 608
*/
private static final int DEFAULT_MTU = 608;//600; //1500;
private static final int MIN_RTO = 800 + ACKSender.ACK_FREQUENCY;
private static final int MAX_RTO = 2000; // 5000;
private static final int MIN_RTO = 500 + ACKSender.ACK_FREQUENCY;
private static final int MAX_RTO = 5000; // 5000;
public PeerState(I2PAppContext ctx) {
_context = ctx;
@ -515,7 +515,7 @@ public class PeerState {
//if (true)
// _sendWindowBytes -= 10000;
//else
_sendWindowBytes = _sendWindowBytes/4; //(_sendWindowBytes*2) / 3;
_sendWindowBytes = _sendWindowBytes/2; //(_sendWindowBytes*2) / 3;
if (_sendWindowBytes < MINIMUM_WINDOW_BYTES)
_sendWindowBytes = MINIMUM_WINDOW_BYTES;
//if (congestionAt/2 < _slowStartThreshold)
@ -632,7 +632,7 @@ public class PeerState {
float v = _context.random().nextFloat();
if (v < 0) v = 0-v;
if (v <= prob)
_sendWindowBytes += 512; // bytesACKed;
_sendWindowBytes += bytesACKed; //512; // bytesACKed;
}
}
}
@ -640,7 +640,7 @@ public class PeerState {
_sendWindowBytes = MAX_SEND_WINDOW_BYTES;
_lastReceiveTime = _context.clock().now();
if (false) {
if (true) {
if (_sendWindowBytesRemaining + bytesACKed <= _sendWindowBytes)
_sendWindowBytesRemaining += bytesACKed;
else

View File

@ -890,6 +890,18 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
peers.addAll(_peersByIdent.values());
}
long offsetTotal = 0;
int bpsIn = 0;
int bpsOut = 0;
long uptimeMsTotal = 0;
long cwinTotal = 0;
long rttTotal = 0;
long rtoTotal = 0;
long sendTotal = 0;
long recvTotal = 0;
long resentTotal = 0;
long dupRecvTotal = 0;
int numPeers = 0;
StringBuffer buf = new StringBuffer(512);
buf.append("<b id=\"udpcon\">UDP connections: ").append(peers.size()).append("</b><br />\n");
@ -968,16 +980,22 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
}
buf.append("</code></td>");
long idleIn = (now-peer.getLastReceiveTime())/1000;
long idleOut = (now-peer.getLastSendTime())/1000;
buf.append("<td valign=\"top\" ><code>");
buf.append((now-peer.getLastReceiveTime())/1000);
buf.append(idleIn);
buf.append("s/");
buf.append((now-peer.getLastSendTime())/1000);
buf.append(idleOut);
buf.append("s</code></td>");
int recvBps = (idleIn > 10 ? 0 : peer.getReceiveBps());
int sendBps = (idleOut > 10 ? 0 : peer.getSendBps());
buf.append("<td valign=\"top\" ><code>");
buf.append(formatKBps(peer.getReceiveBps()));
buf.append(formatKBps(recvBps));
buf.append("KBps/");
buf.append(formatKBps(peer.getSendBps()));
buf.append(formatKBps(sendBps));
buf.append("KBps ");
//buf.append(formatKBps(peer.getReceiveACKBps()));
//buf.append("KBps/");
@ -985,8 +1003,10 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
//buf.append("KBps ");
buf.append("</code></td>");
long uptime = now - peer.getKeyEstablishedTime();
buf.append("<td valign=\"top\" ><code>");
buf.append(DataHelper.formatDuration(now-peer.getKeyEstablishedTime()));
buf.append(DataHelper.formatDuration(uptime));
buf.append("</code></td>");
buf.append("<td valign=\"top\" ><code>");
@ -994,16 +1014,21 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
buf.append("s</code></td>");
offsetTotal = offsetTotal + peer.getClockSkew();
long sendWindow = peer.getSendWindowBytes();
buf.append("<td valign=\"top\" ><code>");
buf.append(peer.getSendWindowBytes()/1024);
buf.append(sendWindow/1024);
buf.append("K</code></td>");
buf.append("<td valign=\"top\" ><code>");
buf.append(peer.getSlowStartThreshold()/1024);
buf.append("K</code></td>");
int rtt = peer.getRTT();
int rto = peer.getRTO();
buf.append("<td valign=\"top\" ><code>");
buf.append(peer.getRTT());
buf.append(rtt);
buf.append("</code></td>");
buf.append("<td valign=\"top\" ><code>");
@ -1011,38 +1036,81 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
buf.append("</code></td>");
buf.append("<td valign=\"top\" ><code>");
buf.append(peer.getRTO());
buf.append(rto);
buf.append("</code></td>");
long sent = peer.getPacketsTransmitted();
long recv = peer.getPacketsReceived();
buf.append("<td valign=\"top\" ><code>");
buf.append(sent);
buf.append("</code></td>");
buf.append("<td valign=\"top\" ><code>");
buf.append(peer.getPacketsTransmitted());
buf.append(recv);
buf.append("</code></td>");
buf.append("<td valign=\"top\" ><code>");
buf.append(peer.getPacketsReceived());
buf.append("</code></td>");
//double sent = (double)peer.getPacketsPeriodTransmitted();
//double sendLostPct = 0;
//if (sent > 0)
// sendLostPct = (double)peer.getPacketsRetransmitted()/(sent);
double sent = (double)peer.getPacketsPeriodTransmitted();
double sendLostPct = 0;
if (sent > 0)
sendLostPct = (double)peer.getPacketsRetransmitted()/(sent);
long resent = peer.getPacketsRetransmitted();
long dupRecv = peer.getPacketsReceivedDuplicate();
buf.append("<td valign=\"top\" ><code>");
//buf.append(formatPct(sendLostPct));
buf.append(peer.getPacketsRetransmitted()); // + "/" + peer.getPacketsPeriodRetransmitted() + "/" + sent);
buf.append(resent); // + "/" + peer.getPacketsPeriodRetransmitted() + "/" + sent);
//buf.append(peer.getPacketRetransmissionRate());
buf.append("</code></td>");
double recvDupPct = (double)peer.getPacketsReceivedDuplicate()/(double)peer.getPacketsReceived();
buf.append("<td valign=\"top\" ><code>");
buf.append(peer.getPacketsReceivedDuplicate()); //formatPct(recvDupPct));
buf.append(dupRecv); //formatPct(recvDupPct));
buf.append("</code></td>");
buf.append("</tr>");
out.write(buf.toString());
buf.setLength(0);
bpsIn += recvBps;
bpsOut += sendBps;
uptimeMsTotal += uptime;
cwinTotal += sendWindow;
rttTotal += rtt;
rtoTotal += rto;
sendTotal += sent;
recvTotal += recv;
resentTotal += resent;
dupRecvTotal += dupRecv;
numPeers++;
}
buf.append("<tr><td colspan=\"14\"><hr /></td></tr>\n");
buf.append(" <tr><td colspan=\"2\"><b>Total</b></td>");
buf.append(" <td>");
buf.append(formatKBps(bpsIn)).append("KBps/").append(formatKBps(bpsOut));
buf.append("KBps</td>");
buf.append(" <td>").append(numPeers > 0 ? DataHelper.formatDuration(uptimeMsTotal/numPeers) : "0s");
buf.append("</td><td>&nbsp;</td>\n");
buf.append(" <td>");
buf.append(numPeers > 0 ? cwinTotal/(numPeers*1024) + "K" : "0K");
buf.append("</td><td>&nbsp;</td>\n");
buf.append(" <td>");
buf.append(numPeers > 0 ? rttTotal/numPeers : 0);
buf.append("</td><td>&nbsp;</td><td>");
buf.append(numPeers > 0 ? rtoTotal/numPeers : 0);
buf.append("</td>\n <td>");
buf.append(sendTotal).append("</td><td>").append(recvTotal).append("</td>\n");
buf.append(" <td>").append(resentTotal);
buf.append("</td><td>").append(dupRecvTotal).append("</td>\n");
buf.append(" </tr>\n");
out.write(buf.toString());
buf.setLength(0);
out.write("</table>\n");
buf.append("<b>Average clock skew, UDP peers:");
@ -1278,4 +1346,23 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
}
}
}
private static final String BADIPS[] = new String[] { "192.168.0.1", "127.0.0.1", "10.3.4.5", "172.16.3.4", "224.5.6.7" };
private static final String GOODIPS[] = new String[] { "192.167.0.1", "126.0.0.1", "11.3.4.5", "172.15.3.4", "223.5.6.7" };
public static void main(String args[]) {
for (int i = 0; i < BADIPS.length; i++) {
try {
InetAddress addr = InetAddress.getByName(BADIPS[i]);
boolean routable = isPubliclyRoutable(addr.getAddress());
System.out.println("Routable: " + routable + " (" + BADIPS[i] + ")");
} catch (Exception e) { e.printStackTrace(); }
}
for (int i = 0; i < GOODIPS.length; i++) {
try {
InetAddress addr = InetAddress.getByName(GOODIPS[i]);
boolean routable = isPubliclyRoutable(addr.getAddress());
System.out.println("Routable: " + routable + " (" + GOODIPS[i] + ")");
} catch (Exception e) { e.printStackTrace(); }
}
}
}