java.lang.Object
net.i2p.i2ptunnel.web.IndexBean
Direct Known Subclasses:
EditBean

public class IndexBeanextends Object
Backend bean for I2P tunnel management web interface.

Simple accessor for exposing tunnel info, but also an ugly form handler.

Warning - This class is not part of the i2ptunnel API, it has been moved from the jar to the war. Usage by classes outside of i2ptunnel.war is deprecated.

  • Field Details

    • _context

      protected final I2PAppContext _context
      App context, for properties, randomness and key generation.
    • _log

      protected final Log _log
      Log for this bean.
    • _group

      protected final TunnelControllerGroup _group
      The configured tunnels, null if the group is not initialized.
    • _helper

      protected final GeneralHelper _helper
      Reads tunnel properties, shared with subclasses.
    • RUNNING

      public static final int RUNNING
      Tunnel status: running.
      See Also:
    • STARTING

      public static final int STARTING
      Tunnel status: starting.
      See Also:
    • NOT_RUNNING

      public static final int NOT_RUNNING
      Tunnel status: not running.
      See Also:
    • STANDBY

      public static final int STANDBY
      Tunnel status: standby.
      See Also:
  • Constructor Details

    • IndexBean

      public IndexBean()
      Create the IndexBean, initializing the tunnel controller group and helper. Nonces are initialized for CSRF protection.
  • Method Details

    • setSession

      public void setSession(HttpSession session)
      For session-bound nonce generation and validation.
      Parameters:
      session - the HTTP session
    • storeMethod

      public void storeMethod(String method)
      Store request method for P-R-G pattern.
      Parameters:
      method - the request method
    • isInitialized

      public boolean isInitialized()
      Check if the tunnel group is initialized.
      Returns:
      true if initialized
    • getNextNonce

      public static String getNextNonce()
      Get the next nonce from the queue.
      Returns:
      the next nonce
    • setNonce

      public void setNonce(String nonce)
      Set the current nonce.
      Parameters:
      nonce - the nonce to require of subsequent submissions; ignored if null or blank
    • haveNonce

      public static boolean haveNonce(String nonce)
      Whether we know this nonce.
      Parameters:
      nonce - the nonce to check
      Returns:
      true if the nonce is known
    • getNextNonce

      public static String getNextNonce(HttpSession session)
      Session-bound nonce generation - replaces static nonce when session available.
      Parameters:
      session - returns static nonce if null
      Returns:
      a new nonce for each call
    • haveNonce

      public static boolean haveNonce(String nonce, HttpSession session)
      Session-bound nonce validation.
      Parameters:
      nonce - returns false if null
      session - returns static nonce check if null
      Returns:
      true if valid
    • setAction

      public void setAction(String action)
      Set the action to process.
      Parameters:
      action - the action string
    • setTunnel

      public void setTunnel(String tunnel)
      Set the tunnel number.
      Parameters:
      tunnel - the tunnel number to select, parsed as an integer; ignored if null or blank
    • setMsgid

      public void setMsgid(String id)
      Set the message ID for clearing messages.
      Parameters:
      id - the message ID
    • getMessages

      public String getMessages()
      Executes any action requested (start/stop/etc) and dump out the messages. Only call this ONCE! Or you will get duplicate tunnels on save.
      Returns:
      HTML escaped or "" if empty
    • getLastMessageID

      public int getLastMessageID()
      The last stored message ID.
      Returns:
      the last message ID
    • getTheme

      public String getTheme()
      Get the theme path.
      Returns:
      the theme path
    • getThemeName

      public String getThemeName()
      Get the theme name.
      Returns:
      the configured theme, never null
    • useSoraFont

      public boolean useSoraFont()
      Check if the Sora font is enabled.
      Returns:
      true if Sora font is enabled
    • getTunnelCount

      public int getTunnelCount()
      Get the number of tunnels.
      Returns:
      the tunnel count
    • getControllerNumbers

      public List<Integer> getControllerNumbers(boolean isClient)
      Return tunnel numbers of clients or servers only, sorted by tunnel name.
      Parameters:
      isClient - true for clients, false for servers
      Returns:
      non-null, may be empty
    • isClient

      public boolean isClient(int tunnelNum)
      Is it a client or server in the UI and I2P side? Note that a streamr client is a UI and I2P client but a server on the localhost side. Note that a streamr server is a UI and I2P server but a client on the localhost side.
      Parameters:
      tunnelNum - the tunnel number
      Returns:
      true if it is a client
    • isClient

      public static boolean isClient(String type)
      Is it a client or server in the UI and I2P side? Note that a streamr client is a UI and I2P client but a server on the localhost side. Note that a streamr server is a UI and I2P server but a client on the localhost side.
      Parameters:
      type - the tunnel type
      Returns:
      true if it is a client
    • isSharedClient

      public boolean isSharedClient(int tunnel)
      Check if the tunnel is a shared client.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      true if shared client
    • getTunnelName

      public String getTunnelName(int tunnel)
      Get the tunnel name.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      the name as configured, never null
    • getClientPort

      public String getClientPort(int tunnel)
      No validation.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      the client port
    • getClientPort2

      public String getClientPort2(int tunnel)
      Returns error message if blank or invalid.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      the client port or error message
    • getTunnelType

      public String getTunnelType(int tunnel)
      Get the tunnel type.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      the type of the running tunnel, or the config value if not running
    • getTypeName

      public String getTypeName(String internalType)
      Get the display name for an internal type.
      Parameters:
      internalType - the internal type
      Returns:
      the display name
    • getInternalType

      public String getInternalType(int tunnel)
      The internal type string for the specified tunnel.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      the internal type
    • getClientInterface

      public String getClientInterface(int tunnel)
      The interface the specified client tunnel is configured to listen on.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      the client interface
    • getTunnelStatus

      public int getTunnelStatus(int tunnel)
      The current status of the specified tunnel.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      the tunnel status
    • getRemainingStartupDelay

      public int getRemainingStartupDelay(int tunnel)
      The remaining startup delay for the specified tunnel.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      the remaining startup delay
    • getTunnelDescription

      public String getTunnelDescription(int tunnel)
      The description for the specified tunnel, HTML-escaped.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      the tunnel description
    • getSharedClient

      public String getSharedClient(int tunnel)
      Get the shared client for a tunnel.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      the shared client
    • getClientDestination

      public String getClientDestination(int tunnel)
      The destination Base64 for the specified client tunnel.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      the client destination
    • isServerTargetLinkValid

      public boolean isServerTargetLinkValid(int tunnel)
      Call this to see if it is ok to linkify getServerTarget(int).
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      true if the server target link is valid
    • isValidIRCServer

      public boolean isValidIRCServer(int tunnel)
      Is this an IRC server? Call to establish if we should provide irc:// link on index page.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      true if it is a valid IRC server
    • isServer

      public boolean isServer(int tunnel)
      Is this a server tunnel?
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      true if it is a server
    • getServerTarget

      public String getServerTarget(int tunnel)
      Get the server target.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      valid host:port only if isServerTargetLinkValid(int) is true
    • getDestination

      protected Destination getDestination(int tunnel)
      Works even if tunnel is not running.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      Destination or null
    • getDestinationBase64

      public String getDestinationBase64(int tunnel)
      Works even if tunnel is not running.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      Base64 or ""
    • getDestHashBase32

      public String getDestHashBase32(int tunnel)
      Works even if tunnel is not running.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      "{52 chars}.b32.i2p" or ""
    • getEncryptedBase32

      public String getEncryptedBase32(int tunnel)
      Works even if tunnel is not running.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      "{56 chars}.b32.i2p" or "" if not blinded
    • getAltDestination

      protected Destination getAltDestination(int tunnel)
      Works even if tunnel is not running.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      Destination or null
    • getAltDestinationBase64

      public String getAltDestinationBase64(int tunnel)
      Works even if tunnel is not running.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      Base64 or ""
    • getAltDestHashBase32

      public String getAltDestHashBase32(int tunnel)
      Works even if tunnel is not running.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      "{52 chars}.b32.i2p" or ""
    • getIsOfflineKeys

      public boolean getIsOfflineKeys(int tunnel)
      Works even if tunnel is not running.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      true if offline keys
    • getIsUsingOutproxyPlugin

      public boolean getIsUsingOutproxyPlugin(int tunnel)
      For index.jsp.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      true if the plugin is enabled, installed, and running
    • getSpoofedHost

      public String getSpoofedHost(int tunnel)
      Get the spoofed host for a tunnel.
      Parameters:
      tunnel - index of the tunnel in the configured list, or -1 for a new tunnel
      Returns:
      the spoofed host
    • setType

      public void setType(String type)
      What type of tunnel (httpclient, ircclient, client, or server). This is required when adding a new tunnel.
      Parameters:
      type - the tunnel type
    • getType

      String getType()
      The tunnel type.
      Returns:
      the configured type, e.g. HTTP or IRC
    • setNofilter_name

      public void setNofilter_name(String name)
      Short name of the tunnel.
      Parameters:
      name - the tunnel name
    • setNofilter_description

      public void setNofilter_description(String description)
      One line host description.
      Parameters:
      description - the tunnel description
    • setClientHost

      public void setClientHost(String host)
      I2CP host the router is on, ignored when in router context.
      Parameters:
      host - the client host
    • setClientport

      public void setClientport(String port)
      I2CP port the router is on, ignored when in router context.
      Parameters:
      port - the client port
    • setTunnelDepth

      public void setTunnelDepth(String tunnelDepth)
      How many hops to use for inbound tunnels In or both in/out.
      Parameters:
      tunnelDepth - the tunnel depth
    • setTunnelQuantity

      public void setTunnelQuantity(String tunnelQuantity)
      How many parallel inbound tunnels to use In or both in/out.
      Parameters:
      tunnelQuantity - the tunnel quantity
    • setTunnelVariance

      public void setTunnelVariance(String tunnelVariance)
      How much randomisation to apply to the depth of tunnels In or both in/out.
      Parameters:
      tunnelVariance - the tunnel variance
    • setTunnelBackupQuantity

      public void setTunnelBackupQuantity(String tunnelBackupQuantity)
      How many tunnels to hold in reserve to guard against failures In or both in/out.
      Parameters:
      tunnelBackupQuantity - the backup quantity
    • setTunnelDepthOut

      public void setTunnelDepthOut(String tunnelDepth)
      How many hops to use for outbound tunnels.
      Parameters:
      tunnelDepth - the outbound tunnel depth
    • setTunnelQuantityOut

      public void setTunnelQuantityOut(String tunnelQuantity)
      How many parallel outbound tunnels to use.
      Parameters:
      tunnelQuantity - the outbound tunnel quantity
    • setTunnelVarianceOut

      public void setTunnelVarianceOut(String tunnelVariance)
      How much randomisation to apply to the depth of outbound tunnels.
      Parameters:
      tunnelVariance - the outbound tunnel variance
    • setTunnelBackupQuantityOut

      public void setTunnelBackupQuantityOut(String tunnelBackupQuantity)
      How many outbound tunnels to hold in reserve to guard against failures.
      Parameters:
      tunnelBackupQuantity - the outbound backup quantity
    • setNofilter_customOptions

      public void setNofilter_customOptions(String customOptions)
      What I2P session overrides should be used.
      Parameters:
      customOptions - the custom options
    • setProxyList

      public void setProxyList(String proxyList)
      What HTTP outproxies should be used (httpclient specific).
      Parameters:
      proxyList - the proxy list
    • setPort

      public void setPort(String port)
      What port should this client/httpclient/ircclient listen on.
      Parameters:
      port - the port number
    • setReachableBy

      public void setReachableBy(String reachableBy)
      What interface should this client/httpclient/ircclient listen on.
      Parameters:
      reachableBy - the reachable interface
    • setTargetDestination

      public void setTargetDestination(String dest)
      What peer does this client tunnel point at.
      Parameters:
      dest - the target destination
    • setTargetHost

      public void setTargetHost(String host)
      What host does this server tunnel point at.
      Parameters:
      host - the target host
    • setTargetPort

      public void setTargetPort(String port)
      What port does this server tunnel point at.
      Parameters:
      port - the target port
    • setSpoofedHost

      public void setSpoofedHost(String host)
      What host does this http server tunnel spoof.
      Parameters:
      host - the spoofed host
    • setPrivKeyFile

      public void setPrivKeyFile(String file)
      What filename is this server tunnel's private keys stored in.
      Parameters:
      file - relative filename for the destination keys, or null to clear
    • setAltPrivKeyFile

      public void setAltPrivKeyFile(String file)
      What filename is this server tunnel's alternate private keys stored in.
      Parameters:
      file - key file path used only if the primary one is unusable
    • setRemoveConfirm

      public void setRemoveConfirm(String val)
      If called with any value (and the form submitted with action=Remove), we really do want to stop and remove the tunnel.
      Parameters:
      val - any value confirms removal
    • setStartOnLoad

      public void setStartOnLoad(String val)
      If called with any value, we want this tunnel to start whenever it is loaded (aka right now and whenever the router is started up).
      Parameters:
      val - any value triggers startup on load
    • setShared

      public void setShared(String val)
      Share the private key with other client tunnels.
      Parameters:
      val - any value triggers shared private key mode
    • setShared

      public void setShared(boolean val)
      Share the private key with other client tunnels.
      Parameters:
      val - true to share the private key with other client tunnels
    • setStartupDelayMin

      public void setStartupDelayMin(String val)
      The minimum startup delay in seconds for server tunnels.
      Parameters:
      val - the minimum startup delay in seconds for server tunnels
    • setStartupDelayMax

      public void setStartupDelayMax(String val)
      The maximum startup delay in seconds for server tunnels.
      Parameters:
      val - the maximum startup delay in seconds for server tunnels
    • setShutdownDelayMin

      public void setShutdownDelayMin(String val)
      The minimum shutdown delay in seconds for server tunnels.
      Parameters:
      val - the minimum shutdown delay in seconds for server tunnels
    • setShutdownDelayMax

      public void setShutdownDelayMax(String val)
      The maximum shutdown delay in seconds for server tunnels.
      Parameters:
      val - the maximum shutdown delay in seconds for server tunnels
    • setConnectDelay

      public void setConnectDelay(String val)
      Delay the connection to the target until the first client connects.
      Parameters:
      val - any value enables connect delay
    • setProfile

      public void setProfile(String profile)
      Set the streaming profile.
      Parameters:
      profile - profile name; only "interactive" changes behavior
    • setReduce

      public void setReduce(String val)
      Reduce the number of connections when idle.
      Parameters:
      val - any value enables reduce on idle
    • setClose

      public void setClose(String val)
      Close connections when idle.
      Parameters:
      val - any value enables close on idle
    • setEncrypt

      public void setEncrypt(String val)
      Encrypt the lease set.
      Parameters:
      val - any value enables lease set encryption
    • setEncryptMode

      public void setEncryptMode(String val)
      Set the LeaseSet encryption mode.
      Parameters:
      val - the encryption mode value
    • setNofilter_blindedPassword

      public void setNofilter_blindedPassword(String s)
      Set the blinded password for hidden encrypted LeaseSets.
      Parameters:
      s - the blinded password
    • setNofilter_clientName

      public void setNofilter_clientName(String[] s)
      Set client names for access control (multiple entries in form).
      Parameters:
      s - the client names
    • setclientKey

      public void setclientKey(String[] s)
      Set client keys for access control (multiple entries in form).
      Parameters:
      s - the client keys
    • setRevokeClient

      public void setRevokeClient(String[] s)
      Revoke access for specified clients (multiple entries in form, values are integers).
      Parameters:
      s - the client indices to revoke
    • setNofilter_newClientName

      public void setNofilter_newClientName(String s)
      Add a client for per-client LeaseSet encryption.
      Parameters:
      s - display name for the new client
    • setNewClientKey

      public void setNewClientKey(String s)
      Add a key for per-client LeaseSet encryption.
      Parameters:
      s - Base64 key for the new client, blank to generate one
    • setAddClient

      public void setAddClient(String val)
      Generate an extra per-client key, as for encrypt modes 6-9.
      Parameters:
      val - any value requests another client key
    • setDCC

      public void setDCC(String val)
      Allow DCC in IRC clients.
      Parameters:
      val - any value enables DCC
    • setUseSSL

      public void setUseSSL(String val)
      Use SSL on the server port.
      Parameters:
      val - any value enables SSL
    • isSSLEnabled

      public boolean isSSLEnabled(int tunnel)
      Is SSL enabled for the server tunnel?
      Parameters:
      tunnel - index of the tunnel in the configured list
      Returns:
      true if the server tunnel terminates TLS
    • setRejectInproxy

      public void setRejectInproxy(String val)
      Reject requests carrying inproxy forwarding headers.
      Parameters:
      val - any value enables inproxy rejection
    • isRejectInproxy

      public boolean isRejectInproxy(int tunnel)
      Are requests carrying inproxy forwarding headers rejected?
      Parameters:
      tunnel - index of the tunnel in the configured list
      Returns:
      true if inproxy requests are refused
    • setRejectReferer

      public void setRejectReferer(String val)
      Reject requests carrying a Referer header.
      Parameters:
      val - any value enables Referer rejection
    • isRejectReferer

      public boolean isRejectReferer(int tunnel)
      Are requests carrying a Referer header rejected?
      Parameters:
      tunnel - index of the tunnel in the configured list
      Returns:
      true if Referer requests are refused
    • setRejectUserAgents

      public void setRejectUserAgents(String val)
      Reject requests whose User-Agent matches the blocklist.
      Parameters:
      val - any value enables User-Agent rejection
    • isRejectUserAgents

      public boolean isRejectUserAgents(int tunnel)
      Are blacklisted User-Agents rejected?
      Parameters:
      tunnel - index of the tunnel in the configured list
      Returns:
      true if User-Agent requests are refused
    • setUserAgents

      public void setUserAgents(String agents)
      Set the User-Agent blocklist.
      Parameters:
      agents - comma-separated substrings to refuse; "none" blocks a blank header
    • setUniqueLocal

      public void setUniqueLocal(String val)
      Assign unique local hostnames for destination lookup.
      Parameters:
      val - any value enables unique local hostnames
    • setAccessMode

      public void setAccessMode(String val)
      Set the access mode, 0 for none, 1 for whitelist, 2 for blacklist.
      Parameters:
      val - 0 for no access control, 1 for whitelist, 2 for blacklist
    • setFilterDefinition

      public void setFilterDefinition(String val)
      Set the filter definition.
      Parameters:
      val - filter definition, servers only
    • setDelayOpen

      public void setDelayOpen(String val)
      Delay opening to the target until the first client connects.
      Parameters:
      val - any value enables delay open
    • setNewDest

      public void setNewDest(String val)
      Control how ephemeral the destination is.
      Parameters:
      val - 0 for new dest on restart, 1 on idle resume, 2 to keep the key
    • setReduceTime

      public void setReduceTime(String val)
      Idle time in minutes before reducing connections.
      Parameters:
      val - minutes of idleness before reducing
    • setReduceCount

      public void setReduceCount(String val)
      Number of connections to reduce to when idle.
      Parameters:
      val - connections left open while idle
    • setEncryptKey

      public void setEncryptKey(String val)
      Key for encrypting the lease set.
      Parameters:
      val - Base64 lease set encryption key
    • setAccessList

      public void setAccessList(String val)
      Comma-separated list of destinations to whitelist or blacklist.
      Parameters:
      val - destinations, read as allow or deny per the access mode
    • setJumpList

      public void setJumpList(String val)
      Comma-separated list of HTTP outproxy jump servers.
      Parameters:
      val - jump servers for multi-hop outproxying
    • setCloseTime

      public void setCloseTime(String val)
      Idle time in minutes before closing connections.
      Parameters:
      val - minutes of idleness before closing
    • setAllowUserAgent

      public void setAllowUserAgent(String val)
      Allow the User-Agent header to pass through the HTTP client.
      Parameters:
      val - any value allows the User-Agent header
    • setAllowReferer

      public void setAllowReferer(String val)
      Allow the Referer header to pass through the HTTP client.
      Parameters:
      val - any value allows the Referer header
    • setAllowAccept

      public void setAllowAccept(String val)
      Allow the Accept header to pass through the HTTP client.
      Parameters:
      val - any value allows the Accept header
    • setAllowInternalSSL

      public void setAllowInternalSSL(String val)
      Allow SSL connections through the HTTP client.
      Parameters:
      val - any value allows internal SSL connections
    • setMultihome

      public void setMultihome(String val)
      Bundle reply info for multihoming.
      Parameters:
      val - any value bundles reply info
    • setProxyAuth

      public void setProxyAuth(String s)
      Set the proxy authentication type.
      Parameters:
      s - any value enables proxy authentication
    • setProxyUsername

      public void setProxyUsername(String s)
      Username for client proxy authentication.
      Parameters:
      s - username offered to the outproxy
    • setNofilter_proxyPassword

      public void setNofilter_proxyPassword(String s)
      Password for client proxy authentication.
      Parameters:
      s - password offered to the outproxy
    • setOutproxyAuth

      public void setOutproxyAuth(String s)
      Require authentication for the outproxies.
      Parameters:
      s - any value requires outproxy authentication
    • setOutproxyUsername

      public void setOutproxyUsername(String s)
      Username for outproxy authentication.
      Parameters:
      s - username presented to each outproxy
    • setNofilter_outproxyPassword

      public void setNofilter_outproxyPassword(String s)
      Password for outproxy authentication.
      Parameters:
      s - password presented to each outproxy
    • setSslProxies

      public void setSslProxies(String s)
      Comma-separated list of SSL-capable outproxies.
      Parameters:
      s - outproxies reachable over SSL, for 3-hop tunnels
    • setUseOutproxyPlugin

      public void setUseOutproxyPlugin(String val)
      Use the outproxy plugin for HTTP requests.
      Parameters:
      val - any value enables the plugin instead of the proxy list
    • setOutproxyType

      public void setOutproxyType(String s)
      Set the type of the outproxy.
      Parameters:
      s - "connect" or "socks"
    • setLimitMinute

      public void setLimitMinute(String s)
      Maximum total number of connections per minute.
      Parameters:
      s - connections allowed per minute, 0 for unlimited
    • setLimitHour

      public void setLimitHour(String s)
      Maximum total number of connections per hour.
      Parameters:
      s - connections allowed per hour, 0 for unlimited
    • setLimitDay

      public void setLimitDay(String s)
      Maximum total number of connections per day.
      Parameters:
      s - connections allowed per day, 0 for unlimited
    • setTotalMinute

      public void setTotalMinute(String s)
      Maximum total number of connections per minute, enforced by the total limit.
      Parameters:
      s - connections allowed for all peers per minute, 0 for unlimited
    • setTotalHour

      public void setTotalHour(String s)
      Maximum total number of connections per hour, enforced by the total limit.
      Parameters:
      s - connections allowed for all peers per hour, 0 for unlimited
    • setTotalDay

      public void setTotalDay(String s)
      Maximum total number of connections per day, enforced by the total limit.
      Parameters:
      s - connections allowed for all peers per day, 0 for unlimited
    • setMaxStreams

      public void setMaxStreams(String s)
      Maximum number of concurrent streams.
      Parameters:
      s - streams allowed concurrently, 0 for unlimited
    • setPostMax

      public void setPostMax(String s)
      Maximum number of POST or PUT requests per check window, per peer.
      Parameters:
      s - requests allowed per peer, 0 for unlimited
    • setPostTotalMax

      public void setPostTotalMax(String s)
      Maximum total number of POST or PUT requests in the check interval.
      Parameters:
      s - requests allowed for all peers, 0 for unlimited
    • setPostCheckTime

      public void setPostCheckTime(String s)
      How often the total POST limit is checked, in minutes.
      Parameters:
      s - check window in minutes
    • setPostBanTime

      public void setPostBanTime(String s)
      How long to ban a client that exceeds the POST limits, in minutes.
      Parameters:
      s - ban duration in minutes for a per-peer overrun
    • setPostTotalBanTime

      public void setPostTotalBanTime(String s)
      How long to ban a client that exceeds the total POST limit, in minutes.
      Parameters:
      s - ban duration in minutes for a window overrun
    • setCert

      public void setCert(String val)
      Set the certificate type, from the form selection.
      Parameters:
      val - Certificate.CERTIFICATE_TYPE_* value
    • setSigner

      public void setSigner(String val)
      Set the certificate signer.
      Parameters:
      val - name or spoofed host of the tunnel whose destination signs
    • setSigType

      public void setSigType(String val)
      Set the destination signature type, and rewrite the certificate to match.
      Parameters:
      val - SigType code; also selects a hidden or signed certificate
    • setEncType

      public void setEncType(String s)
      Adds to existing, comma separated.
      Parameters:
      s - encryption type to append to the lease set encryption list
    • setKey1

      public void setKey1(String s)
      Random keys, hidden in forms.
      Parameters:
      s - encrypted inbound random key
    • setKey2

      public void setKey2(String s)
      Random outbound key, hidden in forms.
      Parameters:
      s - encrypted outbound random key
    • setKey3

      public void setKey3(String s)
      Lease set signing private key, hidden in forms.
      Parameters:
      s - encrypted lease set signing private key
    • setKey4

      public void setKey4(String s)
      Lease set private key, hidden in forms.
      Parameters:
      s - encrypted lease set private key
    • encrypt

      protected String encrypt(int tunnel, String k, String v)
      Encrypt a property using an in-memory key, for interaction with the UI only, using ChaCha20. The IV is random and prepended to the ciphertext (12 bytes); the previous IV = SHA256(k) reused the keystream for the same property name under the same cached form key.

      These are transient keys by design, but are persisted to hide restarts. They are hidden inputs in the edit form. Storage in config files is not encrypted.

      Parameters:
      tunnel - index selecting the in-memory form key
      k - non-null
      v - may be empty or null
      Returns:
      Base64, or empty, or null
    • getController

      protected TunnelController getController(int tunnel)
      The controller for the given tunnel index.
      Parameters:
      tunnel - index of the tunnel in the configured list
      Returns:
      the controller, or null if there is none
    • _t

      protected String _t(String key)
      Translate a string.
      Parameters:
      key - the string to translate
      Returns:
      the translated string
    • ngettext

      protected String ngettext(String s, String p, int n)
      translate (ngettext).
      Parameters:
      s - the message in its singular form, used when n is 1
      p - the message in its plural form, used when n is anything else
      n - the count deciding the form
      Returns:
      s if n is 1, else p