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";
|
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) {
|
public int getTunnelStatus(int tunnel) {
|
||||||
TunnelController tun = getController(tunnel);
|
TunnelController tun = getController(tunnel);
|
||||||
if (tun == null) return NOT_RUNNING;
|
if (tun == null) return NOT_RUNNING;
|
||||||
@ -463,6 +475,10 @@ public class GeneralHelper {
|
|||||||
return getBooleanProperty(tunnel, I2PTunnelIRCClient.PROP_DCC);
|
return getBooleanProperty(tunnel, I2PTunnelIRCClient.PROP_DCC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSSLEnabled(int tunnel) {
|
||||||
|
return getBooleanProperty(tunnel, I2PTunnelServer.PROP_USE_SSL);
|
||||||
|
}
|
||||||
|
|
||||||
public String getEncryptKey(int tunnel) {
|
public String getEncryptKey(int tunnel) {
|
||||||
return getProperty(tunnel, "i2cp.leaseSetKey", "");
|
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;
|
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) {
|
public boolean getUniqueLocal(int tunnel) {
|
||||||
return getBooleanProperty(tunnel, I2PTunnelServer.PROP_UNIQUE_LOCAL);
|
return getBooleanProperty(tunnel, I2PTunnelServer.PROP_UNIQUE_LOCAL);
|
||||||
}
|
}
|
||||||
|
@ -60,11 +60,7 @@ public class EditBean extends IndexBean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getSpoofedHost(int tunnel) {
|
public String getSpoofedHost(int tunnel) {
|
||||||
TunnelController tun = getController(tunnel);
|
return DataHelper.escapeHTML(_helper.getSpoofedHost(tunnel));
|
||||||
if (tun != null && tun.getSpoofedHost() != null)
|
|
||||||
return DataHelper.escapeHTML(tun.getSpoofedHost());
|
|
||||||
else
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPrivateKeyFile(int tunnel) {
|
public String getPrivateKeyFile(int tunnel) {
|
||||||
@ -97,19 +93,11 @@ public class EditBean extends IndexBean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean startAutomatically(int tunnel) {
|
public boolean startAutomatically(int tunnel) {
|
||||||
TunnelController tun = getController(tunnel);
|
return _helper.shouldStartAutomatically(tunnel);
|
||||||
if (tun != null)
|
|
||||||
return tun.getStartOnLoad();
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSharedClient(int tunnel) {
|
public boolean isSharedClient(int tunnel) {
|
||||||
TunnelController tun = getController(tunnel);
|
return _helper.isSharedClient(tunnel);
|
||||||
if (tun != null)
|
|
||||||
return Boolean.parseBoolean(tun.getSharedClient());
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldDelay(int tunnel) {
|
public boolean shouldDelay(int tunnel) {
|
||||||
|
@ -329,11 +329,8 @@ public class IndexBean {
|
|||||||
* No validation
|
* No validation
|
||||||
*/
|
*/
|
||||||
public String getClientPort(int tunnel) {
|
public String getClientPort(int tunnel) {
|
||||||
TunnelController tun = getController(tunnel);
|
int port = _helper.getClientPort(tunnel);
|
||||||
if (tun != null && tun.getListenPort() != null)
|
return port > 0 ? Integer.toString(port) : "";
|
||||||
return tun.getListenPort();
|
|
||||||
else
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -667,12 +664,7 @@ public class IndexBean {
|
|||||||
|
|
||||||
/** @since 0.9.9 */
|
/** @since 0.9.9 */
|
||||||
public boolean isSSLEnabled(int tunnel) {
|
public boolean isSSLEnabled(int tunnel) {
|
||||||
TunnelController tun = getController(tunnel);
|
return _helper.isSSLEnabled(tunnel);
|
||||||
if (tun != null) {
|
|
||||||
Properties opts = tun.getClientOptionProps();
|
|
||||||
return Boolean.parseBoolean(opts.getProperty(I2PTunnelServer.PROP_USE_SSL));
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @since 0.9.12 */
|
/** @since 0.9.12 */
|
||||||
@ -682,12 +674,7 @@ public class IndexBean {
|
|||||||
|
|
||||||
/** @since 0.9.12 */
|
/** @since 0.9.12 */
|
||||||
public boolean isRejectInproxy(int tunnel) {
|
public boolean isRejectInproxy(int tunnel) {
|
||||||
TunnelController tun = getController(tunnel);
|
return _helper.getRejectInproxy(tunnel);
|
||||||
if (tun != null) {
|
|
||||||
Properties opts = tun.getClientOptionProps();
|
|
||||||
return Boolean.parseBoolean(opts.getProperty(I2PTunnelHTTPServer.OPT_REJECT_INPROXY));
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @since 0.9.13 */
|
/** @since 0.9.13 */
|
||||||
|
Reference in New Issue
Block a user