forked from I2P_Developers/i2p.i2p
* 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;
|
||||
while (sockManager == null) {
|
||||
// if persistent dest
|
||||
// sockManager = I2PSocketManagerFactory.createManager(privData, tunnel.host, portNum, props);
|
||||
// else
|
||||
sockManager = I2PSocketManagerFactory.createManager(tunnel.host, portNum, props);
|
||||
|
||||
if (sockManager == null) {
|
||||
|
@@ -58,7 +58,7 @@ public class TunnelController implements Logging {
|
||||
setConfig(config, prefix);
|
||||
_messages = new ArrayList(4);
|
||||
_running = false;
|
||||
if (createKey && getType().endsWith("server"))
|
||||
if (createKey && (getType().endsWith("server") || getPersistentClientKey()))
|
||||
createPrivateKey();
|
||||
_starting = getStartOnLoad();
|
||||
}
|
||||
@@ -395,6 +395,7 @@ public class TunnelController implements Logging {
|
||||
public String getProxyList() { return _config.getProperty("proxyList"); }
|
||||
public String getSharedClient() { return _config.getProperty("sharedClient", "true"); }
|
||||
public boolean getStartOnLoad() { return "true".equalsIgnoreCase(_config.getProperty("startOnLoad", "true")); }
|
||||
public boolean getPersistentClientKey() { return Boolean.valueOf(_config.getProperty("persistentClientKey")).booleanValue(); }
|
||||
public String getMyDestination() {
|
||||
if (_tunnel != null) {
|
||||
List sessions = _tunnel.getSessions();
|
||||
|
@@ -44,7 +44,8 @@ public class I2PSink implements Sink {
|
||||
|
||||
// send message
|
||||
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) {
|
||||
// TODO: handle better
|
||||
exc.printStackTrace();
|
||||
|
@@ -42,7 +42,8 @@ public class I2PSinkAnywhere implements Sink {
|
||||
|
||||
// send message
|
||||
try {
|
||||
this.sess.sendMessage(to, payload);
|
||||
this.sess.sendMessage(to, payload, I2PSession.PROTO_DATAGRAM,
|
||||
I2PSession.PORT_UNSPECIFIED, I2PSession.PORT_UNSPECIFIED);
|
||||
} catch(I2PSessionException exc) {
|
||||
// TODO: handle better
|
||||
exc.printStackTrace();
|
||||
|
@@ -156,6 +156,10 @@ public class EditBean extends IndexBean {
|
||||
return getBooleanProperty(tunnel, "i2cp.newDestOnResume");
|
||||
}
|
||||
|
||||
public boolean getPersistentClientKey(int tunnel) {
|
||||
return getBooleanProperty(tunnel, "persistentClientKey");
|
||||
}
|
||||
|
||||
private int getProperty(int tunnel, String prop, int def) {
|
||||
TunnelController tun = getController(tunnel);
|
||||
if (tun != null) {
|
||||
|
@@ -614,8 +614,11 @@ public class IndexBean {
|
||||
public void setAccess(String moo) {
|
||||
_booleanOptions.add("i2cp.enableAccessList");
|
||||
}
|
||||
public void setNewDest(String moo) {
|
||||
_booleanOptions.add("i2cp.newDestOnResume");
|
||||
public void setNewDest(String val) {
|
||||
if ("1".equals(val))
|
||||
_booleanOptions.add("i2cp.newDestOnResume");
|
||||
else if ("2".equals(val))
|
||||
_booleanOptions.add("persistentClientKey");
|
||||
}
|
||||
|
||||
public void setReduceTime(String val) {
|
||||
@@ -790,8 +793,6 @@ public class IndexBean {
|
||||
config.setProperty("targetHost", _targetHost);
|
||||
if (_targetPort != null)
|
||||
config.setProperty("targetPort", _targetPort);
|
||||
if (_privKeyFile != null)
|
||||
config.setProperty("privKeyFile", _privKeyFile);
|
||||
for (String p : _booleanServerOpts)
|
||||
config.setProperty("option." + p, "" + _booleanOptions.contains(p));
|
||||
for (String p : _otherServerOpts)
|
||||
@@ -819,7 +820,7 @@ public class IndexBean {
|
||||
"inbound.nickname", "outbound.nickname", "i2p.streaming.connectDelay", "i2p.streaming.maxWindowSize"
|
||||
};
|
||||
private static final String _booleanClientOpts[] = {
|
||||
"i2cp.reduceOnIdle", "i2cp.closeOnIdle", "i2cp.newDestOnResume"
|
||||
"i2cp.reduceOnIdle", "i2cp.closeOnIdle", "i2cp.newDestOnResume", "persistentClientKey"
|
||||
};
|
||||
private static final String _booleanServerOpts[] = {
|
||||
"i2cp.reduceOnIdle", "i2cp.encryptLeaseSet", "i2cp.enableAccessList"
|
||||
@@ -852,6 +853,8 @@ public class IndexBean {
|
||||
} else {
|
||||
config.setProperty("i2cpPort", "7654");
|
||||
}
|
||||
if (_privKeyFile != null)
|
||||
config.setProperty("privKeyFile", _privKeyFile);
|
||||
|
||||
if (_customOptions != null) {
|
||||
StringTokenizer tok = new StringTokenizer(_customOptions);
|
||||
|
Reference in New Issue
Block a user