* I2PTunnel:
- Add persistent key option for clients (not hooked in yet) - I2PSink: Send protocol byte
This commit is contained in:
@ -230,6 +230,9 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
|||||||
|
|
||||||
I2PSocketManager sockManager = null;
|
I2PSocketManager sockManager = null;
|
||||||
while (sockManager == null) {
|
while (sockManager == null) {
|
||||||
|
// if persistent dest
|
||||||
|
// sockManager = I2PSocketManagerFactory.createManager(privData, tunnel.host, portNum, props);
|
||||||
|
// else
|
||||||
sockManager = I2PSocketManagerFactory.createManager(tunnel.host, portNum, props);
|
sockManager = I2PSocketManagerFactory.createManager(tunnel.host, portNum, props);
|
||||||
|
|
||||||
if (sockManager == null) {
|
if (sockManager == null) {
|
||||||
|
@ -58,7 +58,7 @@ public class TunnelController implements Logging {
|
|||||||
setConfig(config, prefix);
|
setConfig(config, prefix);
|
||||||
_messages = new ArrayList(4);
|
_messages = new ArrayList(4);
|
||||||
_running = false;
|
_running = false;
|
||||||
if (createKey && getType().endsWith("server"))
|
if (createKey && (getType().endsWith("server") || getPersistentClientKey()))
|
||||||
createPrivateKey();
|
createPrivateKey();
|
||||||
_starting = getStartOnLoad();
|
_starting = getStartOnLoad();
|
||||||
}
|
}
|
||||||
@ -395,6 +395,7 @@ public class TunnelController implements Logging {
|
|||||||
public String getProxyList() { return _config.getProperty("proxyList"); }
|
public String getProxyList() { return _config.getProperty("proxyList"); }
|
||||||
public String getSharedClient() { return _config.getProperty("sharedClient", "true"); }
|
public String getSharedClient() { return _config.getProperty("sharedClient", "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("persistentClientKey")).booleanValue(); }
|
||||||
public String getMyDestination() {
|
public String getMyDestination() {
|
||||||
if (_tunnel != null) {
|
if (_tunnel != null) {
|
||||||
List sessions = _tunnel.getSessions();
|
List sessions = _tunnel.getSessions();
|
||||||
|
@ -44,7 +44,8 @@ public class I2PSink implements Sink {
|
|||||||
|
|
||||||
// send message
|
// send message
|
||||||
try {
|
try {
|
||||||
this.sess.sendMessage(this.dest, payload);
|
this.sess.sendMessage(this.dest, payload, I2PSession.PROTO_DATAGRAM,
|
||||||
|
I2PSession.PORT_UNSPECIFIED, I2PSession.PORT_UNSPECIFIED);
|
||||||
} catch(I2PSessionException exc) {
|
} catch(I2PSessionException exc) {
|
||||||
// TODO: handle better
|
// TODO: handle better
|
||||||
exc.printStackTrace();
|
exc.printStackTrace();
|
||||||
|
@ -42,7 +42,8 @@ public class I2PSinkAnywhere implements Sink {
|
|||||||
|
|
||||||
// send message
|
// send message
|
||||||
try {
|
try {
|
||||||
this.sess.sendMessage(to, payload);
|
this.sess.sendMessage(to, payload, I2PSession.PROTO_DATAGRAM,
|
||||||
|
I2PSession.PORT_UNSPECIFIED, I2PSession.PORT_UNSPECIFIED);
|
||||||
} catch(I2PSessionException exc) {
|
} catch(I2PSessionException exc) {
|
||||||
// TODO: handle better
|
// TODO: handle better
|
||||||
exc.printStackTrace();
|
exc.printStackTrace();
|
||||||
|
@ -156,6 +156,10 @@ public class EditBean extends IndexBean {
|
|||||||
return getBooleanProperty(tunnel, "i2cp.newDestOnResume");
|
return getBooleanProperty(tunnel, "i2cp.newDestOnResume");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getPersistentClientKey(int tunnel) {
|
||||||
|
return getBooleanProperty(tunnel, "persistentClientKey");
|
||||||
|
}
|
||||||
|
|
||||||
private int getProperty(int tunnel, String prop, int def) {
|
private int getProperty(int tunnel, String prop, int def) {
|
||||||
TunnelController tun = getController(tunnel);
|
TunnelController tun = getController(tunnel);
|
||||||
if (tun != null) {
|
if (tun != null) {
|
||||||
|
@ -614,8 +614,11 @@ public class IndexBean {
|
|||||||
public void setAccess(String moo) {
|
public void setAccess(String moo) {
|
||||||
_booleanOptions.add("i2cp.enableAccessList");
|
_booleanOptions.add("i2cp.enableAccessList");
|
||||||
}
|
}
|
||||||
public void setNewDest(String moo) {
|
public void setNewDest(String val) {
|
||||||
_booleanOptions.add("i2cp.newDestOnResume");
|
if ("1".equals(val))
|
||||||
|
_booleanOptions.add("i2cp.newDestOnResume");
|
||||||
|
else if ("2".equals(val))
|
||||||
|
_booleanOptions.add("persistentClientKey");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReduceTime(String val) {
|
public void setReduceTime(String val) {
|
||||||
@ -790,8 +793,6 @@ public class IndexBean {
|
|||||||
config.setProperty("targetHost", _targetHost);
|
config.setProperty("targetHost", _targetHost);
|
||||||
if (_targetPort != null)
|
if (_targetPort != null)
|
||||||
config.setProperty("targetPort", _targetPort);
|
config.setProperty("targetPort", _targetPort);
|
||||||
if (_privKeyFile != null)
|
|
||||||
config.setProperty("privKeyFile", _privKeyFile);
|
|
||||||
for (String p : _booleanServerOpts)
|
for (String p : _booleanServerOpts)
|
||||||
config.setProperty("option." + p, "" + _booleanOptions.contains(p));
|
config.setProperty("option." + p, "" + _booleanOptions.contains(p));
|
||||||
for (String p : _otherServerOpts)
|
for (String p : _otherServerOpts)
|
||||||
@ -819,7 +820,7 @@ public class IndexBean {
|
|||||||
"inbound.nickname", "outbound.nickname", "i2p.streaming.connectDelay", "i2p.streaming.maxWindowSize"
|
"inbound.nickname", "outbound.nickname", "i2p.streaming.connectDelay", "i2p.streaming.maxWindowSize"
|
||||||
};
|
};
|
||||||
private static final String _booleanClientOpts[] = {
|
private static final String _booleanClientOpts[] = {
|
||||||
"i2cp.reduceOnIdle", "i2cp.closeOnIdle", "i2cp.newDestOnResume"
|
"i2cp.reduceOnIdle", "i2cp.closeOnIdle", "i2cp.newDestOnResume", "persistentClientKey"
|
||||||
};
|
};
|
||||||
private static final String _booleanServerOpts[] = {
|
private static final String _booleanServerOpts[] = {
|
||||||
"i2cp.reduceOnIdle", "i2cp.encryptLeaseSet", "i2cp.enableAccessList"
|
"i2cp.reduceOnIdle", "i2cp.encryptLeaseSet", "i2cp.enableAccessList"
|
||||||
@ -852,6 +853,8 @@ public class IndexBean {
|
|||||||
} else {
|
} else {
|
||||||
config.setProperty("i2cpPort", "7654");
|
config.setProperty("i2cpPort", "7654");
|
||||||
}
|
}
|
||||||
|
if (_privKeyFile != null)
|
||||||
|
config.setProperty("privKeyFile", _privKeyFile);
|
||||||
|
|
||||||
if (_customOptions != null) {
|
if (_customOptions != null) {
|
||||||
StringTokenizer tok = new StringTokenizer(_customOptions);
|
StringTokenizer tok = new StringTokenizer(_customOptions);
|
||||||
|
@ -288,34 +288,6 @@
|
|||||||
<hr />
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="optionsField" class="rowItem">
|
|
||||||
<label for="reduce" accesskey="c">
|
|
||||||
<span class="accessKey">C</span>lose tunnels when idle:
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div id="portField" class="rowItem">
|
|
||||||
<label for="access" accesskey="c">
|
|
||||||
Enable:
|
|
||||||
</label>
|
|
||||||
<input value="1" type="checkbox" id="startOnLoad" name="close" title="Close Tunnels"<%=(editBean.getClose(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
|
|
||||||
</div>
|
|
||||||
<div id="portField" class="rowItem">
|
|
||||||
<label for="access" accesskey="c">
|
|
||||||
Generate New Destination Keys On Reopen:
|
|
||||||
</label>
|
|
||||||
<input value="1" type="checkbox" id="startOnLoad" name="newDest" title="New Destination"<%=(editBean.getNewDest(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
|
|
||||||
</div>
|
|
||||||
<div id="portField" class="rowItem">
|
|
||||||
<label for="reduceTime" accesskey="c">
|
|
||||||
Close when idle (minutes):
|
|
||||||
</label>
|
|
||||||
<input type="text" id="port" name="closeTime" size="4" maxlength="4" title="Reduced Tunnel Idle Time" value="<%=editBean.getCloseTime(curTunnel)%>" class="freetext" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="subdivider">
|
|
||||||
<hr />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="optionsField" class="rowItem">
|
<div id="optionsField" class="rowItem">
|
||||||
<label for="reduce" accesskey="d">
|
<label for="reduce" accesskey="d">
|
||||||
Re<span class="accessKey">d</span>uce tunnel quantity when idle:
|
Re<span class="accessKey">d</span>uce tunnel quantity when idle:
|
||||||
@ -344,6 +316,60 @@
|
|||||||
<hr />
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="optionsField" class="rowItem">
|
||||||
|
<label for="reduce" accesskey="c">
|
||||||
|
<span class="accessKey">C</span>lose tunnels when idle:
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div id="portField" class="rowItem">
|
||||||
|
<label for="access" accesskey="c">
|
||||||
|
Enable:
|
||||||
|
</label>
|
||||||
|
<input value="1" type="checkbox" id="startOnLoad" name="close" title="Close Tunnels"<%=(editBean.getClose(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||||
|
</div>
|
||||||
|
<div id="portField" class="rowItem">
|
||||||
|
<label for="access" accesskey="c">
|
||||||
|
Generate New Destination Keys On Reopen:
|
||||||
|
</label>
|
||||||
|
<table border="0"><tr><!-- I give up -->
|
||||||
|
<td><input value="1" type="radio" id="startOnLoad" name="newDest" title="New Destination"
|
||||||
|
<%=(editBean.getNewDest(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||||
|
<td valign="center">Enable
|
||||||
|
<td><input value="0" type="radio" id="startOnLoad" name="newDest" title="New Destination"
|
||||||
|
<%=(editBean.getNewDest(curTunnel) || editBean.getPersistentClientKey(curTunnel) ? "" : " checked=\"checked\"")%> class="tickbox" />
|
||||||
|
<td valign="center">Disable
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div id="portField" class="rowItem">
|
||||||
|
<label for="reduceTime" accesskey="c">
|
||||||
|
Close when idle (minutes):
|
||||||
|
</label>
|
||||||
|
<input type="text" id="port" name="closeTime" size="4" maxlength="4" title="Close Tunnel Idle Time" value="<%=editBean.getCloseTime(curTunnel)%>" class="freetext" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="subdivider">
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="optionsField" class="rowItem">
|
||||||
|
<label for="privKeyFile" accesskey="k">
|
||||||
|
Persistent private <span class="accessKey">k</span>ey:
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div id="portField" class="rowItem">
|
||||||
|
<label>Enable:</label>
|
||||||
|
<input value="2" type="radio" id="startOnLoad" name="newDest" title="New Destination"
|
||||||
|
<%=(editBean.getPersistentClientKey(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
|
||||||
|
</div>
|
||||||
|
<div id="reachField" class="rowItem">
|
||||||
|
<label>File:</label>
|
||||||
|
<input type="text" size="30" id="clientHost" name="privKeyFile" title="Path to Private Key File" value="<%=editBean.getPrivateKeyFile(curTunnel)%>" class="freetext" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="subdivider">
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="customOptionsField" class="rowItem">
|
<div id="customOptionsField" class="rowItem">
|
||||||
<label for="customOptions" accesskey="u">
|
<label for="customOptions" accesskey="u">
|
||||||
C<span class="accessKey">u</span>stom options:
|
C<span class="accessKey">u</span>stom options:
|
||||||
|
@ -272,9 +272,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="portField" class="rowItem">
|
<div id="portField" class="rowItem">
|
||||||
<label for="force" accesskey="c">
|
<label for="force" accesskey="c">
|
||||||
Generate Key:
|
Generate New Key:
|
||||||
</label>
|
</label>
|
||||||
<button id="controlSave" accesskey="S" class="control" type="submit" name="action" value="Generate" title="Generate New Key Now">Generate New Key</button>
|
<button id="controlSave" accesskey="S" class="control" type="submit" name="action" value="Generate" title="Generate New Key Now">Generate</button>
|
||||||
<span class="comment">(Tunnel must be stopped first)</span>
|
<span class="comment">(Tunnel must be stopped first)</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user