<%
                String tunnelTypeName;
                String tunnelType;
                if (curTunnel >= 0) {
                    tunnelTypeName = editBean.getTunnelType(curTunnel);
                    tunnelType = editBean.getInternalType(curTunnel);
                  %><h2><%=intl._t("Edit Server Settings")%> (<%=editBean.getTunnelName(curTunnel)%>)</h2><% 
                } else {
                    tunnelTypeName = editBean.getTypeName(request.getParameter("type"));
                    tunnelType = net.i2p.data.DataHelper.stripHTML(request.getParameter("type"));
                  %><h2><%=intl._t("New Server Settings")%></h2><% 
                } %>
                <input type="hidden" name="tunnel" value="<%=curTunnel%>" />
                <input type="hidden" name="nonce" value="<%=net.i2p.i2ptunnel.web.IndexBean.getNextNonce()%>" />
                <input type="hidden" name="type" value="<%=tunnelType%>" />
<%
                // these are four keys that are generated automatically on first save,
                // and we want to persist in i2ptunnel.config, but don't want to
                // show clogging up the custom options form.
                String key = editBean.getKey1(curTunnel);
                if (key != null && key.length() > 0) { %>
                    <input type="hidden" name="key1" value="<%=key%>" />
<%              }
                key = editBean.getKey2(curTunnel);
                if (key != null && key.length() > 0) { %>
                    <input type="hidden" name="key2" value="<%=key%>" />
<%              }
                key = editBean.getKey3(curTunnel);
                if (key != null && key.length() > 0) { %>
                    <input type="hidden" name="key3" value="<%=key%>" />
<%              }
                key = editBean.getKey4(curTunnel);
                if (key != null && key.length() > 0) { %>
                    <input type="hidden" name="key4" value="<%=key%>" />
<%              } %>
                <input type="submit" class="default" name="action" value="Save changes" />
    <table id="serverTunnelEdit" class="tunnelConfig">
        <tr>
            <th class="tunnelNameLabel excludeBackgroundImage">
                <%=intl._t("Name")%>
            </th><th class="excludeBackgroundImage">
                <%=intl._t("Type")%>
            </th>
        </tr><tr>
            <td>
                <input type="text" size="30" maxlength="50" name="nofilter_name" title="<%=intl._t("Name of tunnel to be displayed on Tunnel Manager home page and the router console sidebar")%>" value="<%=editBean.getTunnelName(curTunnel)%>" class="freetext tunnelName" />
            </td><td>
                <%=tunnelTypeName%>
            </td>
        </tr><tr>
            <th>
                <%=intl._t("Description")%>
            </th><th class="excludeBackgroundImage">
                <%=intl._t("Auto Start Tunnel")%>
            </th>
        </tr><tr>
            <td>
                <input type="text" size="60" maxlength="80" name="nofilter_description" title="<%=intl._t("Description of tunnel to be displayed on Tunnel Manager home page")%>" value="<%=editBean.getTunnelDescription(curTunnel)%>" class="freetext tunnelDescriptionText" />
            </td><td>
                <label title="<%=intl._t("Enable this option to ensure this service is available when the router starts")%>"><input value="1" type="checkbox" name="startOnLoad"<%=(editBean.startAutomatically(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
                <%=intl._t("Automatically start tunnel when router starts")%></label>
            </td>
        </tr><tr>
<%
            String stopFirst = intl._t("The hidden service must be stopped to change this setting");
            String tstopFirst = " title=\"" + stopFirst + "\" ";
            boolean canChangeDest = editBean.canChangePort(curTunnel);
            boolean isStreamrServer = "streamrserver".equals(tunnelType);
            boolean isBidirServer = "httpbidirserver".equals(tunnelType);
            boolean canChangePort = canChangeDest || !(isStreamrServer || isBidirServer);
            String phdisabled = canChangePort ? "" : tstopFirst;
%>
            <th colspan="2" <%=phdisabled%>>
<%
            if (isStreamrServer) { %>
                <%=intl._t("Access Point")%>
         <% } else { %>
                <%=intl._t("Target")%>
         <% } %>
            </th>
        </tr><tr>
<%
            if (!isStreamrServer) {
%>
            <td>
                <b><%=intl._t("Host")%>:</b>
                <input type="text" size="20" name="targetHost" title="<%=intl._t("Hostname or IP address of the target server")%>" value="<%=editBean.getTargetHost(curTunnel)%>" class="freetext host" />
            </td>
<%          } /* !streamrserver */ %>
            <td>
                <b><%=intl._t("Port")%>:</b>
<%
                       String asphelp = intl._t("Specify the local port this service should be accessible from");
                       String bsphelp = intl._t("Specify the port the server is running on");
                       String ptext = canChangePort ? (isStreamrServer ? asphelp : bsphelp) : stopFirst;
                       String pdisabled = canChangePort ? "" : " readonly=\"readonly\" ";
%>
                <input type="text" size="6" maxlength="5" id="targetPort" name="targetPort" title="<%=ptext%>" value="<%=editBean.getTargetPort(curTunnel)%>" class="freetext port" placeholder="<%=intl._t("required")%>" required <%=pdisabled%> />
<%          if (!isStreamrServer) { %>
                <label title="<%=intl._t("To avoid traffic sniffing if connecting to a remote server, you can enable an SSL connection. Note that the target server must be configured to accept SSL connections.")%>"><input value="1" type="checkbox" name="useSSL"<%=(editBean.isSSLEnabled(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
                <%=intl._t("Use SSL to connect to target")%></label>
<%          } /* !streamrserver */ %>
            </td>
<%          if (isBidirServer) { %>
        </tr><tr>
            <th colspan="2" <%=phdisabled%>>
                <%=intl._t("Access Point")%>
            </th>
        </tr><tr>
            <td>
                <b><%=intl._t("Port")%>:</b>

<%
                       String csphelp = intl._t("Port required to access service (this can be a different port to the port the service is hosted on)");
                       String dsphelp = canChangePort ? csphelp : stopFirst;
%>
                 <input type="text" size="6" maxlength="5" name="port" title="<%=dsphelp%>" value="<%=editBean.getClientPort(curTunnel)%>" class="freetext port" placeholder="<%=intl._t("required")%>" required <%=pdisabled%> />
            </td>
<%          } /* httpbidirserver */
            if (isBidirServer || isStreamrServer) {
%>
            <td>
                <b><%=intl._t("Reachable by")%>:</b>
<%
                       String esphelp = intl._t("Listening interface (IP address) for client access (normally 127.0.0.1)");
                       String fsphelp = canChangePort ? esphelp : stopFirst;
%>
                <select id="reachableBy" name="reachableBy" title="<%=fsphelp%>" class="selectbox">
<%
                    String clientInterface = editBean.getClientInterface(curTunnel);
                    for (String ifc : editBean.interfaceSet()) {
                        out.write("<option value=\"");
                        out.write(ifc);
                        out.write('\"');
                        if (ifc.equals(clientInterface))
                            out.write(" selected=\"selected\"");
                        else if (!canChangePort)
                            out.write(" disabled=\"disabled\"");
                        out.write('>');
                        out.write(ifc);
                        out.write("</option>\n");
                    }
%>
                </select>
            </td>
         <% } /* httpbidirserver || streamrserver */ %>
        </tr>
<%          if ("httpserver".equals(tunnelType) || isBidirServer) {
%>
        <tr>
            <th>
                <%=intl._t("Website Hostname")%>
            </th>
            <th class="excludeBackgroundImage"></th>
        </tr><tr>
            <td colspan="2">
                <input type="text" size="20" id="websiteName" name="spoofedHost" title="<%=intl._t("Website Hostname e.g. mysite.i2p")%>" value="<%=editBean.getSpoofedHost(curTunnel)%>" class="freetext" />
                <%=intl._t("(leave blank for outproxies)")%>
            </td>
        </tr>
            <% }
          %>
        <tr>
            <th>
                <%=intl._t("Local destination")%>
<%
                       String dhdisable = canChangeDest ? "" : tstopFirst;
%>
            </th><th class="excludeBackgroundImage" <%=dhdisable%>>
                <%=intl._t("Private key file")%>
            </th>
        </tr><tr>
            <td>
                <div class="displayText resetScrollLeft" title="<%=intl._t("Read Only: Local Destination (if known)")%>" tabindex="0"><%=editBean.getDestinationBase64(curTunnel)%></div>
            </td><td>
<%
                       String htext = intl._t("Path to Private Key File");
                       String dtext = canChangeDest ? htext : stopFirst;
                       String ddisabled = canChangeDest ? "" : " readonly=\"readonly\" ";
%>
                <input type="text" size="30" id="privKeyFile" name="privKeyFile" title="<%=dtext%>" value="<%=editBean.getPrivateKeyFile(curTunnel)%>" class="freetext" placeholder="<%=intl._t("required")%>" required <%=ddisabled%> />
            </td>
        </tr>
<%
  /******
               if ("httpserver".equals(tunnelType) || isBidirServer) {
                   String sig = editBean.getNameSignature(curTunnel);
                   if (sig.length() > 0) {
          %><div id="sigField" class="rowItem">
                    <%=intl._t("Hostname Signature")%>
                <input type="text" size="30" readonly="readonly" title="<%=intl._t("Use to prove that the website name is for this destination")%>" value="<%=sig%>" wrap="off" class="freetext" />
            </div>
         <%
                   }  // sig
               }  // type
  ****/

            String b64 = editBean.getDestinationBase64(curTunnel);
            net.i2p.util.PortMapper pm = net.i2p.I2PAppContext.getGlobalContext().portMapper();
            boolean hasImagegen = pm.getPort(net.i2p.util.PortMapper.SVC_IMAGEGEN) > 0;
            boolean hasSusiDNS = pm.getPort(net.i2p.util.PortMapper.SVC_SUSIDNS) > 0;
            if (!"".equals(b64)) {
%>
        <tr>
<%
                b64 = b64.replace("=", "%3d");
                String name = editBean.getSpoofedHost(curTunnel);
                if (name == null || name.equals(""))
                    name = editBean.getTunnelName(curTunnel);
                // mysite.i2p is set in the installed i2ptunnel.config
                if (name != null && !name.equals("") && !name.equals("mysite.i2p") && !name.contains(" ") && name.endsWith(".i2p")) {
%>

            <td class="buttons" colspan="2">
<%
                    if (hasImagegen) {
%>
              <a class="control" title="<%=intl._t("Generate a QR Code for this domain")%>" href="/imagegen/qr?s=320&amp;t=<%=name%>&amp;c=http%3a%2f%2f<%=name%>%2f%3fi2paddresshelper%3d<%=b64%>" target="_top"><%=intl._t("Generate QR Code")%></a>
<%
                    }
                    if (hasSusiDNS) {
%>
              <a class="control" title="<%=intl._t("Add to Private addressbook")%>" href="/susidns/addressbook.jsp?book=private&amp;hostname=<%=name%>&amp;destination=<%=b64%>#add"><%=intl._t("Add to local addressbook")%></a>
<%
                    }
%>
              <a class="control" title="<%=intl._t("Register, unregister or change details for hostname")%>" href="register?tunnel=<%=curTunnel%>"><%=intl._t("Registration Authentication")%></a>
<%
                    if ("httpserver".equals(tunnelType) || isBidirServer) {
%>
              <a class="control" title="<%=intl._t("HTTPS configuration")%>" href="ssl?tunnel=<%=curTunnel%>"><%=intl._t("SSL Wizard")%></a>
<%
                    }
%>
            </td>
<%
                } else {
%>
            <td class="infohelp" colspan="2">
                <%=intl._t("Note: In order to enable QR code generation or registration authentication, configure the Website Hostname field (for websites) or the Name field (everything else) above with an .i2p suffixed hostname e.g. mynewserver.i2p")%>
            </td>
<%
                }  // name
%>
        </tr>
<%
            }  // b64

%>
    </table>

    <h3><%=intl._t("Advanced networking options")%></h3>

    <table class="tunnelConfig" id="lengthOption">
        <tr>
            <th colspan="2" class="tableTop">
                <%=intl._t("Tunnel Length Options")%>
            </th>
        </tr>
<%     if (editBean.isAdvanced()) {
      %><tr>
            <th colspan="2">
                <%=intl._t("Inbound")%>
            </th>
        </tr><%
      }  // isAdvanced()
%>

        <tr>
            <td>
                <b><%=intl._t("Length")%></b>
            </td><td>
                <b><%=intl._t("Variance")%></b>
            </td>
        </tr><tr>
            <td>
                <select id="tunnelDepth" name="tunnelDepth" title="<%=intl._t("Length of each Tunnel")%>" class="selectbox">
                    <% int tunnelDepth = editBean.getTunnelDepth(curTunnel, 3);
                  %><option value="0"<%=(tunnelDepth == 0 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 0)%><%=editBean.unlessAdvanced("no anonymity")%></option>
                    <option value="1"<%=(tunnelDepth == 1 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 1)%><%=editBean.unlessAdvanced("low anonymity")%></option>
                    <option value="2"<%=(tunnelDepth == 2 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 2)%><%=editBean.unlessAdvanced("medium anonymity")%></option>
                    <option value="3"<%=(tunnelDepth == 3 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 3)%><%=editBean.unlessAdvanced("high anonymity")%></option>
<%                 if (editBean.isAdvanced()) {
                  %><option value="4"<%=(tunnelDepth == 4 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 4)%></option>
                    <option value="5"<%=(tunnelDepth == 5 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 5)%></option>
                    <option value="6"<%=(tunnelDepth == 6 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 6)%></option>
                    <option value="7"<%=(tunnelDepth == 7 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 7)%></option>
<%                 } else if (tunnelDepth > 3) { 
                %>    <option value="<%=tunnelDepth%>" selected="selected"><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", tunnelDepth)%></option>
<%                 }
              %></select>
            </td><td>
                <select id="tunnelVariance" name="tunnelVariance" title="<%=intl._t("Level of Randomization for Tunnel Depth")%>" class="selectbox">
                    <% int tunnelVariance = editBean.getTunnelVariance(curTunnel, 0);
                  %><option value="0"<%=(tunnelVariance  ==  0 ? " selected=\"selected\"" : "") %>><%=intl._t("0 hop variance")%><%=editBean.unlessAdvanced("no randomization, consistent performance")%></option>
                    <option value="1"<%=(tunnelVariance  ==  1 ? " selected=\"selected\"" : "") %>><%=intl._t("+ 0-1 hop variance")%><%=editBean.unlessAdvanced("medium randomization, lower performance")%></option>
                    <option value="2"<%=(tunnelVariance  ==  2 ? " selected=\"selected\"" : "") %>><%=intl._t("+ 0-2 hop variance")%><%=editBean.unlessAdvanced("high randomization, very low performance")%></option>
                    <option value="-1"<%=(tunnelVariance == -1 ? " selected=\"selected\"" : "") %>><%=intl._t("+/- 0-1 hop variance")%><%=editBean.unlessAdvanced("standard randomization, standard performance")%></option>
                    <option value="-2"<%=(tunnelVariance == -2 ? " selected=\"selected\"" : "") %>><%=intl._t("+/- 0-2 hop variance")%><%=editBean.unlessAdvanced("not recommended")%></option>
<%                 if (tunnelVariance > 2 || tunnelVariance < -2) {
                %>    <option value="<%=tunnelVariance%>" selected="selected"><%= (tunnelVariance > 2 ? "+ " : "+/- ") %>0-<%=tunnelVariance%> <%=intl._t("hop variance")%></option>
<%                 }
              %></select>
            </td>
        </tr>
        <%     if (editBean.isAdvanced()) {
       // repeat two options above for outbound
      %><tr>
            <th colspan="2">
                <%=intl._t("Outbound")%>
            </th>
        </tr><tr>
            <td>
                <b><%=intl._t("Length")%></b>
            </td><td>
                <b><%=intl._t("Variance")%></b>
            </td>
        </tr><tr>
            <td>
                <select id="tunnelDepthOut" name="tunnelDepthOut" title="<%=intl._t("Length of each Tunnel")%>" class="selectbox">
                    <% int tunnelDepthOut = editBean.getTunnelDepthOut(curTunnel, 3);
                  %><option value="0"<%=(tunnelDepthOut == 0 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 0)%></option>
                    <option value="1"<%=(tunnelDepthOut == 1 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 1)%></option>
                    <option value="2"<%=(tunnelDepthOut == 2 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 2)%></option>
                    <option value="3"<%=(tunnelDepthOut == 3 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 3)%></option>
                    <option value="4"<%=(tunnelDepthOut == 4 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 4)%></option>
                    <option value="5"<%=(tunnelDepthOut == 5 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 5)%></option>
                    <option value="6"<%=(tunnelDepthOut == 6 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 6)%></option>
                    <option value="7"<%=(tunnelDepthOut == 7 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} hop tunnel", "{0} hop tunnel", 7)%></option>
                </select>
            </td><td>
                <select id="tunnelVarianceOut" name="tunnelVarianceOut" title="<%=intl._t("Level of Randomization for Tunnel Depth")%>" class="selectbox">
<%                 int tunnelVarianceOut = editBean.getTunnelVarianceOut(curTunnel, 0);
                  %><option value="0"<%=(tunnelVarianceOut  ==  0 ? " selected=\"selected\"" : "") %>><%=intl._t("0 hop variance")%></option>
                    <option value="1"<%=(tunnelVarianceOut  ==  1 ? " selected=\"selected\"" : "") %>><%=intl._t("+ 0-1 hop variance")%></option>
                    <option value="2"<%=(tunnelVarianceOut  ==  2 ? " selected=\"selected\"" : "") %>><%=intl._t("+ 0-2 hop variance")%></option>
                    <option value="-1"<%=(tunnelVarianceOut == -1 ? " selected=\"selected\"" : "") %>><%=intl._t("+/- 0-1 hop variance")%></option>
                    <option value="-2"<%=(tunnelVarianceOut == -2 ? " selected=\"selected\"" : "") %>><%=intl._t("+/- 0-2 hop variance")%></option>
<%                 if (tunnelVarianceOut > 2 || tunnelVarianceOut < -2) {
                %>    <option value="<%=tunnelVarianceOut%>" selected="selected"><%= (tunnelVarianceOut > 2 ? "+ " : "+/- ") %>0-<%=tunnelVarianceOut%> <%=intl._t("hop variance")%></option>
<%                 }
              %></select>
            </td>
        </tr>
<%
      }  // isAdvanced() End outbound config section
%>
    </table>
    <table class="tunnelConfig" id="quantityOptions">
        <tr>
            <th colspan="2" class="tableTop">
                <%=intl._t("Tunnel Quantity Options")%>
            </th>
        </tr>
        <tr>
<%     if (editBean.isAdvanced()) {
          %><th colspan="2">
                <%=intl._t("Inbound")%>
            </th><%
      }  // isAdvanced()
%>
        </tr><tr>
            <td>
                <b><%=intl._t("Count")%></b>
            </td><td>
                <b><%=intl._t("Backup Count")%></b>
            </td>
        </tr><tr>
            <td>
                <select id="tunnelQuantity" name="tunnelQuantity" title="<%=intl._t("Number of Tunnels in Group")%>" class="selectbox">
                    <%=editBean.getQuantityOptions(curTunnel, editBean.isAdvanced() ? 1 : 0)%>
                </select>
            </td><td>
                <select id="tunnelBackupQuantity" name="tunnelBackupQuantity" title="<%=intl._t("Number of Reserve Tunnels")%>" class="selectbox">
<%                 int tunnelBackupQuantity = editBean.getTunnelBackupQuantity(curTunnel, 0);
                  %><option value="0"<%=(tunnelBackupQuantity == 0 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", 0)%><%=editBean.unlessAdvanced("no redundancy, no added resource usage")%></option>
                    <option value="1"<%=(tunnelBackupQuantity == 1 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", 1)%><%=editBean.unlessAdvanced("low redundancy, low resource usage")%></option>
                    <option value="2"<%=(tunnelBackupQuantity == 2 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", 2)%><%=editBean.unlessAdvanced("medium redundancy, medium resource usage")%></option>
                    <option value="3"<%=(tunnelBackupQuantity == 3 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", 3)%><%=editBean.unlessAdvanced("high redundancy, high resource usage")%></option>
<%
                   if (tunnelBackupQuantity > 3) {
                %>    <option value="<%=tunnelBackupQuantity%>" selected="selected"><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", tunnelBackupQuantity)%></option> 
<%                 }
              %></select>
            </td>
        </tr>

        <%     if (editBean.isAdvanced()) {
       // repeat two options above for outbound
        %><tr>
            <th colspan="2">
                <%=intl._t("Outbound")%>
            </th>
        </tr><tr>
            <td>
                <b><%=intl._t("Count")%></b>
            </td><td>
                <b><%=intl._t("Backup Count")%></b>
            </td>
        </tr><tr>
            <td>
                <select id="tunnelQuantityOut" name="tunnelQuantityOut" title="<%=intl._t("Number of Tunnels in Group")%>" class="selectbox">
                    <%=editBean.getQuantityOptions(curTunnel, 2)%>
                </select>
            </td><td>
                <select id="tunnelBackupQuantityOut" name="tunnelBackupQuantityOut" title="<%=intl._t("Number of Reserve Tunnels")%>" class="selectbox">
<%                     int tunnelBackupQuantityOut = editBean.getTunnelBackupQuantityOut(curTunnel, 0);
                  %><option value="0"<%=(tunnelBackupQuantityOut == 0 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", 0)%></option>
                    <option value="1"<%=(tunnelBackupQuantityOut == 1 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", 1)%></option>
                    <option value="2"<%=(tunnelBackupQuantityOut == 2 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", 2)%></option>
                    <option value="3"<%=(tunnelBackupQuantityOut == 3 ? " selected=\"selected\"" : "") %>><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", 3)%></option>
<%                 if (tunnelBackupQuantityOut > 3) {
                %>    <option value="<%=tunnelBackupQuantityOut%>" selected="selected"><%=intl.ngettext("{0} backup tunnel", "{0} backup tunnels", tunnelBackupQuantity)%></option> 
<%                 }
              %></select>
            </td>
        </tr>
<%
      }  // isAdvanced() End outbound config section
%>
<%
            boolean canChangeEncType = editBean.canChangeEncType(curTunnel);
            String ehdisabled = canChangeEncType ? "" : tstopFirst;

            // TODO, encrypted + offline is unimplemented
            if (!editBean.getIsOfflineKeys(curTunnel)) {
%>
    </table>
    <table class="tunnelConfig" id="cryptoOptions">
        <tr>
            <th colspan="2" class="tableTop">
                <%=intl._t("Tunnel Cryptography Options")%>
            </th>
        </tr><tr>
            <th colspan="2">
                <%=intl._t("Encrypt Leaseset")%>
            </th>
        </tr><tr>
            <td colspan="2">
<%
                String curEncryptMode = editBean.getEncryptMode(curTunnel);
                String cdisabled = canChangeEncType ? "" : " disabled=\"disabled\" ";
%>
                <select id="encryptMode" name="encryptMode" class="selectbox" <%=ehdisabled%>>
                <option title="<%=intl._t("Allow all clients to connect to this service")%>" value="0" <%=(curEncryptMode.equals("0") ? " selected=\"selected\"" : cdisabled)%> >
                    <%=intl._t("Disable")%></option>
<%
                if (curEncryptMode.equals("10")) {
%>
                <option title="<%=intl._t("Allow all clients to connect to this service")%>" value="10" <%=(curEncryptMode.equals("10") ? " selected=\"selected\"" : cdisabled)%> >
                    <%=intl._t("Disable")%> (LS2)</option>
<%
                } // mode = 10
%>
                <option title="<%=intl._t("Send key to all users.")%>" value="1" <%=(curEncryptMode.equals("1") ? " selected=\"selected\"" : cdisabled)%> >
                    <%=intl._t("Encrypted")%> (AES)</option>
<%
                int curSigType = editBean.getSigType(curTunnel, tunnelType);
                boolean allowBlinding = (curSigType == 7 || curSigType == 11);
                String bdisabled = (allowBlinding && canChangeEncType) ? "" : " disabled=\"disabled\" ";
                String bidisabled = (allowBlinding && canChangeEncType) ? "" : " readonly=\"readonly\" ";
                if (allowBlinding) {
%>
                <option title="<%=intl._t("Prevents server discovery by floodfills")%>" value="2" <%=(curEncryptMode.equals("2") ? " selected=\"selected\"" : bdisabled)%> >
                    <%=intl._t("Blinded")%></option>
<%
                     if (true /* editBean.isAdvanced() */) {
%>
                <option title="<%=intl._t("Send password to all users.")%>" value="3" <%=(curEncryptMode.equals("3") ? " selected=\"selected\"" : bdisabled)%> >
                    <%=intl._t("Blinded with lookup password")%></option>
                <option title="<%=intl._t("Send key to all users.")%>" value="4" <%=(curEncryptMode.equals("4") ? " selected=\"selected\"" : bdisabled)%> >
                    <%=intl._t("Encrypted")%> (PSK)</option>
                <option title="<%=intl._t("Send key and password to all users.")%>" value="5" <%=(curEncryptMode.equals("5") ? " selected=\"selected\"" : bdisabled)%> >
                    <%=intl._t("Encrypted with lookup password")%> (PSK)</option>
                <option title="<%=intl._t("Send individual key to each user.")%>" value="6" <%=(curEncryptMode.equals("6") ? " selected=\"selected\"" : bdisabled)%> >
                    <%=intl._t("Encrypted with per-user key")%> (PSK)</option>
                <option title="<%=intl._t("Send individual key to each user.") + ' '%> <%=intl._t("Send password to all users.")%>" value="7" <%=(curEncryptMode.equals("7") ? " selected=\"selected\"" : bdisabled)%> >
                    <%=intl._t("Encrypted with lookup password and per-user key")%> (PSK)</option>
                <option title="<%=intl._t("Enter key from each user.")%>" value="8" <%=(curEncryptMode.equals("8") ? " selected=\"selected\"" : bdisabled)%> >
                    <%=intl._t("Encrypted with per-user key")%> (DH)</option>
                <option title="<%=intl._t("Enter key from each user.") + ' '%> <%=intl._t("Send password to all users.")%>" value="9" <%=(curEncryptMode.equals("9") ? " selected=\"selected\"" : bdisabled)%> >
                    <%=intl._t("Encrypted with lookup password and per-user key")%> (DH)</option>
<%
                     } // isAdvanced()
                } // allowBlinding
%>
                </select>
            </td>
        </tr><tr>
            <td>
<%
                if (allowBlinding /* && editBean.isAdvanced() */) {
%>
                <b><%=intl._t("Optional lookup password")%>:</b>
<%
                } // allowBlinding
%>
            </td><td>
<%
                // even if not shown, we need to preserve the param as a hidden input below
                // as it's the key we use to decrypt the PSK/DH LS on the router side
                boolean showSharedKey = curEncryptMode.equals("1") || curEncryptMode.equals("4") || curEncryptMode.equals("5");
                if (showSharedKey) {
%>
                <b><%=intl._t("Encryption Key")%></b>
<%
                } // showSharedKey
%>
            </td>
        </tr><tr>
            <td>
<%
                if (allowBlinding /* && editBean.isAdvanced() */) {
                    String pwTitle = "title=\"" +
                                     (canChangeEncType ?
                                      intl._t("Set password required to access this service") :
                                      stopFirst) + '"';
%>
                <input type="password" name="nofilter_blindedPassword" <%=pwTitle%> value="<%=editBean.getBlindedPassword(curTunnel)%>" class="freetext password" <%=bidisabled%>/>
<%
                } // allowBlinding
%>
            </td><td>
                <input type="<%=showSharedKey ? "text" : "hidden"%>" size="44" id="leasesetKey" name="encryptKey" title="<%=intl._t("Encryption key required to access this service")%>" readonly="readonly" value="<%=editBean.getEncryptKey(curTunnel)%>" class="freetext"/>
            </td>
        </tr>
<%
                if (allowBlinding /* && editBean.isAdvanced() */) {
                    boolean pskClient = curEncryptMode.equals("6") || curEncryptMode.equals("7");
                    boolean dhClient = curEncryptMode.equals("8") || curEncryptMode.equals("9");
                    if (pskClient || dhClient) {
                        // b64Name:b64Key
                        java.util.List<String> clientAuths = editBean.getClientAuths(curTunnel, dhClient);
                        if (!clientAuths.isEmpty()) {
%>
        <tr><td><b><%=intl._t("Revoke")%>&nbsp;&nbsp;&nbsp;&nbsp;<%=intl._t("Client Name")%></b></td><td><b><%=intl._t("Client Key")%></b></td></tr>
<%
                            int i = 0;
                            for (String clientAuth : clientAuths) {
                                String[] split = net.i2p.data.DataHelper.split(clientAuth, ":", 2);
                                String cname, ckey;
                                if (split.length == 2) {
                                    cname = split[0];
                                    ckey = split[1];
                                } else {
                                    cname = "";
                                    ckey = split[0];
                                }
                                if (cname.length() > 0) {
                                    cname = net.i2p.data.DataHelper.escapeHTML(net.i2p.data.DataHelper.getUTF8(net.i2p.data.Base64.decode(cname)));
                                } else {
                                    cname = intl._t("Client") + ' ' + (i + 1);
                                }
%>
                <tr>
                <td><input value="<%=i%>" type="checkbox" name="revokeClient" class="tickbox" />
                    <input type="text" value="<%=cname%>" size="44" name="nofilter_clientName" class="freetext" /></td>
                <td><input type="text" id="leasesetKey" value="<%=ckey%>" size="44" name="clientKey" readonly="readonly" class="freetext" />
                </tr>
<%
                                i++;
                            } // for
                        } // isEmpty
%>
        <tr><td><b><%=intl._t("Add")%>&nbsp;&nbsp;&nbsp;&nbsp;<%=intl._t("Client Name")%></b></td><td>
<%
                            if (dhClient) {
%>
                    <b><%=intl._t("Client Key")%></b>
<%
                            } // dhClient
%>
                </td></tr><tr>
                <td><input value="1" type="checkbox" name="addClient" class="tickbox" />
                    <input type="text" value="<%=intl._t("Client") + ' ' + (clientAuths.size() + 1)%>" size="44" name="nofilter_newClientName" class="freetext" /></td>
                <td>
<%
                            if (dhClient) {
%>
                    <input type="text" id="leasesetKey" value="" size="44" maxlength="44" name="newClientKey" class="freetext" />
<%
                            } // dhClient
%>
                </td></tr>
<%
                    } // pskClient || dhClient
                } // allowBlinding
            } // !isOffline
%>
<% /***************** %>
        <tr>
            <th colspan="2">
                <%=intl._t("New Certificate type")%>
            </th>
        </tr><tr>
            <td colspan="2">
                <span class="multiOption"><label title="<%=intl._t("No Certificate")%>"><%=intl._t("None")%>
                <input value="0" type="radio" id="startOnLoad" name="cert"<%=(editBean.getCert(curTunnel)==0 ? " checked=\"checked\"" : "")%> class="tickbox" /></label></span>
                <span class="multiOption"><label title="<%=intl._t("Hashcash Certificate")%>"><%=intl._t("Hashcash (effort)")%>
                <input value="1" type="radio" id="startOnLoad" name="cert"<%=(editBean.getCert(curTunnel)==1 ? " checked=\"checked\"" : "")%> class="tickbox" /></label>
                <input type="text" id="port" name="effort" size="2" maxlength="2" title="<%=intl._t("Hashcash Effort")%>" value="<%=editBean.getEffort(curTunnel)%>" class="freetext" /></span>
            </td>
        </tr><tr>
            <th>
                <%=intl._t("Hashcash Calc Time")%>
            </th><th>
                <%=intl._t("Hidden")%>
            </th>
        </tr><tr>
            <td>
                <button class="control" type="submit" name="action" value="Estimate" title="<%=intl._t("Estimate Calculation Time")%>"><%=intl._t("Estimate")%></button>
            </td><td>
                <input value="2" type="radio" id="startOnLoad" name="cert" title="<%=intl._t("Hidden Certificate")%>"<%=(editBean.getCert(curTunnel)==2 ? " checked=\"checked\"" : "")%> class="tickbox" />
            </td>
        </tr><tr>
            <th colspan="2">
                <%=intl._t("Signed Certificate")%>
            </th>
        </tr><tr>
            <td colspan="2">
                <label title="<%=intl._t("Signed Certificate")%>"><%=intl._t("Signed (signed by)")%>:
                <input value="3" type="radio" id="startOnLoad" name="cert"<%=(editBean.getCert(curTunnel)==3 ? " checked=\"checked\"" : "")%> class="tickbox" /></label>
                <input type="text" id="port" name="signer" size="50" title="<%=intl._t("Cert Signer")%>" value="<%=editBean.getSigner(curTunnel)%>" class="freetext" />
            </td>
        </tr><tr>
            <th colspan="2">
                <%=intl._t("Modify Certificate")%>&nbsp;<%=intl._t("(Tunnel must be stopped first)")%>
            </th>
        </tr><tr>
            <td colspan="2">
                <button class="control" type="submit" name="action" value="Modify" title="<%=intl._t("Force new Certificate now")%>"><%=intl._t("Modify")%></button>
            </td>
        </tr>
<%
   **********************/
            int currentSigType = editBean.getSigType(curTunnel, tunnelType);
            String tooLate = intl._t("Configuration cannot be changed after destination is created");
            String tTooLate = " title=\"" + tooLate + "\" ";
            boolean canChangeSigType = editBean.canChangeSigType(curTunnel);
            String shdisabled = canChangeSigType ? "" : tTooLate;
            String disabled = canChangeSigType ? "" : " disabled=\"disabled\" ";
%>
        <tr>
            <th colspan="2" <%=shdisabled%>>
                <%=intl._t("Signature type")%>
            </th>
        </tr><tr>
            <td colspan="2">
                <select id="sigType" name="sigType" class="selectbox" <%=shdisabled%>>
                    <option title="<%=intl._t("Legacy option (deprecated), provided for backward compatibility")%>" value="0" <%=(currentSigType==0 ? " selected=\"selected\"" : disabled)%> >
                    DSA-SHA1</option>
<%           if (editBean.isSigTypeAvailable(1)) { %>
                    <option value="1" <%=(currentSigType==1 ? " selected=\"selected\"" : disabled)%> >
                    ECDSA-P256</option>
<%            }
              if (editBean.isSigTypeAvailable(2)) { %>
                    <option value="2" <%=(currentSigType==2 ? " selected=\"selected\"" : disabled)%> >
                    ECDSA-P384</option>
<%            }
              if (editBean.isSigTypeAvailable(3)) { %>
                    <option value="3" <%=(currentSigType==3 ? " selected=\"selected\"" : disabled)%> >
                    ECDSA-P521</option>
<%            }
              if (editBean.isSigTypeAvailable(7)) { %>
                    <option title="<%=intl._t("This is the default, recommended option")%>" value="7" <%=(currentSigType==7 ? " selected=\"selected\"" : disabled)%> >
                    Ed25519-SHA-512</option>
<%            }
              if (editBean.isSigTypeAvailable(11)) { %>
                    <option title="<%=intl._t("Recommended for blinded and encrypted destinations")%>" value="11" <%=(currentSigType==11 ? " selected=\"selected\"" : disabled)%> >
                    Red25519-SHA-512</option>
<%            }   // isAvailable
%>
                </select>
            </td>
        </tr>
<%
                boolean has0 = editBean.hasEncType(curTunnel, 0);
                boolean has4 = editBean.hasEncType(curTunnel, 4);
                String edisabled = canChangeEncType ? "" : " disabled=\"disabled\" ";
%>
        <tr>
            <th colspan="2" <%=ehdisabled%>>
                <%=intl._t("Encryption types")%>
            </th>
        </tr><tr>
            <td colspan="2">
                <span class="multiOption" <%=ehdisabled%>>
                    <label><input value="0" type="radio" id="startOnLoad" name="encType" <%=((has0 && !has4) ? " checked=\"checked\"" : edisabled)%> class="tickbox" />
                    ElGamal-2048</label>
                </span>
                <span class="multiOption" <%=ehdisabled%>>
                    <label><input value="4" type="radio" id="startOnLoad" name="encType" <%=((has4 && !has0) ? " checked=\"checked\"" : edisabled)%> class="tickbox" />
                    ECIES-X25519</label>
                </span>
                <span class="multiOption" <%=ehdisabled%>>
                    <label><input value="4,0" type="radio" id="startOnLoad" name="encType" <%=((has0 && has4) ? " checked=\"checked\"" : edisabled)%> class="tickbox" />
                    <%=intl._t("Both encryption types")%></label>
                </span>
            </td>
        </tr>
<%
            /* alternate dest, only if current dest is set and is DSA_SHA1 */

            if (currentSigType == 0 && !"".equals(b64) && !isStreamrServer) {
                String attitle = canChangeEncType ? "" : tstopFirst;
                String atitle = canChangeEncType ? intl._t("Path to Private Key File") : stopFirst;
                String adisabled = canChangeEncType ? "" : " readonly=\"readonly\" ";
%>
        <tr>
            <th colspan="2" <%=attitle%> >
                <%=intl._t("Alternate private key file")%> (Ed25519-SHA-512)
            </th>
        </tr><tr>
            <td colspan="2">
                <input type="text" class="freetext" size="30" id="altPrivKeyFile" name="altPrivKeyFile" title="<%=atitle%>" <%=adisabled%> value="<%=editBean.getAltPrivateKeyFile(curTunnel)%>" />
            </td>
        </tr>
<%
              String ab64 = editBean.getAltDestinationBase64(curTunnel);
              if (!"".equals(ab64)) {
%>
        <tr>
            <th colspan="2">
                <%=intl._t("Alternate local destination")%>
            </th>
        </tr><tr>
            <td colspan="2">
                <div class="displayText resetScrollLeft" title="<%=intl._t("Read Only: Alternate Local Destination")%>"><%=ab64%></div>
            </td>
        </tr><tr>
            <td colspan="2">
                <%=editBean.getAltDestHashBase32(curTunnel)%>
            </td>
        </tr>
<%
                ab64 = ab64.replace("=", "%3d");
                String name = editBean.getSpoofedHost(curTunnel);
                if (name == null || name.equals(""))
                    name = editBean.getTunnelName(curTunnel);
                // mysite.i2p is set in the installed i2ptunnel.config
                if (name != null && !name.equals("") && !name.equals("mysite.i2p") && !name.contains(" ") && name.endsWith(".i2p")) {
%>
        <tr>
            <td class="buttons" colspan="2">
<%
                    if (hasImagegen) {
%>
              <a class="control" title="<%=intl._t("Generate QR Code")%>" href="/imagegen/qr?s=320&amp;t=<%=name%>&amp;c=http%3a%2f%2f<%=name%>%2f%3fi2paddresshelper%3d<%=ab64%>" target="_top"><%=intl._t("Generate QR Code")%></a>
<%
                    }
                    if (hasSusiDNS) {
%>
              <a class="control" title="<%=intl._t("Add to Private addressbook")%>" href="/susidns/addressbook.jsp?book=private&amp;hostname=<%=name%>&amp;destination=<%=ab64%>#add"><%=intl._t("Add to local addressbook")%></a>
<%
                    }
%>
        </td></tr>
<%
                } else {
%>
        <tr>
            <td colspan="2">
                <%=intl._t("Note: In order to enable QR code generation or registration authentication, configure the Website Hostname field (for websites) or the Name field (everything else) above with an .i2p suffixed hostname e.g. mynewserver.i2p")%>
            </td>
        </tr>
<%
                }  // name
              }  // ab64
           } // currentSigType
%>
    </table>
    <table class="tunnelConfig" id="accessOptions">
        <tr>
            <th colspan="8" class="tableTop">
                <%=intl._t("Tunnel Access Control Options")%>
            </th>
        </tr><tr>
            <th colspan="8">
                <%=intl._t("Restricted Access List")%>
            </th>
        </tr><tr>
            <td colspan="8">
                <span class="multiOption"><label title="<%=intl._t("Allow all clients to connect to this service")%>"><input value="0" type="radio" name="accessMode"<%=(editBean.getAccessMode(curTunnel).equals("0") ? " checked=\"checked\"" : "")%> class="tickbox" />
                    <%=intl._t("Disable")%></label></span>
                <span class="multiOption"><label title="<%=intl._t("Prevent listed clients from connecting to this service")%>"><input value="2" type="radio" name="accessMode"<%=(editBean.getAccessMode(curTunnel).equals("2") ? " checked=\"checked\"" : "")%> class="tickbox" />
                    <%=intl._t("Deny List")%></label></span>
                <span class="multiOption"><label title="<%=intl._t("Only allow listed clients to connect to this service")%>"><input value="1" type="radio" name="accessMode"<%=(editBean.getAccessMode(curTunnel).equals("1") ? " checked=\"checked\"" : "")%> class="tickbox" />
                    <%=intl._t("Allow List")%></label></span>
            </td>
        </tr><tr>
            <td colspan="8">
                <b><%=intl._t("Access List Description")%></b> (<%=intl._t("Specify clients, 1 per line")%>)
            </td>
        </tr><tr>
            <td colspan="8">
                <textarea rows="2" style="height: 8em;" cols="60" name="accessList" title="<%=intl._t("Control access to this service")%>" wrap="off" spellcheck="false"><%=editBean.getAccessList(curTunnel)%></textarea>
            </td>
        </tr><tr>
            <td colspan="8">
                <b><%=intl._t("Filter Definition File")%></b>
            </td>
        </tr><tr>
            <td colspan="8">
                <%=intl._t("You can define an advanced filter for this tunnel.")%> (<a href="http://i2p-projekt.i2p/spec/filter-format" target="_blank"><%=intl._t("Format Specification")%></a>)  
            </td>
        </tr><tr>
            <td colspan="8">
                <label for="filterDefinition"><%=intl._t("Absolute path to file containing filter definition")%></label>
                <input type="text" id="filterDefinition" name="filterDefinition" value="<%=editBean.getFilterDefinition(curTunnel)%>" size="80"/>
            </td>
        </tr><tr>
            <th colspan="8">
                <%=intl._t("Server Access Options")%>
            </th>
        </tr>
        <%
               if ("httpserver".equals(tunnelType) || isBidirServer) {
%>
        <tr>
            <td>
                <label title="<%=intl._t("Prevent clients from accessing this service via an inproxy")%>"><input value="1" type="checkbox" name="rejectInproxy"<%=(editBean.isRejectInproxy(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
                <%=intl._t("Block Access via Inproxies")%></label>
            </td><td colspan="7">
                <label><input value="1" type="checkbox" name="rejectReferer"<%=(editBean.isRejectReferer(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
                <%=intl._t("Block Accesses containing Referers")%></label>
            </td>
        </tr><tr>
            <td>
                <label title="<%=intl._t("Deny User-Agents matching these strings (probably from inproxies)")%>"><input value="1" type="checkbox" name="rejectUserAgents"<%=(editBean.isRejectUserAgents(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
                <%=intl._t("Block these User-Agents")%></label>
            </td><td colspan="7">
                <input type="text" id="userAgents" name="userAgents" size="20" title="<%=intl._t("comma separated, e.g. Mozilla,Opera (case-sensitive)")%>" value="<%=editBean.getUserAgents(curTunnel)%>" class="freetext" />
            </td>
        </tr>
<%             } // httpserver
%>
        <tr>
            <td>
                <label title="<%=intl._t("Use unique IP addresses for each connecting client (local non-SSL servers only)")%>"><input value="1" type="checkbox" name="uniqueLocal"<%=(editBean.getUniqueLocal(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
                <%=intl._t("Unique Local Address per Client")%></label>
            </td><td colspan="7">
                <label title="<%=intl._t("Only enable if you are hosting this service on multiple routers")%>"><input value="1" type="checkbox" name="multihome"<%=(editBean.getMultihome(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
                <%=intl._t("Optimize for Multihoming")%></label>
            </td>
        </tr>
    </table>
    <table class="tunnelConfig" id="performanceOptions">
        <tr>
            <th colspan="5" class="tableTop">
            <%=intl._t("Tunnel Performance Options")%>
            </th>
        </tr>
<%
            if (!isStreamrServer) {
%>
        <tr>
            <th colspan="5">
                <%=intl._t("Profile")%>
            </th>
        </tr><tr>
            <td colspan="5">
                <select id="profile" name="profile" title="<%=intl._t("Connection Profile")%>" class="selectbox">
                    <% boolean interactiveProfile = editBean.isInteractive(curTunnel);
                  %><option <%=(interactiveProfile == true  ? "selected=\"selected\" " : "")%>value="interactive"><%=intl._t("interactive connection")%> </option>
                    <option <%=(interactiveProfile == false ? "selected=\"selected\" " : "")%>value="bulk"><%=intl._t("bulk connection (downloads/websites/BT)")%> </option>
                </select>
            </td>
        </tr>
<%
            } /* !streamrserver */
%>
        <tr>
            <th colspan="5">
                <%=intl._t("Reduce tunnel quantity when idle")%>
            </th>
        </tr><tr>
            <td colspan="5">
                <label><input value="1" type="checkbox" id="startOnLoad" name="reduce" <%=(editBean.getReduce(curTunnel) ? " checked=\"checked\"" : "")%> class="tickbox" />
                <%=intl._t("Reduce tunnel quantity when idle to conserve resources")%></label>
            </td>
        </tr><tr>
            <td>
                <b><%=intl._t("Reduced tunnel count")%>:</b>
                <input type="text" id="reduceCount" name="reduceCount" size="1" maxlength="1" title="<%=intl._t("Number of tunnels to keep open to maintain availability of service")%>" value="<%=editBean.getReduceCount(curTunnel)%>" class="freetext quantity" />
            </td>

            <td colspan="4">
                <b><%=intl._t("Idle period")%>:</b>
                <input type="text" id="reduceTime" name="reduceTime" size="4" maxlength="4" title="<%=intl._t("Period of inactivity before tunnel number is reduced")%>" value="<%=editBean.getReduceTime(curTunnel)%>" class="freetext period" />
                <%=intl._t("minutes")%>
            </td>
        </tr><tr>
            <th colspan="8">
                <%=intl._t("Server Throttling")%>
            </th>
        </tr><tr>
            <th colspan="5">
                <%=intl._t("Inbound connection limits")%>
            </th>
        </tr><tr>
            <td></td>
            <td><b><%=intl._t("Per Minute")%></b></td>
            <td><b><%=intl._t("Per Hour")%></b></td>
            <td><b><%=intl._t("Per Day")%></b></td>
            <td class="blankColumn"></td>
        </tr><tr>
            <td><b><%=intl._t("Per Client")%></b></td>
<%
   String unlimited = " (0 = " + intl._t("unlimited") + ')';
%>
            <td>
                <input type="text" name="limitMinute" title="<%=intl._t("Maximum number of web page requests per minute for a unique client before access to the server is blocked") + unlimited %>" value="<%=editBean.getLimitMinute(curTunnel)%>" class="freetext" />
            </td><td>
                <input type="text" name="limitHour" title="<%=intl._t("Maximum number of web page requests per hour for a unique client before access to the server is blocked") + unlimited %>" value="<%=editBean.getLimitHour(curTunnel)%>" class="freetext" />
            </td><td>
                <input type="text" name="limitDay" title="<%=intl._t("Maximum number of web page requests per day for a unique client before access to the server is blocked") + unlimited %>" value="<%=editBean.getLimitDay(curTunnel)%>" class="freetext" />
            </td><td class="blankColumn"></td>
        </tr><tr>
            <td><b><%=intl._t("Total")%></b></td>
            <td>
                <input type="text" name="totalMinute" title="<%=intl._t("Total number of web page requests per minute before access to the server is blocked") + unlimited %>" value="<%=editBean.getTotalMinute(curTunnel)%>" class="freetext" />
            </td><td>
                <input type="text" name="totalHour" title="<%=intl._t("Total number of web page requests per hour before access to the server is blocked") + unlimited %>" value="<%=editBean.getTotalHour(curTunnel)%>" class="freetext" />
            </td><td>
                <input type="text" name="totalDay" title="<%=intl._t("Total number of web page requests per day before access to the server is blocked") + unlimited %>" value="<%=editBean.getTotalDay(curTunnel)%>" class="freetext" />
            </td><td class="blankColumn"></td>
        </tr><tr>
            <th colspan="5"><%=intl._t("Max concurrent connections")%></th>
        </tr><tr>
            <td></td><td>
                <input type="text" name="maxStreams" title="<%=intl._t("Maximum number of simultaneous client connections") + unlimited %>" value="<%=editBean.getMaxStreams(curTunnel)%>" class="freetext" />
            </td><td></td><td></td><td class="blankColumn"></td>
        </tr>
<%
               if ("httpserver".equals(tunnelType) || isBidirServer) {
%>
        <tr>
            <th colspan="5">
                <%=intl._t("POST limits")%>
            </th>
        </tr><tr>
            <td></td><td>
                <b><%=intl._t("Per Period")%></b>
            </td><td>
                <b><%=intl._t("Ban Duration")%></b>
            </td><td></td><td class="blankColumn"></td>
        </tr><tr>
            <td>
                <b><%=intl._t("Per Client")%>
                </b>
            </td><td>
                <input type="text" name="postMax" title="<%=intl._t("Maximum number of post requests permitted for a unique client for the configured time span") + unlimited %>" value="<%=editBean.getPostMax(curTunnel)%>" class="freetext quantity"/>
            </td><td colspan="2">
                <input type="text" name="postBanTime" title="<%=intl._t("If a client exceeds the maximum number of post requests per allocated period, enforce a ban for this number of minutes")%>" value="<%=editBean.getPostBanTime(curTunnel)%>" class="freetext period"/>
                <%=intl._t("minutes")%>
            </td><td class="blankColumn"></td>
        </tr><tr>
            <td>
                <b><%=intl._t("Total")%>
                </b>
            </td><td>
                <input type="text" name="postTotalMax" title="<%=intl._t("Total number of post requests permitted for the configured time span") + unlimited %>" value="<%=editBean.getPostTotalMax(curTunnel)%>" class="freetext quantity"/>
            </td><td colspan="2">
                <input type="text" name="postTotalBanTime" title="<%=intl._t("If the maximum number of post requests per allocated period is exceeded, enforce a global access ban for this number of minutes")%>" value="<%=editBean.getPostTotalBanTime(curTunnel)%>" class="freetext period"/>
                <%=intl._t("minutes")%>
            </td><td class="blankColumn"></td>
        </tr><tr>
            <td>
                <b><%=intl._t("POST limit period")%>
                </b>
            </td><td colspan="2">
                <input type="text" name="postCheckTime" title="<%=intl._t("Time span for the maximum number of post requests to be reached before a ban is triggered")%>" value="<%=editBean.getPostCheckTime(curTunnel)%>" class="freetext period"/>
                <%=intl._t("minutes")%>
            </td><td></td><td class="blankColumn"></td>
        </tr>
<%             } // httpserver
%>
<%
            if (!editBean.isRouterContext()) {
%>
    </table>
    <table class="tunnelConfig">
        <tr>
            <th colspan="2">
                <%=intl._t("Router I2CP Address")%>
            </th>
        </tr><tr>
            <td>
                <b><%=intl._t("Host")%>:</b>
                <input type="text" id="clientHost" name="clientHost" size="20" title="<%=intl._t("I2CP Hostname or IP")%>" value="<%=editBean.getI2CPHost(curTunnel)%>" class="freetext" />
            </td><td>
                <b><%=intl._t("Port")%>:</b>
                <input type="text" id="clientPort" name="clientport" size="20" title="<%=intl._t("I2CP Port Number")%>" value="<%=editBean.getI2CPPort(curTunnel)%>" class="freetext" />
            </td>
        </tr>
<%
            } // !isRouterContext
%>
    </table>
    <table class="tunnelConfig" id="customOptions">
        <tr>
            <th colspan="2">
                <%=intl._t("Custom options")%>
            </th>
        </tr><tr>
            <td colspan="2">
                <input type="text" class="freetext" id="customOptions" name="nofilter_customOptions" size="60" title="<%=intl._t("Advanced tunnel, streaming, and I2CP options")%>" value="<%=editBean.getCustomOptions(curTunnel)%>" />
            </td>
        </tr><tr>
            <td class="buttons" colspan="2">
                    <a id="controlCancel" class="control" href="list"><%=intl._t("Cancel")%></a>
<%
            if (curTunnel >= 0) {
%>
                    <input type="hidden" value="true" name="removeConfirm" />
                    <button id="controlDelete" class="control delete" type="submit" name="action" value="Delete this proxy" title="<%=intl._t("Delete this Proxy (cannot be undone)")%>" formnovalidate><%=intl._t("Delete")%></button>
<%
            }
%>
                    <button id="controlSave" class="control" type="submit" name="action" value="Save changes"><%=intl._t("Save")%></button>
            </td>
        </tr>
    </table>
