- Simplify bw form

- Add config link to UPnP status
This commit is contained in:
zzz
2009-05-01 15:26:49 +00:00
parent 79a963fcab
commit 0e4c846942
4 changed files with 35 additions and 14 deletions

View File

@ -1,5 +1,6 @@
package net.i2p.router.web;
import net.i2p.data.DataHelper;
import net.i2p.data.RouterAddress;
import net.i2p.router.CommSystemFacade;
import net.i2p.router.LoadTestManager;
@ -158,6 +159,18 @@ public class ConfigNetHelper extends HelperBase {
public String getOutboundRate() {
return "" + _context.bandwidthLimiter().getOutboundKBytesPerSecond();
}
public String getInboundRateBits() {
return kbytesToBits(_context.bandwidthLimiter().getInboundKBytesPerSecond());
}
public String getOutboundRateBits() {
return kbytesToBits(_context.bandwidthLimiter().getOutboundKBytesPerSecond());
}
public String getShareRateBits() {
return kbytesToBits(getShareBandwidth());
}
private String kbytesToBits(int kbytes) {
return DataHelper.formatSize(kbytes * 8 * 1024) + " bits per second";
}
public String getInboundBurstRate() {
return "" + _context.bandwidthLimiter().getInboundBurstKBytesPerSecond();
}
@ -231,7 +244,7 @@ public class ConfigNetHelper extends HelperBase {
buf.append("selected=\"true\" ");
found = true;
}
buf.append(">Up to ").append(val).append("%</option>\n");
buf.append(">").append(val).append("%</option>\n");
}
buf.append("</select>\n");
return buf.toString();

View File

@ -29,20 +29,28 @@
<input type="hidden" name="action" value="blah" />
<b>Bandwidth limiter</b><br />
Inbound rate:
<input name="inboundrate" type="text" size="2" value="<jsp:getProperty name="nethelper" property="inboundRate" />" /> KBps
<p>
<table>
<tr><td><input style="text-align: right; width: 5em;" name="inboundrate" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="inboundRate" />" /> KBps
In <td>(<jsp:getProperty name="nethelper" property="inboundRateBits" />)<br />
<!-- let's keep this simple...
bursting up to
<input name="inboundburstrate" type="text" size="2" value="<jsp:getProperty name="nethelper" property="inboundBurstRate" />" /> KBps for
<input name="inboundburstrate" type="text" size="5" value="<jsp:getProperty name="nethelper" property="inboundBurstRate" />" /> KBps for
<jsp:getProperty name="nethelper" property="inboundBurstFactorBox" /><br />
Outbound rate:
<input name="outboundrate" type="text" size="2" value="<jsp:getProperty name="nethelper" property="outboundRate" />" /> KBps
-->
<tr><td><input style="text-align: right; width: 5em;" name="outboundrate" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="outboundRate" />" /> KBps
Out <td>(<jsp:getProperty name="nethelper" property="outboundRateBits" />)<br />
<!-- let's keep this simple...
bursting up to
<input name="outboundburstrate" type="text" size="2" value="<jsp:getProperty name="nethelper" property="outboundBurstRate" />" /> KBps for
<jsp:getProperty name="nethelper" property="outboundBurstFactorBox" /><br />
<i>KBps = kilobytes per second = 1024 bytes per second = 8192 bits per second.<br />
A negative rate sets the default.</i><br />
Bandwidth share percentage:
<jsp:getProperty name="nethelper" property="sharePercentageBox" /><br />
-->
<tr><td><jsp:getProperty name="nethelper" property="sharePercentageBox" />
Share <td>(<jsp:getProperty name="nethelper" property="shareRateBits" />)<br />
</table>
</p><p>
<% int share = nethelper.getShareBandwidth();
if (share < 12) {
out.print("<b>NOTE</b>: You have configured I2P to share only " + share + "KBps. ");
@ -54,7 +62,7 @@
out.print("The higher the share bandwidth the more you improve your anonymity and help the network.<br />");
}
%>
<p>
</p><p>
<input type="submit" name="save" value="Save changes" /> <input type="reset" value="Cancel" /><br />
<hr />
<!--
@ -70,7 +78,7 @@
<p>
<b>UPnP Configuration:</b><br />
<input type="checkbox" name="upnp" value="true" <jsp:getProperty name="nethelper" property="upnpChecked" /> />
Enable UPnP to open firewall ports
Enable UPnP to open firewall ports <a href="peers.jsp#upnp">UPnP status</a>
</p><p>
<b>IP Configuration:</b><br />
Externally reachable hostname or IP address:<br />
@ -104,7 +112,7 @@
</p><p>
<b>UDP Configuration:</b><br />
Internal UDP port:
<input name ="udpPort" type="text" size="6" value="<jsp:getProperty name="nethelper" property="configuredUdpPort" />" /><br />
<input name ="udpPort" type="text" size="5" maxlength="5" vvalue="<jsp:getProperty name="nethelper" property="configuredUdpPort" />" /><br />
<input type="checkbox" name="requireIntroductions" value="true" <jsp:getProperty name="nethelper" property="requireIntroductionsChecked" /> />
Require SSU introductions
<i>(Enable if you cannot open your firewall)</i>
@ -139,7 +147,7 @@
<i>(currently <jsp:getProperty name="nethelper" property="udpPort" />)</i><br />
<input type="radio" name="ntcpAutoPort" value="1" <%=nethelper.getTcpAutoPortChecked(1) %> />
Specify Port:
<input name ="ntcpport" type="text" size="6" value="<jsp:getProperty name="nethelper" property="ntcpport" />" /><br />
<input name ="ntcpport" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="ntcpport" />" /><br />
</p><p>Hostnames entered here will be published in the network database.
They are <b>not private</b>.
Also, <b>do not enter a private IP address</b> like 127.0.0.1 or 192.168.1.1.

View File

@ -403,7 +403,7 @@ public class UPnP extends ControlPoint implements DeviceChangeListener {
public String renderStatusHTML() {
final StringBuilder sb = new StringBuilder();
sb.append("<b>UPnP Status:</b><br />");
sb.append("<a name=\"upnp\"><b>UPnP Status:</b><br />");
if(isDisabled) {
sb.append("The plugin has been disabled; Do you have more than one UPnP Internet Gateway Device on your LAN ?");

View File

@ -139,7 +139,7 @@ public class UPnPManager {
public String renderStatusHTML() {
if (!_isRunning)
return "<b>UPnP is not enabled</b>\n";
return "<a name=\"upnp\"><<b>UPnP is not enabled</b>\n";
return _upnp.renderStatusHTML();
}
}