forked from I2P_Developers/i2p.i2p
More I2PTunnel UI logic into GeneralHelper
This commit is contained in:
@ -286,6 +286,18 @@ public class GeneralHelper {
|
||||
return "127.0.0.1";
|
||||
}
|
||||
|
||||
public int getClientPort(int tunnel) {
|
||||
TunnelController tun = getController(tunnel);
|
||||
if (tun != null && tun.getListenPort() != null) {
|
||||
try {
|
||||
return Integer.parseInt(tun.getListenPort());
|
||||
} catch (NumberFormatException e) {
|
||||
return -1;
|
||||
}
|
||||
} else
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getTunnelStatus(int tunnel) {
|
||||
TunnelController tun = getController(tunnel);
|
||||
if (tun == null) return NOT_RUNNING;
|
||||
@ -463,6 +475,10 @@ public class GeneralHelper {
|
||||
return getBooleanProperty(tunnel, I2PTunnelIRCClient.PROP_DCC);
|
||||
}
|
||||
|
||||
public boolean isSSLEnabled(int tunnel) {
|
||||
return getBooleanProperty(tunnel, I2PTunnelServer.PROP_USE_SSL);
|
||||
}
|
||||
|
||||
public String getEncryptKey(int tunnel) {
|
||||
return getProperty(tunnel, "i2cp.leaseSetKey", "");
|
||||
}
|
||||
@ -608,6 +624,10 @@ public class GeneralHelper {
|
||||
return getProperty(tunnel, I2PTunnelHTTPServer.OPT_POST_TOTAL_BAN_TIME, I2PTunnelHTTPServer.DEFAULT_POST_TOTAL_BAN_TIME) / 60;
|
||||
}
|
||||
|
||||
public boolean getRejectInproxy(int tunnel) {
|
||||
return getBooleanProperty(tunnel, I2PTunnelHTTPServer.OPT_REJECT_INPROXY);
|
||||
}
|
||||
|
||||
public boolean getUniqueLocal(int tunnel) {
|
||||
return getBooleanProperty(tunnel, I2PTunnelServer.PROP_UNIQUE_LOCAL);
|
||||
}
|
||||
|
@ -60,11 +60,7 @@ public class EditBean extends IndexBean {
|
||||
}
|
||||
|
||||
public String getSpoofedHost(int tunnel) {
|
||||
TunnelController tun = getController(tunnel);
|
||||
if (tun != null && tun.getSpoofedHost() != null)
|
||||
return DataHelper.escapeHTML(tun.getSpoofedHost());
|
||||
else
|
||||
return "";
|
||||
return DataHelper.escapeHTML(_helper.getSpoofedHost(tunnel));
|
||||
}
|
||||
|
||||
public String getPrivateKeyFile(int tunnel) {
|
||||
@ -97,19 +93,11 @@ public class EditBean extends IndexBean {
|
||||
}
|
||||
|
||||
public boolean startAutomatically(int tunnel) {
|
||||
TunnelController tun = getController(tunnel);
|
||||
if (tun != null)
|
||||
return tun.getStartOnLoad();
|
||||
else
|
||||
return false;
|
||||
return _helper.shouldStartAutomatically(tunnel);
|
||||
}
|
||||
|
||||
public boolean isSharedClient(int tunnel) {
|
||||
TunnelController tun = getController(tunnel);
|
||||
if (tun != null)
|
||||
return Boolean.parseBoolean(tun.getSharedClient());
|
||||
else
|
||||
return false;
|
||||
return _helper.isSharedClient(tunnel);
|
||||
}
|
||||
|
||||
public boolean shouldDelay(int tunnel) {
|
||||
|
@ -329,11 +329,8 @@ public class IndexBean {
|
||||
* No validation
|
||||
*/
|
||||
public String getClientPort(int tunnel) {
|
||||
TunnelController tun = getController(tunnel);
|
||||
if (tun != null && tun.getListenPort() != null)
|
||||
return tun.getListenPort();
|
||||
else
|
||||
return "";
|
||||
int port = _helper.getClientPort(tunnel);
|
||||
return port > 0 ? Integer.toString(port) : "";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -667,12 +664,7 @@ public class IndexBean {
|
||||
|
||||
/** @since 0.9.9 */
|
||||
public boolean isSSLEnabled(int tunnel) {
|
||||
TunnelController tun = getController(tunnel);
|
||||
if (tun != null) {
|
||||
Properties opts = tun.getClientOptionProps();
|
||||
return Boolean.parseBoolean(opts.getProperty(I2PTunnelServer.PROP_USE_SSL));
|
||||
}
|
||||
return false;
|
||||
return _helper.isSSLEnabled(tunnel);
|
||||
}
|
||||
|
||||
/** @since 0.9.12 */
|
||||
@ -682,12 +674,7 @@ public class IndexBean {
|
||||
|
||||
/** @since 0.9.12 */
|
||||
public boolean isRejectInproxy(int tunnel) {
|
||||
TunnelController tun = getController(tunnel);
|
||||
if (tun != null) {
|
||||
Properties opts = tun.getClientOptionProps();
|
||||
return Boolean.parseBoolean(opts.getProperty(I2PTunnelHTTPServer.OPT_REJECT_INPROXY));
|
||||
}
|
||||
return false;
|
||||
return _helper.getRejectInproxy(tunnel);
|
||||
}
|
||||
|
||||
/** @since 0.9.13 */
|
||||
|
Reference in New Issue
Block a user