add ipv6 to /confignet

This commit is contained in:
zzz
2013-06-29 15:13:05 +00:00
parent 79f8e88e5f
commit 3aafea0d98
4 changed files with 64 additions and 3 deletions

View File

@ -7,11 +7,15 @@ import net.i2p.data.RouterAddress;
import net.i2p.router.CommSystemFacade;
import net.i2p.router.Router;
import net.i2p.router.transport.TransportManager;
import net.i2p.router.transport.TransportUtil;
import net.i2p.router.transport.udp.UDPTransport;
import net.i2p.util.Addresses;
/**
*
* Used for both /config and /confignet
*/
public class ConfigNetHelper extends HelperBase {
public ConfigNetHelper() {}
/** copied from various private components */
public final static String PROP_I2NP_NTCP_HOSTNAME = "i2np.ntcp.hostname";
@ -19,6 +23,7 @@ public class ConfigNetHelper extends HelperBase {
public final static String PROP_I2NP_NTCP_AUTO_PORT = "i2np.ntcp.autoport";
public final static String PROP_I2NP_NTCP_AUTO_IP = "i2np.ntcp.autoip";
private final static String CHECKED = " checked=\"checked\" ";
public String getUdphostname() {
return _context.getProperty(UDPTransport.PROP_EXTERNAL_HOST, "");
}
@ -152,6 +157,23 @@ public class ConfigNetHelper extends HelperBase {
return CHECKED;
}
}
/**
* Combined SSU/NTCP
* Use SSU setting, then NTCP setting, then default
* @since IPv6
*/
public String getIPv6Checked(String mode) {
String s = _context.getProperty(TransportUtil.SSU_IPV6_CONFIG);
if (s == null) {
s = _context.getProperty(TransportUtil.NTCP_IPV6_CONFIG);
if (s == null)
s = TransportUtil.DEFAULT_IPV6_CONFIG.toConfigString();
}
if (s.equals(mode))
return CHECKED;
return "";
}
public String[] getAddresses() {
ArrayList<String> al = new ArrayList(Addresses.getAddresses());