Transport: Add config to force IPv4 (only) to firewalled (ticket #1541)

since we cannot reliably detect DS-lite (ticket #1458)
Hide transport status on /peers unless routerconsole.advanced
This commit is contained in:
zzz
2015-05-06 01:45:33 +00:00
parent 31435685bf
commit abd8ca34dc
8 changed files with 83 additions and 15 deletions

View File

@@ -50,6 +50,7 @@ public class ConfigNetHandler extends FormHandler {
private boolean _ratesOnly;
private boolean _udpDisabled;
private String _ipv6Mode;
private boolean _ipv4Firewalled;
private final Map<String, String> changes = new HashMap<String, String>();
private static final String PROP_HIDDEN = Router.PROP_HIDDEN_HIDDEN; // see Router for other choice
@@ -79,8 +80,12 @@ public class ConfigNetHandler extends FormHandler {
public void setNtcpAutoPort(String mode) {
_ntcpAutoPort = mode.equals("2");
}
public void setUpnp(String moo) { _upnp = true; }
public void setLaptop(String moo) { _laptop = true; }
/** @since 0.9.20 */
public void setIPv4Firewalled(String moo) { _ipv4Firewalled = true; }
public void setHostname(String hostname) {
_hostname = (hostname != null ? hostname.trim() : null);
@@ -348,6 +353,16 @@ public class ConfigNetHandler extends FormHandler {
}
changes.put(UDPTransport.PROP_LAPTOP_MODE, "" + _laptop);
if (Boolean.parseBoolean(_context.getProperty(TransportUtil.PROP_IPV4_FIREWALLED)) !=
_ipv4Firewalled) {
if (_ipv4Firewalled)
addFormNotice(_("Disabling inbound IPv4"));
else
addFormNotice(_("Enabling inbound IPv4"));
restartRequired = true;
}
changes.put(TransportUtil.PROP_IPV4_FIREWALLED, "" + _ipv4Firewalled);
if (_context.getBooleanPropertyDefaultTrue(TransportManager.PROP_ENABLE_UDP) !=
!_udpDisabled) {
if (_udpDisabled)

View File

@@ -93,6 +93,11 @@ public class ConfigNetHelper extends HelperBase {
return getChecked(UDPTransport.PROP_LAPTOP_MODE);
}
/** @since 0.9.20 */
public String getIPv4FirewalledChecked() {
return getChecked(TransportUtil.PROP_IPV4_FIREWALLED);
}
public String getTcpAutoPortChecked(int mode) {
String port = _context.getProperty(PROP_I2NP_NTCP_PORT);
boolean specified = port != null && port.length() > 0;

View File

@@ -51,6 +51,10 @@
<%=intl._("Laptop mode - Change router identity and UDP port when IP changes for enhanced anonymity")%>
(<i><%=intl._("Experimental")%></i>)
</p><p>
<%=intl._("IPv4 Configuration")%>:<br>
<input type="checkbox" class="optbox" name="IPv4Firewalled" value="true" <jsp:getProperty name="nethelper" property="IPv4FirewalledChecked" /> >
<%=intl._("Disable inbound (Firewalled by Carrier-grade NAT or DS-Lite)")%>
</p><p>
<%=intl._("IPv6 Configuration")%>:<br>
<input type="radio" class="optbox" name="ipv6" value="false" <%=nethelper.getIPv6Checked("false") %> >
<%=intl._("Disable IPv6")%><br>