forked from I2P_Developers/i2p.i2p
* ElGamal/AES/SessionTag:
- Increase TX expire from 10 to 12 min, while keeping RX expire at 15 min. 3 minutes should be plenty of clock skew + delay. - Move tags-to-send and low-threshold values to be per-SKM - New session config options crypto.tagsToSend and crypto.lowTagThreshold - Prep for per-packet override of tags and thresholds - Cleanups and Javadocs * I2PTunnel: Add some defaults for the new session config options * OCMOSJ: - Don't bundle LeaseSet just because we're requesting an ACK - Changed session config option shouldBundleReplyInfo to default to true and be used to disable bundling altogether when set to false. Was previously an undocumented option to force bundling with a certain probability. - Don't send tags unless we've already generated a reply token (race) - Cleanups and Javadocs
This commit is contained in:
@@ -74,6 +74,9 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
protected int localPort = DEFAULT_LOCALPORT;
|
||||
|
||||
/**
|
||||
* Warning, blocks in constructor while connecting to router and building tunnels;
|
||||
* TODO move that to startRunning()
|
||||
*
|
||||
* @param privData Base64-encoded private key data,
|
||||
* format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
|
||||
* @throws IllegalArgumentException if the I2CP configuration is b0rked so
|
||||
@@ -87,6 +90,9 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Warning, blocks in constructor while connecting to router and building tunnels;
|
||||
* TODO move that to startRunning()
|
||||
*
|
||||
* @param privkey file containing the private key data,
|
||||
* format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
|
||||
* @param privkeyname the name of the privKey file, not clear why we need this too
|
||||
@@ -111,6 +117,9 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Warning, blocks in constructor while connecting to router and building tunnels;
|
||||
* TODO move that to startRunning()
|
||||
*
|
||||
* @param privData stream containing the private key data,
|
||||
* format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
|
||||
* @param privkeyname the name of the privKey file, not clear why we need this too
|
||||
@@ -124,6 +133,8 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Non-blocking
|
||||
*
|
||||
* @param sktMgr the existing socket manager
|
||||
* @since 0.8.9
|
||||
*/
|
||||
@@ -142,6 +153,9 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
private static final int MAX_RETRIES = 4;
|
||||
|
||||
/**
|
||||
* Warning, blocks while connecting to router and building tunnels;
|
||||
* TODO move that to startRunning()
|
||||
*
|
||||
* @param privData stream containing the private key data,
|
||||
* format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
|
||||
* @param privkeyname the name of the privKey file, not clear why we need this too
|
||||
@@ -236,6 +250,7 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
/**
|
||||
* Start running the I2PTunnelServer.
|
||||
*
|
||||
* TODO: Wait to connect to router until here.
|
||||
*/
|
||||
public void startRunning() {
|
||||
// prevent JVM exit when running outside the router
|
||||
|
@@ -156,8 +156,8 @@ public class TunnelController implements Logging {
|
||||
}
|
||||
String type = getType();
|
||||
if ( (type == null) || (type.length() <= 0) ) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Cannot start the tunnel - no type specified");
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
_log.error("Cannot start the tunnel - no type specified");
|
||||
return;
|
||||
}
|
||||
// Config options may have changed since instantiation, so do this again.
|
||||
@@ -455,6 +455,25 @@ public class TunnelController implements Logging {
|
||||
}
|
||||
}
|
||||
_config = props;
|
||||
|
||||
// Set up some per-type defaults
|
||||
// This really isn't the best spot to do this but for servers in particular,
|
||||
// it's hard to override settings in the subclass since the session connect
|
||||
// is done in the I2PTunnelServer constructor.
|
||||
String type = getType();
|
||||
if (type != null) {
|
||||
if (type.equals("httpserver") || type.equals("streamrserver")) {
|
||||
if (!_config.containsKey("option.shouldBundleReplyInfo"))
|
||||
_config.setProperty("option.shouldBundleReplyInfo", "false");
|
||||
} else if (type.contains("irc") || type.equals("streamrclient")) {
|
||||
// maybe a bad idea for ircclient if DCC is enabled
|
||||
if (!_config.containsKey("option.crypto.tagsToSend"))
|
||||
_config.setProperty("option.crypto.tagsToSend", "20");
|
||||
if (!_config.containsKey("option.crypto.lowTagThreshold"))
|
||||
_config.setProperty("option.crypto.lowTagThreshold", "14");
|
||||
}
|
||||
}
|
||||
|
||||
// tell i2ptunnel, who will tell the TunnelTask, who will tell the SocketManager
|
||||
setSessionOptions();
|
||||
if (_running && _sessions != null) {
|
||||
@@ -467,6 +486,9 @@ public class TunnelController implements Logging {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return a copy
|
||||
*/
|
||||
public Properties getConfig(String prefix) {
|
||||
Properties rv = new Properties();
|
||||
for (Map.Entry e : _config.entrySet()) {
|
||||
|
Reference in New Issue
Block a user