- Move connection profile and delay connect to advanced config section

- Add persistent client key support to SOCKS IRC
This commit is contained in:
zzz
2010-06-26 04:11:02 +00:00
parent 9fcb07250d
commit 8c2641703c
8 changed files with 78 additions and 44 deletions

View File

@@ -886,7 +886,7 @@ public class I2PTunnel implements Logging, EventDispatcher {
ownDest = !isShared; ownDest = !isShared;
I2PTunnelTask task; I2PTunnelTask task;
task = new I2PSOCKSTunnel(_port, l, ownDest, (EventDispatcher) this, this); task = new I2PSOCKSTunnel(_port, l, ownDest, (EventDispatcher) this, this, null);
addtask(task); addtask(task);
notifyEvent("sockstunnelTaskId", Integer.valueOf(task.getId())); notifyEvent("sockstunnelTaskId", Integer.valueOf(task.getId()));
} else { } else {
@@ -899,10 +899,11 @@ public class I2PTunnel implements Logging, EventDispatcher {
/** /**
* Run an SOCKS IRC tunnel on the given port number * Run an SOCKS IRC tunnel on the given port number
* @param args {portNumber [, sharedClient]} or (portNumber, ignored (false), privKeyFile)
* @since 0.7.12 * @since 0.7.12
*/ */
public void runSOCKSIRCTunnel(String args[], Logging l) { public void runSOCKSIRCTunnel(String args[], Logging l) {
if (args.length >= 1 && args.length <= 2) { if (args.length >= 1 && args.length <= 3) {
int _port = -1; int _port = -1;
try { try {
_port = Integer.parseInt(args[0]); _port = Integer.parseInt(args[0]);
@@ -914,17 +915,20 @@ public class I2PTunnel implements Logging, EventDispatcher {
} }
boolean isShared = false; boolean isShared = false;
if (args.length > 1) if (args.length == 2)
isShared = "true".equalsIgnoreCase(args[1].trim()); isShared = "true".equalsIgnoreCase(args[1].trim());
ownDest = !isShared; ownDest = !isShared;
String privateKeyFile = null;
if (args.length == 3)
privateKeyFile = args[2];
I2PTunnelTask task; I2PTunnelTask task;
task = new I2PSOCKSIRCTunnel(_port, l, ownDest, (EventDispatcher) this, this); task = new I2PSOCKSIRCTunnel(_port, l, ownDest, (EventDispatcher) this, this, privateKeyFile);
addtask(task); addtask(task);
notifyEvent("sockstunnelTaskId", Integer.valueOf(task.getId())); notifyEvent("sockstunnelTaskId", Integer.valueOf(task.getId()));
} else { } else {
l.log("sockstunnel <port>"); l.log("socksirctunnel <port> [<sharedClient> [<privKeyFile>]]");
l.log(" creates a tunnel that distributes SOCKS requests."); l.log(" creates a tunnel for SOCKS IRC.");
notifyEvent("sockstunnelTaskId", Integer.valueOf(-1)); notifyEvent("sockstunnelTaskId", Integer.valueOf(-1));
} }
} }

View File

@@ -218,8 +218,13 @@ public class TunnelController implements Logging {
setListenOn(); setListenOn();
String listenPort = getListenPort(); String listenPort = getListenPort();
String sharedClient = getSharedClient(); String sharedClient = getSharedClient();
if (getPersistentClientKey()) {
String privKeyFile = getPrivKeyFile();
_tunnel.runSOCKSIRCTunnel(new String[] { listenPort, "false", privKeyFile }, this);
} else {
_tunnel.runSOCKSIRCTunnel(new String[] { listenPort, sharedClient }, this); _tunnel.runSOCKSIRCTunnel(new String[] { listenPort, sharedClient }, this);
} }
}
/* /*
* Streamr client is a UDP server, use the listenPort field for targetPort * Streamr client is a UDP server, use the listenPort field for targetPort
@@ -427,7 +432,9 @@ public class TunnelController implements Logging {
public String getListenPort() { return _config.getProperty("listenPort"); } public String getListenPort() { return _config.getProperty("listenPort"); }
public String getTargetDestination() { return _config.getProperty("targetDestination"); } public String getTargetDestination() { return _config.getProperty("targetDestination"); }
public String getProxyList() { return _config.getProperty("proxyList"); } public String getProxyList() { return _config.getProperty("proxyList"); }
/** default true */
public String getSharedClient() { return _config.getProperty("sharedClient", "true"); } public String getSharedClient() { return _config.getProperty("sharedClient", "true"); }
/** default true */
public boolean getStartOnLoad() { return "true".equalsIgnoreCase(_config.getProperty("startOnLoad", "true")); } public boolean getStartOnLoad() { return "true".equalsIgnoreCase(_config.getProperty("startOnLoad", "true")); }
public boolean getPersistentClientKey() { return Boolean.valueOf(_config.getProperty("option.persistentClientKey")).booleanValue(); } public boolean getPersistentClientKey() { return Boolean.valueOf(_config.getProperty("option.persistentClientKey")).booleanValue(); }
public String getMyDestination() { public String getMyDestination() {

View File

@@ -33,8 +33,9 @@ public class I2PSOCKSIRCTunnel extends I2PSOCKSTunnel {
private static final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(I2PSOCKSIRCTunnel.class); private static final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(I2PSOCKSIRCTunnel.class);
private static int __clientId = 0; private static int __clientId = 0;
public I2PSOCKSIRCTunnel(int localPort, Logging l, boolean ownDest, EventDispatcher notifyThis, I2PTunnel tunnel) { /** @param pkf private key file name or null for transient key */
super(localPort, l, ownDest, notifyThis, tunnel); public I2PSOCKSIRCTunnel(int localPort, Logging l, boolean ownDest, EventDispatcher notifyThis, I2PTunnel tunnel, String pkf) {
super(localPort, l, ownDest, notifyThis, tunnel, pkf);
setName(getLocalPort() + " -> SOCKSIRCTunnel"); setName(getLocalPort() + " -> SOCKSIRCTunnel");
} }
@@ -45,7 +46,7 @@ public class I2PSOCKSIRCTunnel extends I2PSOCKSTunnel {
@Override @Override
protected void clientConnectionRun(Socket s) { protected void clientConnectionRun(Socket s) {
try { try {
_log.error("SOCKS IRC Tunnel Start"); //_log.error("SOCKS IRC Tunnel Start");
SOCKSServer serv = SOCKSServerFactory.createSOCKSServer(s); SOCKSServer serv = SOCKSServerFactory.createSOCKSServer(s);
Socket clientSock = serv.getClientSocket(); Socket clientSock = serv.getClientSocket();
I2PSocket destSock = serv.getDestinationI2PSocket(this); I2PSocket destSock = serv.getDestinationI2PSocket(this);

View File

@@ -33,8 +33,9 @@ public class I2PSOCKSTunnel extends I2PTunnelClientBase {
// I2PSOCKSTunnel(localPort, l, ownDest, (EventDispatcher)null); // I2PSOCKSTunnel(localPort, l, ownDest, (EventDispatcher)null);
//} //}
public I2PSOCKSTunnel(int localPort, Logging l, boolean ownDest, EventDispatcher notifyThis, I2PTunnel tunnel) { /** @param pkf private key file name or null for transient key */
super(localPort, ownDest, l, notifyThis, "SOCKSHandler", tunnel); public I2PSOCKSTunnel(int localPort, Logging l, boolean ownDest, EventDispatcher notifyThis, I2PTunnel tunnel, String pkf) {
super(localPort, ownDest, l, notifyThis, "SOCKSHandler", tunnel, pkf);
if (waitEventValue("openBaseClientResult").equals("error")) { if (waitEventValue("openBaseClientResult").equals("error")) {
notifyEvent("openSOCKSTunnelResult", "error"); notifyEvent("openSOCKSTunnelResult", "error");

View File

@@ -163,23 +163,6 @@
</div> </div>
<% } %> <% } %>
<% if (!"streamrclient".equals(tunnelType)) { %> <% if (!"streamrclient".equals(tunnelType)) { %>
<div id="profileField" class="rowItem">
<label for="profile" accesskey="f">
<%=intl._("Profile")%>(<span class="accessKey">f</span>):
</label>
<select id="profile" name="profile" title="Connection Profile" class="selectbox">
<% boolean interactiveProfile = editBean.isInteractive(curTunnel);
%><option <%=(interactiveProfile == true ? "selected=\"selected\" " : "")%>value="interactive"><%=intl._("interactive connection")%> </option>
<option <%=(interactiveProfile == false ? "selected=\"selected\" " : "")%>value="bulk"><%=intl._("bulk connection (downloads/websites/BT)")%> </option>
</select>
</div>
<div id="delayConnectField" class="rowItem">
<label for="connectDelay" accesskey="y">
<%=intl._("Delay Connect")%>(<span class="accessKey">y</span>):
</label>
<input value="1000" type="checkbox" id="connectDelay" name="connectDelay" title="Delay Connection"<%=(editBean.shouldDelay(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
<span class="comment">(<%=intl._("for request/response connections")%>)</span>
</div>
<div id="sharedtField" class="rowItem"> <div id="sharedtField" class="rowItem">
<label for="shared" accesskey="h"> <label for="shared" accesskey="h">
<%=intl._("Shared Client")%>(<span class="accessKey">h</span>): <%=intl._("Shared Client")%>(<span class="accessKey">h</span>):
@@ -278,6 +261,30 @@
<hr /> <hr />
</div> </div>
<% if (!"streamrclient".equals(tunnelType)) { %>
<div id="profileField" class="rowItem">
<label for="profile" accesskey="f">
<%=intl._("Profile")%>(<span class="accessKey">f</span>):
</label>
<select id="profile" name="profile" title="Connection Profile" class="selectbox">
<% boolean interactiveProfile = editBean.isInteractive(curTunnel);
%><option <%=(interactiveProfile == true ? "selected=\"selected\" " : "")%>value="interactive"><%=intl._("interactive connection")%> </option>
<option <%=(interactiveProfile == false ? "selected=\"selected\" " : "")%>value="bulk"><%=intl._("bulk connection (downloads/websites/BT)")%> </option>
</select>
</div>
<div id="delayConnectField" class="rowItem">
<label for="connectDelay" accesskey="y">
<%=intl._("Delay Connect")%>(<span class="accessKey">y</span>):
</label>
<input value="1000" type="checkbox" id="connectDelay" name="connectDelay" title="Delay Connection"<%=(editBean.shouldDelay(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
<span class="comment">(<%=intl._("for request/response connections")%>)</span>
</div>
<div class="subdivider">
<hr />
</div>
<% } // !streamrclient %>
<div id="optionsField" class="rowItem"> <div id="optionsField" class="rowItem">
<label><%=intl._("I2CP Options")%>:</label> <label><%=intl._("I2CP Options")%>:</label>
</div> </div>
@@ -379,7 +386,7 @@
<hr /> <hr />
</div> </div>
<% if ("client".equals(tunnelType) || "ircclient".equals(tunnelType)) { %> <% if ("client".equals(tunnelType) || "ircclient".equals(tunnelType) || "socksirctunnel".equals(tunnelType)) { %>
<div id="optionsField" class="rowItem"> <div id="optionsField" class="rowItem">
<label for="privKeyFile" accesskey="k"> <label for="privKeyFile" accesskey="k">
<%=intl._("Persistent private key")%>(<span class="accessKey">k</span>): <%=intl._("Persistent private key")%>(<span class="accessKey">k</span>):

View File

@@ -187,18 +187,6 @@
<input type="text" size="30" id="privKeyFile" name="privKeyFile" title="Path to Private Key File" value="<%=editBean.getPrivateKeyFile(curTunnel)%>" class="freetext" /> <input type="text" size="30" id="privKeyFile" name="privKeyFile" title="Path to Private Key File" value="<%=editBean.getPrivateKeyFile(curTunnel)%>" class="freetext" />
</div> </div>
<% if (!"streamrserver".equals(tunnelType)) { %>
<div id="profileField" class="rowItem">
<label for="profile" accesskey="f">
<%=intl._("Profile")%>(<span class="accessKey">f</span>):
</label>
<select id="profile" name="profile" title="Connection Profile" class="selectbox">
<% boolean interactiveProfile = editBean.isInteractive(curTunnel);
%><option <%=(interactiveProfile == true ? "selected=\"selected\" " : "")%>value="interactive"><%=intl._("interactive connection")%> </option>
<option <%=(interactiveProfile == false ? "selected=\"selected\" " : "")%>value="bulk"><%=intl._("bulk connection (downloads/websites/BT)")%> </option>
</select>
</div>
<% } // !streamrserver %>
<div id="destinationField" class="rowItem"> <div id="destinationField" class="rowItem">
<label for="localDestination" accesskey="L"> <label for="localDestination" accesskey="L">
<%=intl._("Local destination")%>(<span class="accessKey">L</span>): <%=intl._("Local destination")%>(<span class="accessKey">L</span>):
@@ -290,6 +278,23 @@
<hr /> <hr />
</div> </div>
<% if (!"streamrserver".equals(tunnelType)) { %>
<div id="profileField" class="rowItem">
<label for="profile" accesskey="f">
<%=intl._("Profile")%>(<span class="accessKey">f</span>):
</label>
<select id="profile" name="profile" title="Connection Profile" class="selectbox">
<% boolean interactiveProfile = editBean.isInteractive(curTunnel);
%><option <%=(interactiveProfile == true ? "selected=\"selected\" " : "")%>value="interactive"><%=intl._("interactive connection")%> </option>
<option <%=(interactiveProfile == false ? "selected=\"selected\" " : "")%>value="bulk"><%=intl._("bulk connection (downloads/websites/BT)")%> </option>
</select>
</div>
<div class="subdivider">
<hr />
</div>
<% } // !streamrserver %>
<div id="optionsField" class="rowItem"> <div id="optionsField" class="rowItem">
<label><%=intl._("I2CP Options")%>:</label> <label><%=intl._("I2CP Options")%>:</label>
</div> </div>

View File

@@ -1,3 +1,12 @@
2010-06-26 zzz
* I2PTunnel:
- Move connection profile and delay connect to advanced config section
- Add persistent client key support to SOCKS IRC
- Fix display of interactive setting
* jbigi, jcpuid: Suppress log messages when not in router context
* jetty.xml: Add info on how to configure for following symlinks
* logs.jsp: Add more JVM version info so we can distinguish OpenJDK from Sun
2010-06-16 zzz 2010-06-16 zzz
* Console: Sort countries with selected locale * Console: Sort countries with selected locale
* FileUtil: Try to handle lack of unpack200 support more gracefully * FileUtil: Try to handle lack of unpack200 support more gracefully

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 2; public final static long BUILD = 3;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";