java.lang.Object
net.i2p.router.web.HelperBase
net.i2p.router.web.helpers.ConfigNetHelper
Helper for network configuration page rendering and form processing. Used for both /config and /confignet pages.
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault share bandwidth in KBps.(package private) static final StringNTCP auto IP property.(package private) static final StringNTCP auto port property.(package private) static final StringCopied from various private components.(package private) static final StringNTCP port property.Fields inherited from class HelperBase
_context, _log, _out, CHECKED, PROP_ADVANCED, SELECTEDModifier and TypeFieldDescriptionprotected RouterContextThe router context.protected LogThe log instance.protected WriterThe writer for output.static final StringChecked attribute for HTML checkboxes.static final StringProperty key for advanced mode.static final StringSelected attribute for HTML select options.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionGet the set of addresses.Get the HTML for an address selector input.This should always be the actual internal SSU port, as UDPTransport updates the config when it changes.Get checked attribute for dynamic keys.Get the inbound burst rate as a decimal.Get the inbound burst rate in bits as a decimal.Get the inbound rate as a decimal.Get checked attribute for IPv4 firewalled setting.getIPv6Checked(String mode) Combined SSU/NTCP Use SSU setting, then NTCP setting, then default.Get checked attribute for IPv6 firewalled setting.Get checked attribute for laptop mode.Get the NTCP hostname.Get the NTCP port.Get the outbound burst rate as a decimal.Get the outbound burst rate in bits as a decimal.Get the outbound rate as a decimal.intGet the share bandwidth.Get the share percentage selection box HTML.Get the share rate in bits as a decimal.Get the share rate in megabits as a decimal.getTcpAutoIPChecked(int mode) Get checked attribute for TCP auto IP.getTcpAutoPortChecked(int mode) Get checked attribute for TCP auto port.getUdpAutoIPChecked(int mode) Get checked attribute for UDP auto IP.Default false, inverse of default true property.Default true.Get the external UDP hostname.getUdpIP()Get the UDP IP address.To reduce confusion caused by NATs, this is the current internal SSU port, not the external port.Whether UPnP is enabled.private StringkbytesToBits(float kbytes) Convert KB/s to a bit-rate string.Methods inherited from class HelperBase
_t, _t, _t, _x, getChecked, isAdvanced, ngettext, setContextId, storeWriterModifier and TypeMethodDescriptionTranslate a string.Translate a string with a parameter.Translate a string with two parameters.static StringMark a string for extraction by xgettext and translation.protected StringgetChecked(String prop) Get the checked attribute for a boolean property.booleanCheck if advanced mode is enabled.Translate a string with plural forms (ngettext).voidsetContextId(String contextId) Configure this bean to query a particular router context.voidstoreWriter(Writer out) Store the writer for output.
Field Details
PROP_I2NP_NTCP_HOSTNAME
Copied from various private components.- See Also:
PROP_I2NP_NTCP_PORT
PROP_I2NP_NTCP_AUTO_PORT
PROP_I2NP_NTCP_AUTO_IP
DEFAULT_SHARE_KBPS
public static final int DEFAULT_SHARE_KBPSDefault share bandwidth in KBps.- See Also:
Constructor Details
ConfigNetHelper
public ConfigNetHelper()Creates a new instance of the network configuration helper.
Method Details
getUdphostname
Get the external UDP hostname.- Returns:
- the configured external host, which may list several entries separated by commas, semicolons or whitespace; empty if unset
getNtcphostname
Get the NTCP hostname.- Returns:
- the configured NTCP host; empty if unset
getNtcpport
Get the NTCP port.- Returns:
- the configured NTCP port, unparsed; empty if unset
getUdpIP
getUdpPort
To reduce confusion caused by NATs, this is the current internal SSU port, not the external port.- Returns:
- the internal SSU port
getConfiguredUdpPort
This should always be the actual internal SSU port, as UDPTransport updates the config when it changes.- Returns:
- the configured SSU port
getDynamicKeysChecked
Get checked attribute for dynamic keys.- Returns:
- the checked attribute
getLaptopChecked
getIPv4FirewalledChecked
Get checked attribute for IPv4 firewalled setting.- Returns:
- the checked attribute
getIPv6FirewalledChecked
Get checked attribute for IPv6 firewalled setting.- Returns:
- the checked attribute
getTcpAutoPortChecked
Get checked attribute for TCP auto port.- Parameters:
mode- the mode to check- Returns:
- the checked attribute
getTcpAutoIPChecked
Get checked attribute for TCP auto IP.- Parameters:
mode- the mode to check- Returns:
- the checked attribute
getUdpAutoIPChecked
Get checked attribute for UDP auto IP.- Parameters:
mode- the mode to check- Returns:
- the checked attribute
getUpnpChecked
Whether UPnP is enabled.- Returns:
- the checked attribute if UPnP is enabled
getUdpDisabledChecked
Default false, inverse of default true property.- Returns:
- the checked attribute if UDP is disabled
getUdpEnabledChecked
getIPv6Checked
getAddresses
getAddressSelector
Get the HTML for an address selector input.- Returns:
- the HTML for the address selector
getInboundRate
Get the inbound rate as a decimal.- Returns:
- the inbound rate in kB/s, where kB is 1000 bytes, rounded to a whole number
getOutboundRate
Get the outbound rate as a decimal.- Returns:
- the outbound rate in kB/s, where kB is 1000 bytes, rounded to a whole number
getInboundBurstRateBits
Get the inbound burst rate in bits as a decimal.- Returns:
- an HTML fragment showing the inbound burst rate in bps alongside the monthly data transfer it would allow
getOutboundBurstRateBits
Get the outbound burst rate in bits as a decimal.- Returns:
- an HTML fragment showing the outbound burst rate in bps alongside the monthly data transfer it would allow
kbytesToBits
Convert KB/s to a bit-rate string.- Parameters:
kbytes- the rate in binary kilobytes per second- Returns:
- the formatted rate and monthly data HTML span
getInboundBurstRate
Get the inbound burst rate as a decimal.- Returns:
- the inbound burst rate in kB/s, where kB is 1000 bytes, rounded to a whole number
getOutboundBurstRate
Get the outbound burst rate as a decimal.- Returns:
- the outbound burst rate in kB/s, where kB is 1000 bytes, rounded to a whole number