* 2005-07-27 0.6 released
2005-07-27 jrandom * Enabled SSU as the default top priority transport, adjusting the config.jsp page accordingly. * Add verification fields to the SSU and TCP connection negotiation (not compatible with previous builds) * Enable the backwards incompatible tunnel crypto change as documented in tunnel-alt.html (have each hop encrypt the received IV before using it, then encrypt it again before sending it on) * Disable the I2CP encryption, leaving in place the end to end garlic encryption (another backwards incompatible change) * Adjust the protocol versions on the TCP and SSU transports so that they won't talk to older routers. * Fix up the config stats handling again * Fix a rare off-by-one in the SSU fragmentation * Reduce some unnecessary netDb resending by inluding the peers queried successfully in the store redundancy count.
This commit is contained in:
@ -28,7 +28,8 @@ public class ConfigNetHandler extends FormHandler {
|
||||
private boolean _reseedRequested;
|
||||
private boolean _saveRequested;
|
||||
private boolean _timeSyncEnabled;
|
||||
private String _port;
|
||||
private String _tcpPort;
|
||||
private String _udpPort;
|
||||
private String _inboundRate;
|
||||
private String _inboundBurst;
|
||||
private String _outboundRate;
|
||||
@ -56,8 +57,11 @@ public class ConfigNetHandler extends FormHandler {
|
||||
public void setHostname(String hostname) {
|
||||
_hostname = (hostname != null ? hostname.trim() : null);
|
||||
}
|
||||
public void setPort(String port) {
|
||||
_port = (port != null ? port.trim() : null);
|
||||
public void setTcpPort(String port) {
|
||||
_tcpPort = (port != null ? port.trim() : null);
|
||||
}
|
||||
public void setUdpPort(String port) {
|
||||
_udpPort = (port != null ? port.trim() : null);
|
||||
}
|
||||
public void setInboundrate(String rate) {
|
||||
_inboundRate = (rate != null ? rate.trim() : null);
|
||||
@ -207,14 +211,25 @@ public class ConfigNetHandler extends FormHandler {
|
||||
restartRequired = true;
|
||||
}
|
||||
}
|
||||
if ( (_port != null) && (_port.length() > 0) ) {
|
||||
if ( (_tcpPort != null) && (_tcpPort.length() > 0) ) {
|
||||
String oldPort = _context.router().getConfigSetting(ConfigNetHelper.PROP_I2NP_TCP_PORT);
|
||||
if ( (oldPort == null) && (_port.equals("8887")) ) {
|
||||
if ( (oldPort == null) && (_tcpPort.equals("8887")) ) {
|
||||
// still on default.. noop
|
||||
} else if ( (oldPort == null) || (!oldPort.equalsIgnoreCase(_port)) ) {
|
||||
} else if ( (oldPort == null) || (!oldPort.equalsIgnoreCase(_tcpPort)) ) {
|
||||
// its not the default OR it has changed
|
||||
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_TCP_PORT, _port);
|
||||
addFormNotice("Updating TCP port from " + oldPort + " to " + _port);
|
||||
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_TCP_PORT, _tcpPort);
|
||||
addFormNotice("Updating TCP port from " + oldPort + " to " + _tcpPort);
|
||||
restartRequired = true;
|
||||
}
|
||||
}
|
||||
if ( (_udpPort != null) && (_udpPort.length() > 0) ) {
|
||||
String oldPort = _context.router().getConfigSetting(ConfigNetHelper.PROP_I2NP_UDP_PORT);
|
||||
if ( (oldPort == null) && (_udpPort.equals("8887")) ) {
|
||||
// still on default.. noop
|
||||
} else if ( (oldPort == null) || (!oldPort.equalsIgnoreCase(_udpPort)) ) {
|
||||
// its not the default OR it has changed
|
||||
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_TCP_PORT, _udpPort);
|
||||
addFormNotice("Updating UDP port from " + oldPort + " to " + _udpPort);
|
||||
restartRequired = true;
|
||||
}
|
||||
}
|
||||
|
@ -24,11 +24,13 @@ public class ConfigNetHelper {
|
||||
/** copied from various private TCP components */
|
||||
public final static String PROP_I2NP_TCP_HOSTNAME = "i2np.tcp.hostname";
|
||||
public final static String PROP_I2NP_TCP_PORT = "i2np.tcp.port";
|
||||
public final static String PROP_I2NP_UDP_PORT = "i2np.udp.port";
|
||||
public final static String PROP_I2NP_INTERNAL_UDP_PORT = "i2np.udp.internalPort";
|
||||
|
||||
public String getHostname() {
|
||||
return _context.getProperty(PROP_I2NP_TCP_HOSTNAME);
|
||||
}
|
||||
public String getPort() {
|
||||
public String getTcpPort() {
|
||||
int port = 8887;
|
||||
String val = _context.getProperty(PROP_I2NP_TCP_PORT);
|
||||
if (val != null) {
|
||||
@ -41,6 +43,21 @@ public class ConfigNetHelper {
|
||||
return "" + port;
|
||||
}
|
||||
|
||||
public String getUdpPort() {
|
||||
int port = 8887;
|
||||
String val = _context.getProperty(PROP_I2NP_UDP_PORT);
|
||||
if (val == null)
|
||||
val = _context.getProperty(PROP_I2NP_INTERNAL_UDP_PORT);
|
||||
if (val != null) {
|
||||
try {
|
||||
port = Integer.parseInt(val);
|
||||
} catch (NumberFormatException nfe) {
|
||||
// ignore, use default from above
|
||||
}
|
||||
}
|
||||
return "" + port;
|
||||
}
|
||||
|
||||
public String getEnableTimeSyncChecked() {
|
||||
String disabled = _context.getProperty(Timestamper.PROP_DISABLED, "false");
|
||||
if ( (disabled != null) && ("true".equalsIgnoreCase(disabled)) )
|
||||
|
@ -6,6 +6,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import net.i2p.util.Log;
|
||||
import net.i2p.stat.StatManager;
|
||||
|
||||
/**
|
||||
@ -22,6 +23,7 @@ public class ConfigStatsHandler extends FormHandler {
|
||||
public ConfigStatsHandler() {
|
||||
super();
|
||||
_stats = new ArrayList();
|
||||
_explicitFilter = false;
|
||||
}
|
||||
|
||||
protected void processForm() {
|
||||
@ -36,29 +38,16 @@ public class ConfigStatsHandler extends FormHandler {
|
||||
if (stats != null) {
|
||||
for (int i = 0; i < stats.length; i++) {
|
||||
String cur = stats[i].trim();
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Stat: [" + cur + "]");
|
||||
if ( (cur.length() > 0) && (!_stats.contains(cur)) )
|
||||
_stats.add(cur);
|
||||
}
|
||||
}
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Updated stats: " + _stats);
|
||||
}
|
||||
|
||||
public void setStatList(String stat) {
|
||||
if (stat != null) {
|
||||
if (stat.indexOf(',') != -1) {
|
||||
StringTokenizer tok = new StringTokenizer(stat, ",");
|
||||
while (tok.hasMoreTokens()) {
|
||||
String cur = tok.nextToken().trim();
|
||||
if ( (cur.length() > 0) && (!_stats.contains(cur)) )
|
||||
_stats.add(cur);
|
||||
}
|
||||
} else {
|
||||
stat = stat.trim();
|
||||
if ( (stat.length() > 0) && (!_stats.contains(stat)) )
|
||||
_stats.add(stat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setExplicitFilter(String foo) { _explicitFilter = true; }
|
||||
public void setExplicitFilterValue(String filter) { _explicitFilterValue = filter; }
|
||||
|
||||
@ -74,7 +63,19 @@ public class ConfigStatsHandler extends FormHandler {
|
||||
|
||||
if (_explicitFilter) {
|
||||
_stats.clear();
|
||||
setStatList(_explicitFilterValue);
|
||||
|
||||
if (_explicitFilterValue.indexOf(',') != -1) {
|
||||
StringTokenizer tok = new StringTokenizer(_explicitFilterValue, ",");
|
||||
while (tok.hasMoreTokens()) {
|
||||
String cur = tok.nextToken().trim();
|
||||
if ( (cur.length() > 0) && (!_stats.contains(cur)) )
|
||||
_stats.add(cur);
|
||||
}
|
||||
} else {
|
||||
String stat = _explicitFilterValue.trim();
|
||||
if ( (stat.length() > 0) && (!_stats.contains(stat)) )
|
||||
_stats.add(stat);
|
||||
}
|
||||
}
|
||||
|
||||
StringBuffer stats = new StringBuffer();
|
||||
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* Simple form handler base class - does not depend on servlets or jsp,
|
||||
@ -16,6 +17,7 @@ import net.i2p.router.RouterContext;
|
||||
*/
|
||||
public class FormHandler {
|
||||
protected RouterContext _context;
|
||||
protected Log _log;
|
||||
private String _nonce;
|
||||
protected String _action;
|
||||
private List _errors;
|
||||
@ -41,6 +43,7 @@ public class FormHandler {
|
||||
public void setContextId(String contextId) {
|
||||
try {
|
||||
_context = ContextHelper.getContext(contextId);
|
||||
_log = _context.logManager().getLog(getClass());
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
|
Reference in New Issue
Block a user