public class I2PTunnelHTTPServer extends I2PTunnelServer
Extends I2PTunnelServer to filter HTTP headers from client to server, replacing the Host header with configured value. Compresses HTTP message body and sets Content-Encoding: x-i2p-gzip when browser requests Accept-Encoding: x-i2p-gzip.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_POST_BAN_TIME
all of these in SECONDS
|
static int |
DEFAULT_POST_MAX |
static int |
DEFAULT_POST_TOTAL_BAN_TIME |
static int |
DEFAULT_POST_TOTAL_MAX |
static int |
DEFAULT_POST_WINDOW |
(package private) static String |
ERR_FORBIDDEN |
(package private) static String |
ERR_NOT_FOUND |
protected static String |
ERR_REQUEST_TIMEOUT |
static String |
OPT_ADD_RESPONSE_HEADER_ALLOW |
static String |
OPT_ADD_RESPONSE_HEADER_CACHE_CONTROL |
static String |
OPT_ADD_RESPONSE_HEADER_NOSNIFF |
static String |
OPT_ADD_RESPONSE_HEADER_REFERRER_POLICY |
static String |
OPT_KEEPALIVE |
static String |
OPT_POST_BAN_TIME |
static String |
OPT_POST_MAX |
static String |
OPT_POST_TOTAL_BAN_TIME |
static String |
OPT_POST_TOTAL_MAX |
static String |
OPT_POST_WINDOW |
static String |
OPT_REJECT_INPROXY |
static String |
OPT_REJECT_REFERER |
static String |
OPT_REJECT_USER_AGENTS |
static String |
OPT_USER_AGENTS |
__serverId, _clientExecutor, _log, bidir, i2pss, l, localPort, PROP_ALT_PKF, PROP_UNIQUE_LOCAL, PROP_USE_SSL, readTimeout, remoteHost, remotePort, slock, sockMgr, sslLock, taskopen, tunnel| Constructor and Description |
|---|
I2PTunnelHTTPServer(InetAddress host,
int port,
File privkey,
String privkeyname,
String spoofHost,
Logging l,
EventDispatcher notifyThis,
I2PTunnel tunnel) |
I2PTunnelHTTPServer(InetAddress host,
int port,
InputStream privData,
String privkeyname,
String spoofHost,
Logging l,
EventDispatcher notifyThis,
I2PTunnel tunnel) |
I2PTunnelHTTPServer(InetAddress host,
int port,
String privData,
String spoofHost,
Logging l,
EventDispatcher notifyThis,
I2PTunnel tunnel) |
| Modifier and Type | Method and Description |
|---|---|
(package private) static void |
addEntry(Map<String,List<String>> headers,
String key,
String value)
Add an entry to the multimap.
|
protected void |
blockingHandle(I2PSocket socket)
Called by the thread pool of I2PSocket handlers
|
boolean |
close(boolean forced)
Note that the tunnel can be reopened after this by calling startRunning().
|
protected static String |
formatHeaders(Map<String,List<String>> headers,
StringBuilder command) |
protected static String |
formatHeadersCompact(Map<String,List<String>> headers,
StringBuilder command) |
void |
optionsUpdated(I2PTunnel tunnel)
Update the I2PSocketManager.
|
static Map<String,List<String>> |
readHeaders(I2PSocket socket,
InputStream in,
StringBuilder command,
Set<String> skipHeaders,
I2PAppContext ctx,
long initialTimeout)
From I2P to server: socket non-null, in null.
|
static Map<String,List<String>> |
readHeaders(I2PSocket socket,
InputStream in,
StringBuilder command,
String[] skipHeaders,
I2PAppContext ctx,
long initialTimeout) |
(package private) static void |
setEntry(Map<String,List<String>> headers,
String key,
String value)
Remove the other matching entries and set this entry as the only one.
|
void |
startRunning()
Start running the I2PTunnelServer.
|
destroy, getReadTimeout, getSocket, getSocket, getSocketString, run, setReadTimeout, shutdownAndAwaitTerminationconnected, disconnected, errorOccurred, getBooleanOption, getId, getTunnel, isOpen, reportAbuse, routerDisconnected, setId, setName, setTunnel, toStringattachEventDispatcher, detachEventDispatcher, getEventDispatcher, getEvents, getEventValue, ignoreEvents, notifyEvent, unIgnoreEvents, waitEventValuepublic static final int DEFAULT_POST_BAN_TIME
public static final int DEFAULT_POST_MAX
public static final int DEFAULT_POST_TOTAL_BAN_TIME
public static final int DEFAULT_POST_TOTAL_MAX
public static final int DEFAULT_POST_WINDOW
static final String ERR_FORBIDDEN
static final String ERR_NOT_FOUND
protected static final String ERR_REQUEST_TIMEOUT
public static final String OPT_ADD_RESPONSE_HEADER_ALLOW
public static final String OPT_ADD_RESPONSE_HEADER_CACHE_CONTROL
public static final String OPT_ADD_RESPONSE_HEADER_NOSNIFF
public static final String OPT_ADD_RESPONSE_HEADER_REFERRER_POLICY
public static final String OPT_KEEPALIVE
public static final String OPT_POST_BAN_TIME
public static final String OPT_POST_MAX
public static final String OPT_POST_TOTAL_BAN_TIME
public static final String OPT_POST_TOTAL_MAX
public static final String OPT_POST_WINDOW
public static final String OPT_REJECT_INPROXY
public static final String OPT_REJECT_REFERER
public static final String OPT_REJECT_USER_AGENTS
public static final String OPT_USER_AGENTS
public I2PTunnelHTTPServer(InetAddress host, int port, File privkey, String privkeyname, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel)
public I2PTunnelHTTPServer(InetAddress host, int port, InputStream privData, String privkeyname, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel)
public I2PTunnelHTTPServer(InetAddress host, int port, String privData, String spoofHost, Logging l, EventDispatcher notifyThis, I2PTunnel tunnel)
static void addEntry(Map<String,List<String>> headers, String key, String value)
protected void blockingHandle(I2PSocket socket)
blockingHandle in class I2PTunnelServersocket - the incoming I2P connection from a remote peer; never nullI2PTunnelServer.getSocket(Hash, int),
I2PTunnelRunnerpublic boolean close(boolean forced)
I2PTunnelServerclose in class I2PTunnelServerprotected static String formatHeaders(Map<String,List<String>> headers, StringBuilder command)
protected static String formatHeadersCompact(Map<String,List<String>> headers, StringBuilder command)
public void optionsUpdated(I2PTunnel tunnel)
I2PTunnelServeroptionsUpdated in class I2PTunnelServerpublic static Map<String,List<String>> readHeaders(I2PSocket socket, InputStream in, StringBuilder command, Set<String> skipHeaders, I2PAppContext ctx, long initialTimeout) throws IOException
socket - if null, use in as InputStreamin - if null, use socket.getInputStream() as InputStreamcommand - out parameter, first lineskipHeaders - MUST be lower caseSocketTimeoutException - if timeout is reached before newlineEOFException - if EOF is reached before newlineLineTooLongException - if one header too long, or too many headers, or total size too bigRequestTooLongException - if too longBadRequestException - on bad headersIOException - on other errors in the underlying streampublic static Map<String,List<String>> readHeaders(I2PSocket socket, InputStream in, StringBuilder command, String[] skipHeaders, I2PAppContext ctx, long initialTimeout) throws IOException
IOExceptionstatic void setEntry(Map<String,List<String>> headers, String key, String value)
public void startRunning()
I2PTunnelServerstartRunning in class I2PTunnelServer