From df6c52fe751415f608d961737ad0a4846c90d806 Mon Sep 17 00:00:00 2001 From: jrandom <jrandom> Date: Mon, 7 Mar 2005 00:07:27 +0000 Subject: [PATCH] * 2005-03-06 0.5.0.2 released 2005-03-06 jrandom * Allow the I2PTunnel web interface to select streaming lib options for individual client tunnels, rather than sharing them across all of them, as we do with the session options. This way people can (and should) set the irc proxy to interactive and the eepproxy to bulk. * Added a startRouter.sh script to new installs which simply calls "sh i2prouter start". This should make it clear how people should start I2P. --- .../net/i2p/i2ptunnel/I2PTunnelRunner.java | 2 +- .../i2ptunnel/WebEditPageFormGenerator.java | 84 +++++++++++-------- .../net/i2p/i2ptunnel/WebEditPageHelper.java | 5 ++ build.xml | 1 + core/java/src/net/i2p/CoreVersion.java | 4 +- history.txt | 15 +++- installer/resources/postinstall.bat | 2 + installer/resources/postinstall.sh | 1 + installer/resources/startRouter.sh | 2 + .../src/net/i2p/router/MessageValidator.java | 4 + .../src/net/i2p/router/RouterVersion.java | 6 +- .../src/net/i2p/router/StatisticsManager.java | 3 +- 12 files changed, 86 insertions(+), 43 deletions(-) create mode 100644 installer/resources/startRouter.sh diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelRunner.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelRunner.java index 6f906a1386..c26eccf47b 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelRunner.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelRunner.java @@ -283,6 +283,7 @@ public class I2PTunnelRunner extends I2PThread implements I2PSocket.SocketErrorL //else // _log.warn("You may ignore this", ex); } finally { + _cache.release(ba); if (_log.shouldLog(Log.INFO)) { _log.info(direction + ": done forwarding between " + from + " and " + to); @@ -304,7 +305,6 @@ public class I2PTunnelRunner extends I2PThread implements I2PSocket.SocketErrorL finishLock.notifyAll(); // the main thread will close sockets etc. now } - _cache.release(ba); } } } diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/WebEditPageFormGenerator.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/WebEditPageFormGenerator.java index dd6a1db4ce..3fcf9312d6 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/WebEditPageFormGenerator.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/WebEditPageFormGenerator.java @@ -61,6 +61,8 @@ class WebEditPageFormGenerator { buf.append("value=\"squid.i2p\" "); buf.append("/><br />\n"); + addStreamingOptions(buf, controller); + buf.append("<hr />Note: the following options are shared across all client tunnels and"); buf.append(" HTTP proxies<br />\n"); @@ -84,6 +86,8 @@ class WebEditPageFormGenerator { buf.append("value=\"").append(controller.getTargetDestination()).append("\" "); buf.append(" /> (either the hosts.txt name or the full base64 destination)<br />\n"); + addStreamingOptions(buf, controller); + buf.append("<hr />Note: the following options are shared across all client tunnels and"); buf.append(" HTTP proxies<br />\n"); @@ -122,6 +126,8 @@ class WebEditPageFormGenerator { buf.append("<input type=\"hidden\" name=\"privKeyGenerate\" value=\"true\" />"); } + addStreamingOptions(buf, controller); + addOptions(buf, controller); buf.append("<input type=\"submit\" name=\"action\" value=\"Save\">\n"); buf.append("<input type=\"submit\" name=\"action\" value=\"Remove\">\n"); @@ -164,6 +170,8 @@ class WebEditPageFormGenerator { buf.append("<input type=\"hidden\" name=\"privKeyGenerate\" value=\"true\" />"); } + addStreamingOptions(buf, controller); + addOptions(buf, controller); buf.append("<input type=\"submit\" name=\"action\" value=\"Save\">\n"); buf.append("<input type=\"submit\" name=\"action\" value=\"Remove\">\n"); @@ -204,8 +212,9 @@ class WebEditPageFormGenerator { buf.append(" checked=\"true\" />\n<br />\n"); else buf.append(" />\n<br />\n"); + } - + /** * Generate the fields asking for what port and interface the tunnel should * listen on. @@ -243,6 +252,46 @@ class WebEditPageFormGenerator { buf.append("\"><br />\n"); } + private static void addStreamingOptions(StringBuffer buf, TunnelController controller) { + int connectDelay = 0; + int maxWindowSize = -1; + + Properties opts = getOptions(controller); + if (opts != null) { + String delay = opts.getProperty("i2p.streaming.connectDelay"); + if (delay != null) { + try { + connectDelay = Integer.parseInt(delay); + } catch (NumberFormatException nfe) { + connectDelay = 0; + } + } + String max = opts.getProperty("i2p.streaming.maxWindowSize"); + if (max != null) { + try { + maxWindowSize = Integer.parseInt(max); + } catch (NumberFormatException nfe) { + maxWindowSize = -1; + } + } + } + + buf.append("<b>Delay connection briefly? </b> "); + buf.append("<input type=\"checkbox\" name=\"connectDelay\" value=\""); + buf.append((connectDelay > 0 ? connectDelay : 1000)).append("\" "); + if (connectDelay > 0) + buf.append("checked=\"true\" "); + buf.append("/> (useful for brief request/response connections)<br />\n"); + + buf.append("<b>Communication profile:</b>"); + buf.append("<select name=\"profile\">"); + if (maxWindowSize <= 0) + buf.append("<option value=\"interactive\">Interactive</option><option value=\"bulk\" selected=\"true\">Bulk</option>"); + else + buf.append("<option value=\"interactive\" selected=\"true\">Interactive</option><option value=\"bulk\">Bulk</option>"); + buf.append("</select><br />\n"); + } + /** * Add fields for customizing the I2PSession options, including helpers for * tunnel depth and count, as well as I2CP host and port. @@ -253,8 +302,6 @@ class WebEditPageFormGenerator { private static void addOptions(StringBuffer buf, TunnelController controller) { int tunnelDepth = 2; int numTunnels = 2; - int connectDelay = 0; - int maxWindowSize = -1; Properties opts = getOptions(controller); if (opts != null) { String depth = opts.getProperty("inbound.length"); @@ -273,22 +320,6 @@ class WebEditPageFormGenerator { numTunnels = 2; } } - String delay = opts.getProperty("i2p.streaming.connectDelay"); - if (delay != null) { - try { - connectDelay = Integer.parseInt(delay); - } catch (NumberFormatException nfe) { - connectDelay = 0; - } - } - String max = opts.getProperty("i2p.streaming.maxWindowSize"); - if (max != null) { - try { - maxWindowSize = Integer.parseInt(max); - } catch (NumberFormatException nfe) { - maxWindowSize = -1; - } - } } buf.append("<b>Tunnel depth:</b> "); @@ -328,21 +359,6 @@ class WebEditPageFormGenerator { } buf.append("</select><br />\n"); - buf.append("<b>Delay connection briefly? </b> "); - buf.append("<input type=\"checkbox\" name=\"connectDelay\" value=\""); - buf.append((connectDelay > 0 ? connectDelay : 1000)).append("\" "); - if (connectDelay > 0) - buf.append("checked=\"true\" "); - buf.append("/> (useful for brief request/response connections)<br />\n"); - - buf.append("<b>Communication profile:</b>"); - buf.append("<select name=\"profile\">"); - if (maxWindowSize <= 0) - buf.append("<option value=\"interactive\">Interactive</option><option value=\"bulk\" selected=\"true\">Bulk</option>"); - else - buf.append("<option value=\"interactive\" selected=\"true\">Interactive</option><option value=\"bulk\">Bulk</option>"); - buf.append("</select><br />\n"); - buf.append("<b>I2CP host:</b> "); buf.append("<input type=\"text\" name=\"clientHost\" size=\"20\" value=\""); if ( (controller != null) && (controller.getI2CPHost() != null) ) diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/WebEditPageHelper.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/WebEditPageHelper.java index a1b829e780..3f42c682d5 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/WebEditPageHelper.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/WebEditPageHelper.java @@ -296,6 +296,10 @@ public class WebEditPageHelper { cOpt.setProperty("option.inbound.length", _tunnelDepth); cOpt.setProperty("option.outbound.length", _tunnelDepth); } + // these are per-proxy settings, not per-session settings, and + // as such don't need to be shared. the values are propogated + // to the current tunnel's settings via cur.setConfig above + /* if (_connectDelay) cOpt.setProperty("option.i2p.streaming.connectDelay", "1000"); else @@ -304,6 +308,7 @@ public class WebEditPageHelper { cOpt.setProperty("option.i2p.streaming.maxWindowSize", "1"); else cOpt.remove("option.i2p.streaming.maxWindowSize"); + */ if (_name != null) { cOpt.setProperty("option.inbound.nickname", _name); cOpt.setProperty("option.outbound.nickname", _name); diff --git a/build.xml b/build.xml index 6700cf019d..5a1370490d 100644 --- a/build.xml +++ b/build.xml @@ -193,6 +193,7 @@ <copy file="installer/resources/osid" todir="pkg-temp/" /> <copy file="installer/resources/postinstall.bat" todir="pkg-temp/" /> <copy file="installer/resources/postinstall.sh" todir="pkg-temp/" /> + <copy file="installer/resources/startRouter.sh" todir="pkg-temp/" /> <copy file="installer/resources/systray.config" todir="pkg-temp/" /> <!-- <copy file="installer/resources/uninstall_i2p_service_unix" todir="pkg-temp/" /> --> <copy file="installer/resources/uninstall_i2p_service_winnt.bat" todir="pkg-temp/" /> diff --git a/core/java/src/net/i2p/CoreVersion.java b/core/java/src/net/i2p/CoreVersion.java index 2932641eb1..e5ee1813df 100644 --- a/core/java/src/net/i2p/CoreVersion.java +++ b/core/java/src/net/i2p/CoreVersion.java @@ -14,8 +14,8 @@ package net.i2p; * */ public class CoreVersion { - public final static String ID = "$Revision: 1.28 $ $Date: 2005/02/17 17:57:53 $"; - public final static String VERSION = "0.5.0.1"; + public final static String ID = "$Revision: 1.29 $ $Date: 2005/02/23 00:00:52 $"; + public final static String VERSION = "0.5.0.2"; public static void main(String args[]) { System.out.println("I2P Core version: " + VERSION); diff --git a/history.txt b/history.txt index 564b1d6539..31aa298a5d 100644 --- a/history.txt +++ b/history.txt @@ -1,11 +1,22 @@ -$Id: history.txt,v 1.163 2005/03/04 01:09:51 jrandom Exp $ +$Id: history.txt,v 1.164 2005/03/04 21:54:42 jrandom Exp $ + +* 2005-03-06 0.5.0.2 released + +2005-03-06 jrandom + * Allow the I2PTunnel web interface to select streaming lib options for + individual client tunnels, rather than sharing them across all of them, + as we do with the session options. This way people can (and should) set + the irc proxy to interactive and the eepproxy to bulk. + * Added a startRouter.sh script to new installs which simply calls + "sh i2prouter start". This should make it clear how people should start + I2P. 2005-03-04 jrandom * Filter HTTP response headers in the eepproxy, forcing Connection: close so that broken (/malicious) webservers can't allow persistent connections. All HTTP compliant browsers should now always close the socket. - * Enabled the GZIPInputStream's cache (they were'nt cached before) + * Enabled the GZIPInputStream's cache (they weren't cached before) * Make sure our first send is always a SYN (duh) * Workaround for some buggy compilers diff --git a/installer/resources/postinstall.bat b/installer/resources/postinstall.bat index 0b896025c6..d1ce099df1 100644 --- a/installer/resources/postinstall.bat +++ b/installer/resources/postinstall.bat @@ -30,6 +30,7 @@ del /f /q "%INSTALL_PATH%i2prouter" del /f /q "%INSTALL_PATH%install-headless.txt" del /f /q "%INSTALL_PATH%osid" del /f /q "%INSTALL_PATH%postinstall.sh" +del /f /q "%INSTALL_PATH%startRouter.sh" :: del /f /q "%INSTALL_PATH%uninstall_i2p_service_unix" del /f /q "%INSTALL_PATH%icons\*.xpm" rmdir /q /s "%INSTALL_PATH%lib\wrapper" @@ -43,6 +44,7 @@ del "%INSTALL_PATH%install_i2p_service_winnt.bat" del "%INSTALL_PATH%install-headless.txt" del "%INSTALL_PATH%osid" del "%INSTALL_PATH%postinstall.sh" +del "%INSTALL_PATH%startRouter.sh" :: del "%INSTALL_PATH%uninstall_i2p_service_unix" del "%INSTALL_PATH%uninstall_i2p_service_winnt.bat" del "%INSTALL_PATH%icons\*.xpm" diff --git a/installer/resources/postinstall.sh b/installer/resources/postinstall.sh index 2bb32b2302..35ff2fd6e5 100644 --- a/installer/resources/postinstall.sh +++ b/installer/resources/postinstall.sh @@ -19,6 +19,7 @@ fi chmod 744 ./i2prouter # chmod 744 ./install_i2p_service_unix chmod 744 ./osid +chmod 744 ./startRouter.sh # chmod 744 ./uninstall_i2p_service_unix ERROR_MSG="Cannot determine operating system type. From the subdirectory in lib/wrapper matching your operating system, please move i2psvc to your base I2P directory, and move the remaining two files to the lib directory." diff --git a/installer/resources/startRouter.sh b/installer/resources/startRouter.sh new file mode 100644 index 0000000000..f5de1d125a --- /dev/null +++ b/installer/resources/startRouter.sh @@ -0,0 +1,2 @@ +# overly redundant, yet perhaps helpful for new users +sh i2prouter start \ No newline at end of file diff --git a/router/java/src/net/i2p/router/MessageValidator.java b/router/java/src/net/i2p/router/MessageValidator.java index 18713f9469..e12417c2d8 100644 --- a/router/java/src/net/i2p/router/MessageValidator.java +++ b/router/java/src/net/i2p/router/MessageValidator.java @@ -23,6 +23,8 @@ public class MessageValidator { _context = context; context.statManager().createRateStat("router.duplicateMessageId", "Note that a duplicate messageId was received", "Router", new long[] { 10*60*1000l, 60*60*1000l, 3*60*60*1000l, 24*60*60*1000l }); + context.statManager().createRateStat("router.invalidMessageTime", "Note that a message outside the valid range was received", "Router", + new long[] { 10*60*1000l, 60*60*1000l, 3*60*60*1000l, 24*60*60*1000l }); } @@ -36,10 +38,12 @@ public class MessageValidator { if (now - Router.CLOCK_FUDGE_FACTOR >= expiration) { if (_log.shouldLog(Log.WARN)) _log.warn("Rejecting message " + messageId + " because it expired " + (now-expiration) + "ms ago"); + _context.statManager().addRateData("router.invalidMessageTime", (now-expiration), 0); return false; } else if (now + 4*Router.CLOCK_FUDGE_FACTOR < expiration) { if (_log.shouldLog(Log.WARN)) _log.warn("Rejecting message " + messageId + " because it will expire too far in the future (" + (expiration-now) + "ms)"); + _context.statManager().addRateData("router.invalidMessageTime", (now-expiration), 0); return false; } diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 87ab848e7b..c5d8294a5a 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -15,9 +15,9 @@ import net.i2p.CoreVersion; * */ public class RouterVersion { - public final static String ID = "$Revision: 1.158 $ $Date: 2005/03/04 01:09:20 $"; - public final static String VERSION = "0.5.0.1"; - public final static long BUILD = 10; + public final static String ID = "$Revision: 1.159 $ $Date: 2005/03/04 21:54:43 $"; + public final static String VERSION = "0.5.0.2"; + public final static long BUILD = 0; public static void main(String args[]) { System.out.println("I2P Router version: " + VERSION); System.out.println("Router ID: " + RouterVersion.ID); diff --git a/router/java/src/net/i2p/router/StatisticsManager.java b/router/java/src/net/i2p/router/StatisticsManager.java index e439d4abf7..d3e8bb73ba 100644 --- a/router/java/src/net/i2p/router/StatisticsManager.java +++ b/router/java/src/net/i2p/router/StatisticsManager.java @@ -33,7 +33,7 @@ public class StatisticsManager implements Service { public final static String PROP_PUBLISH_RANKINGS = "router.publishPeerRankings"; public final static String DEFAULT_PROP_PUBLISH_RANKINGS = "true"; public final static String PROP_MAX_PUBLISHED_PEERS = "router.publishPeerMax"; - public final static int DEFAULT_MAX_PUBLISHED_PEERS = 20; + public final static int DEFAULT_MAX_PUBLISHED_PEERS = 10; private final DecimalFormat _fmt; private final DecimalFormat _pct; @@ -102,6 +102,7 @@ public class StatisticsManager implements Service { stats.putAll(_context.profileManager().summarizePeers(_publishedStats)); includeThroughput(stats); + includeRate("router.invalidMessageTime", stats, new long[] { 10*60*1000, 3*60*60*1000 }); includeRate("router.duplicateMessageId", stats, new long[] { 24*60*60*1000 }); includeRate("tunnel.duplicateIV", stats, new long[] { 24*60*60*1000 }); includeRate("tunnel.fragmentedComplete", stats, new long[] { 10*60*1000, 3*60*60*1000 }); -- GitLab