public class PortMapper extends Object
| Modifier and Type | Field and Description |
|---|---|
static int | DEFAULT_CONSOLE_PORTDefault HTTP console port. |
static String | DEFAULT_HOSTDefault host for local services. |
static int | DEFAULT_HTTPS_CONSOLE_PORTDefault HTTPS console port. |
static String | PROP_PREFER_HTTPSProperty to prefer HTTPS |
static String | SVC_BOBBOB service |
static String | SVC_CONSOLEConsole service |
static String | SVC_EEPSITEEepsite service |
static String | SVC_HTTP_I2PCONTROLHTTP I2PControl service name. |
static String | SVC_HTTP_PROXYHTTP proxy service |
static String | SVC_HTTPS_CONSOLEHTTPS console service |
static String | SVC_HTTPS_EEPSITEHTTPS eepsite service name. |
static String | SVC_HTTPS_I2PCONTROLHTTPS I2PControl service name. |
static String | SVC_HTTPS_PROXYHTTPS proxy service |
static String | SVC_I2CPnot necessary, already in config? |
static String | SVC_I2CP_SSLI2CP-SSL service name. |
static String | SVC_I2PSNARKTo indicate presence, alternative to WebAppStarter.isWebappRunning(). |
static String | SVC_I2PTUNNELTo indicate presence, alternative to WebAppStarter.isWebappRunning(). |
static String | SVC_IMAGEGENTo indicate presence, alternative to WebAppStarter.isWebappRunning(). |
static String | SVC_IRCIRC service |
static String | SVC_JSONRPCTo indicate presence, alternative to WebAppStarter.isWebappRunning(). |
static String | SVC_POPPOP3 service |
static String | SVC_SAMSAM service |
static String | SVC_SAM_SSLSAM-SSL service name. |
static String | SVC_SAM_UDPSAM-UDP service name. |
static String | SVC_SMTPSMTP service |
static String | SVC_SOCKSSOCKS service |
static String | SVC_SUSIDNSTo indicate presence, alternative to WebAppStarter.isWebappRunning(). |
static String | SVC_SUSIMAILTo indicate presence, alternative to WebAppStarter.isWebappRunning(). |
static String | SVC_TAHOETahoe-LAFS service |
| Constructor and Description |
|---|
PortMapper(I2PAppContext context)Create a port mapper |
| Modifier and Type | Method and Description |
|---|---|
String | getActualHost(String service,
String def)Get the actual host for a service. |
String | getConsoleURL()If PROP_PREFER_HTTPS is true or unset,
return https URL unless console is http only. |
String | getConsoleURL(boolean preferHTTPS)If preferHTTPS is true,
return https URL unless console is http only. |
List<String> | getEepsiteURLs()Get the list of eepsite URLs. |
String | getHost(String service,
String def)Get the registered host for a service. |
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 | isRegistered(String service)Is the service registered? |
boolean | register(String service,
int port)Add the service |
boolean | register(String service,
String host,
int port)Add the service. |
void | renderStatusHTML(Writer out)For debugging only |
void | unregister(String service)Remove the service |
void | unregister(String service,
int port)Remove the service,
only if it is registered with the supplied port. |
public static final int DEFAULT_CONSOLE_PORT
public static final String DEFAULT_HOST
public static final int DEFAULT_HTTPS_CONSOLE_PORT
public static final String PROP_PREFER_HTTPS
public static final String SVC_BOB
public static final String SVC_CONSOLE
public static final String SVC_EEPSITE
public static final String SVC_HTTP_I2PCONTROL
public static final String SVC_HTTP_PROXY
public static final String SVC_HTTPS_CONSOLE
public static final String SVC_HTTPS_EEPSITE
public static final String SVC_HTTPS_I2PCONTROL
public static final String SVC_HTTPS_PROXY
public static final String SVC_I2CP
public static final String SVC_I2CP_SSL
public static final String SVC_I2PSNARK
public static final String SVC_I2PTUNNEL
public static final String SVC_IMAGEGEN
public static final String SVC_IRC
public static final String SVC_JSONRPC
public static final String SVC_POP
public static final String SVC_SAM
public static final String SVC_SAM_SSL
public static final String SVC_SAM_UDP
public static final String SVC_SMTP
public static final String SVC_SOCKS
public static final String SVC_SUSIDNS
public static final String SVC_SUSIMAIL
public static final String SVC_TAHOE
public PortMapper(I2PAppContext context)
context - unused for nowpublic String getActualHost(String service, String def)
def - defaultpublic String getConsoleURL()
public String getConsoleURL(boolean preferHTTPS)
public List<String> getEepsiteURLs()
public String getHost(String service, String def)
def - defaultpublic int getPort(String service)
service - the service namepublic int getPort(String service, int def)
service - the service namedef - defaultpublic boolean isRegistered(String service)
service - the service namepublic boolean register(String service, int port)
service - the service nameport - > 0public boolean register(String service, String host, int port)
service - the service namehost - the hostnameport - > 0public void renderStatusHTML(Writer out) throws IOException
IOExceptionpublic void unregister(String service)
service - the service namepublic void unregister(String service, int port)
service - the service nameport - the port number