2004-11-21 jrandom

* Update the I2PTunnel web interface to include an option for the new
      streaming lib (which is ignored until the 0.4.2 release).
    * Revised the I2PTunnel web interface to keep the I2CP options of client
      and httpclient tunnels in sync, as they all share the same I2CP session.
This commit is contained in:
jrandom
2004-11-22 17:57:16 +00:00
committed by zzz
parent 8c3145b70f
commit 6d5fc8ca21
5 changed files with 75 additions and 24 deletions

View File

@ -60,6 +60,9 @@ class WebEditPageFormGenerator {
buf.append("value=\"squid.i2p\" ");
buf.append("/><br />\n");
buf.append("<hr />Note: the following options are shared across all client tunnels and");
buf.append(" HTTP proxies<br />\n");
addOptions(buf, controller);
buf.append("<input type=\"submit\" name=\"action\" value=\"Save\">\n");
buf.append("<input type=\"submit\" name=\"action\" value=\"Remove\">\n");
@ -80,6 +83,9 @@ class WebEditPageFormGenerator {
buf.append("value=\"").append(controller.getTargetDestination()).append("\" ");
buf.append(" /> (either the hosts.txt name or the full base64 destination)<br />\n");
buf.append("<hr />Note: the following options are shared across all client tunnels and");
buf.append(" HTTP proxies<br />\n");
addOptions(buf, controller);
buf.append("<input type=\"submit\" name=\"action\" value=\"Save\"><br />\n");
buf.append("<input type=\"submit\" name=\"action\" value=\"Remove\">\n");
@ -145,6 +151,13 @@ class WebEditPageFormGenerator {
if ( (controller != null) && (controller.getDescription() != null) )
buf.append("value=\"").append(controller.getDescription()).append("\" ");
buf.append("/><br />\n");
buf.append("<b>Start automatically?</b> \n");
buf.append("<input type=\"checkbox\" name=\"startOnLoad\" value=\"true\" ");
if ( (controller != null) && (controller.getStartOnLoad()) )
buf.append(" checked=\"true\" />\n<br />\n");
else
buf.append(" />\n<br />\n");
}
/**
@ -194,6 +207,7 @@ class WebEditPageFormGenerator {
private static void addOptions(StringBuffer buf, TunnelController controller) {
int tunnelDepth = 2;
int numTunnels = 2;
int connectDelay = 0;
Properties opts = getOptions(controller);
if (opts != null) {
String depth = opts.getProperty("tunnels.depthInbound");
@ -212,6 +226,14 @@ class WebEditPageFormGenerator {
numTunnels = 2;
}
}
String delay = opts.getProperty("i2p.streaming.connectDelay");
if (delay != null) {
try {
connectDelay = Integer.parseInt(delay);
} catch (NumberFormatException nfe) {
connectDelay = 0;
}
}
}
buf.append("<b>Tunnel depth:</b> ");
@ -251,6 +273,13 @@ 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>I2CP host:</b> ");
buf.append("<input type=\"text\" name=\"clientHost\" size=\"20\" value=\"");
if ( (controller != null) && (controller.getI2CPHost() != null) )
@ -275,18 +304,13 @@ class WebEditPageFormGenerator {
String val = opts.getProperty(key);
if ("tunnels.depthInbound".equals(key)) continue;
if ("tunnels.numInbound".equals(key)) continue;
if ("i2p.streaming.connectDelay".equals(key)) continue;
if (i != 0) buf.append(' ');
buf.append(key).append('=').append(val);
i++;
}
}
buf.append("\" /><br />\n");
buf.append("<b>Start automatically?</b> \n");
buf.append("<input type=\"checkbox\" name=\"startOnLoad\" value=\"true\" ");
if ( (controller != null) && (controller.getStartOnLoad()) )
buf.append(" checked=\"true\" />\n<br />\n");
else
buf.append(" />\n<br />\n");
}
/**

View File

@ -29,6 +29,7 @@ public class WebEditPageHelper {
private String _i2cpPort;
private String _tunnelDepth;
private String _tunnelCount;
private boolean _connectDelay;
private String _customOptions;
private String _proxyList;
private String _port;
@ -164,6 +165,9 @@ public class WebEditPageHelper {
public void setStartOnLoad(String moo) {
_startOnLoad = true;
}
public void setConnectDelay(String moo) {
_connectDelay = true;
}
/**
* Process the form and display any resulting messages
@ -252,6 +256,27 @@ public class WebEditPageHelper {
cur.setConfig(config, "");
}
if ("httpclient".equals(cur.getType()) || "client".equals(cur.getType())) {
// all clients use the same I2CP session, and as such, use the same
// I2CP options
List controllers = TunnelControllerGroup.getInstance().getControllers();
for (int i = 0; i < controllers.size(); i++) {
TunnelController c = (TunnelController)controllers.get(i);
if (c == cur) continue;
if ("httpclient".equals(c.getType()) || "client".equals(c.getType())) {
Properties cOpt = c.getConfig("");
if (_tunnelCount != null)
cOpt.setProperty("option.tunnels.numInbound", _tunnelCount);
if (_tunnelDepth != null)
cOpt.setProperty("option.tunnels.depthInbound", _tunnelDepth);
if (_connectDelay)
cOpt.setProperty("option.i2p.streaming.connectDelay", "1000");
else
cOpt.setProperty("option.i2p.streaming.connectDelay", "0");
c.setConfig(cOpt, "");
}
}
}
return getMessages(doSave());
}
@ -324,6 +349,7 @@ public class WebEditPageHelper {
String val = pair.substring(eq+1);
if ("tunnels.numInbound".equals(key)) continue;
if ("tunnels.depthInbound".equals(key)) continue;
if ("i2p.streaming.connectDelay".equals(key)) continue;
config.setProperty("option." + key, val);
}
}
@ -334,6 +360,10 @@ public class WebEditPageHelper {
config.setProperty("option.tunnels.numInbound", _tunnelCount);
if (_tunnelDepth != null)
config.setProperty("option.tunnels.depthInbound", _tunnelDepth);
if (_connectDelay)
config.setProperty("option.i2p.streaming.connectDelay", "1000");
else
config.setProperty("option.i2p.streaming.connectDelay", "0");
}
/**

View File

@ -1,4 +1,10 @@
$Id: history.txt,v 1.78 2004/11/21 14:42:57 jrandom Exp $
$Id: history.txt,v 1.79 2004/11/21 17:31:33 jrandom Exp $
2004-11-21 jrandom
* Update the I2PTunnel web interface to include an option for the new
streaming lib (which is ignored until the 0.4.2 release).
* Revised the I2PTunnel web interface to keep the I2CP options of client
and httpclient tunnels in sync, as they all share the same I2CP session.
2004-11-21 jrandom
* Only allow small clock skews after the first 10 minutes of operation

View File

@ -9,6 +9,7 @@ tunnel.0.i2cpHost=localhost
tunnel.0.i2cpPort=7654
tunnel.0.option.tunnels.depthInbound=2
tunnel.0.option.tunnels.numInbound=2
tunnel.0.option.i2p.streaming.connectDelay=1000
tunnel.0.startOnLoad=true
# irc
@ -17,11 +18,12 @@ tunnel.1.description=IRC proxy to access the anonymous irc net
tunnel.1.type=client
tunnel.1.interface=127.0.0.1
tunnel.1.listenPort=6668
tunnel.1.targetDestination=irc.duck.i2p
tunnel.1.targetDestination=irc.duck.i2p,irc.baffled.i2p
tunnel.1.i2cpHost=localhost
tunnel.1.i2cpPort=7654
tunnel.1.option.tunnels.depthInbound=2
tunnel.1.option.tunnels.numInbound=2
tunnel.1.option.i2p.streaming.connectDelay=1000
tunnel.1.startOnLoad=true
# I2P's cvs server
@ -59,6 +61,7 @@ tunnel.4.listenPort=7659
tunnel.4.name=smtp.postman.i2p
tunnel.4.option.tunnels.depthInbound=2
tunnel.4.option.tunnels.numInbound=2
tunnel.4.option.i2p.streaming.connectDelay=1000
tunnel.4.startOnLoad=false
tunnel.4.targetDestination=smtp.postman.i2p
tunnel.4.type=client
@ -72,19 +75,7 @@ tunnel.5.interface=127.0.0.1
tunnel.5.listenPort=7660
tunnel.5.option.tunnels.depthInbound=2
tunnel.5.option.tunnels.numInbound=2
tunnel.5.option.i2p.streaming.connectDelay=1000
tunnel.5.startOnLoad=false
tunnel.5.targetDestination=pop.postman.i2p
tunnel.5.type=client
# another irc server, linked with irc.duck.i2p and IIP
tunnel.6.description=irc.baffled.i2p
tunnel.6.i2cpHost=localhost
tunnel.6.i2cpPort=7654
tunnel.6.interface=localhost
tunnel.6.listenPort=7661
tunnel.6.name=irc.baffled.i2p
tunnel.6.option.tunnels.depthInbound=2
tunnel.6.option.tunnels.numInbound=2
tunnel.6.startOnLoad=false
tunnel.6.targetDestination=irc.baffled.i2p
tunnel.6.type=client
tunnel.5.type=client

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.83 $ $Date: 2004/11/21 14:42:58 $";
public final static String ID = "$Revision: 1.84 $ $Date: 2004/11/21 17:31:33 $";
public final static String VERSION = "0.4.1.4";
public final static long BUILD = 12;
public final static long BUILD = 13;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION);
System.out.println("Router ID: " + RouterVersion.ID);