net.i2p.util
Class PortMapper

java.lang.Object
  extended by net.i2p.util.PortMapper

public class PortMapper
extends Object

Map services to internal or external application ports for this context. Not intended for the router's NTCP or SSU ports.

Since:
0.8.12

Field Summary
static String SVC_BOB
           
static String SVC_CONSOLE
           
static String SVC_EEPSITE
           
static String SVC_HTTP_PROXY
           
static String SVC_HTTPS_CONSOLE
           
static String SVC_HTTPS_PROXY
           
static String SVC_I2CP
          not necessary, already in config?
static String SVC_IRC
           
static String SVC_POP
           
static String SVC_SAM
           
static String SVC_SMTP
           
static String SVC_SOCKS
           
static String SVC_TAHOE
           
 
Constructor Summary
PortMapper(I2PAppContext context)
           
 
Method Summary
 int getPort(String service)
          Get the registered port for a service
 int getPort(String service, int def)
          Get the registered port for a service
 boolean register(String service, int port)
          Add the service
 void unregister(String service)
          Remove the service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SVC_CONSOLE

public static final String SVC_CONSOLE
See Also:
Constant Field Values

SVC_HTTPS_CONSOLE

public static final String SVC_HTTPS_CONSOLE
See Also:
Constant Field Values

SVC_HTTP_PROXY

public static final String SVC_HTTP_PROXY
See Also:
Constant Field Values

SVC_HTTPS_PROXY

public static final String SVC_HTTPS_PROXY
See Also:
Constant Field Values

SVC_EEPSITE

public static final String SVC_EEPSITE
See Also:
Constant Field Values

SVC_IRC

public static final String SVC_IRC
See Also:
Constant Field Values

SVC_SOCKS

public static final String SVC_SOCKS
See Also:
Constant Field Values

SVC_TAHOE

public static final String SVC_TAHOE
See Also:
Constant Field Values

SVC_SMTP

public static final String SVC_SMTP
See Also:
Constant Field Values

SVC_POP

public static final String SVC_POP
See Also:
Constant Field Values

SVC_SAM

public static final String SVC_SAM
See Also:
Constant Field Values

SVC_BOB

public static final String SVC_BOB
See Also:
Constant Field Values

SVC_I2CP

public static final String SVC_I2CP
not necessary, already in config?

See Also:
Constant Field Values
Constructor Detail

PortMapper

public PortMapper(I2PAppContext context)
Parameters:
context - unused for now
Method Detail

register

public boolean register(String service,
                        int port)
Add the service

Parameters:
port - > 0
Returns:
success, false if already registered

unregister

public void unregister(String service)
Remove the service


getPort

public int getPort(String service)
Get the registered port for a service

Returns:
-1 if not registered

getPort

public int getPort(String service,
                   int def)
Get the registered port for a service

Parameters:
def - default
Returns:
def if not registered