- Simplify config.jsp some more

- No longer use i2np.udp.forceIntroducers
- Tweak UDP port qualification
- Fix allowing low ports again
- Add option to completely disable NTCP, for those behind nasty firewalls
- Use SSU reachability rather than global reachability for determining NTCP reachability,
  since we are now reporting NTCP reachability too
This commit is contained in:
zzz
2009-05-06 00:54:24 +00:00
parent e82f173f85
commit 0b7fb21263
6 changed files with 49 additions and 32 deletions

View File

@@ -163,7 +163,9 @@ public class ConfigNetHandler extends FormHandler {
if (_ntcpAutoIP == null) _ntcpAutoIP = "true";
if ((!oldAutoHost.equals(_ntcpAutoIP)) || ! oldNHost.equalsIgnoreCase(_ntcpHostname)) {
if ("false".equals(_ntcpAutoIP) && _ntcpHostname.length() > 0) {
if ("disabled".equals(_ntcpAutoIP)) {
addFormNotice("Disabling TCP completely");
} else if ("false".equals(_ntcpAutoIP) && _ntcpHostname.length() > 0) {
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME, _ntcpHostname);
addFormNotice("Updating inbound TCP address to " + _ntcpHostname);
} else {
@@ -174,6 +176,7 @@ public class ConfigNetHandler extends FormHandler {
addFormNotice("Updating inbound TCP address to auto"); // true or always
}
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP, _ntcpAutoIP);
_context.router().setConfigSetting(TransportManager.PROP_ENABLE_NTCP, "" + !"disabled".equals(_ntcpAutoIP));
restartRequired = true;
}
if (oldAutoPort != _ntcpAutoPort || ! oldNPort.equals(_ntcpPort)) {

View File

@@ -28,14 +28,10 @@ public class ConfigNetHelper extends HelperBase {
}
public String getNtcphostname() {
if (!TransportManager.enableNTCP(_context))
return "\" disabled=\"true";
return _context.getProperty(PROP_I2NP_NTCP_HOSTNAME, "");
}
public String getNtcpport() {
if (!TransportManager.enableNTCP(_context))
return "\" disabled=\"true";
return _context.getProperty(PROP_I2NP_NTCP_PORT, "");
}
@@ -91,8 +87,6 @@ public class ConfigNetHelper extends HelperBase {
}
public String getTcpAutoPortChecked(int mode) {
if (!TransportManager.enableNTCP(_context))
return DISABLED;
String port = _context.getProperty(PROP_I2NP_NTCP_PORT);
boolean specified = port != null && port.length() > 0;
if ((mode == 1 && specified) ||
@@ -102,17 +96,15 @@ public class ConfigNetHelper extends HelperBase {
}
public String getTcpAutoIPChecked(int mode) {
if (!TransportManager.enableNTCP(_context))
return DISABLED;
boolean enabled = TransportManager.enableNTCP(_context);
String hostname = _context.getProperty(PROP_I2NP_NTCP_HOSTNAME);
boolean specified = hostname != null && hostname.length() > 0;
String auto = _context.getProperty(PROP_I2NP_NTCP_AUTO_IP);
if (auto == null)
auto = "false";
if ((mode == 0 && (!specified) && auto.equals("false")) ||
(mode == 1 && specified && auto.equals("false")) ||
(mode == 2 && auto.equals("true")) ||
(mode == 3 && auto.equals("always")))
String auto = _context.getProperty(PROP_I2NP_NTCP_AUTO_IP, "false");
if ((mode == 0 && (!specified) && auto.equals("false") && enabled) ||
(mode == 1 && specified && auto.equals("false") && enabled) ||
(mode == 2 && auto.equals("true") && enabled) ||
(mode == 3 && auto.equals("always") && enabled) ||
(mode == 4 && !enabled))
return CHECKED;
return "";
}