com.mortbay.Util
Class InetGateway
java.lang.Object
|
+--com.mortbay.Util.ThreadedServer
|
+--com.mortbay.Util.InetGateway
- public class InetGateway
- extends ThreadedServer
IP gateway.
Forwards IP connections to another IP:port address and copies
all data received in both directions. Suitable for opening up
a specific port through a firewall.
Notes
A property file can be used to specify multiple addresses
for forwarding. See the example propertyFile.prp file for
details.
Usage
java com.mortbay.Util.InetGateway [-dump|-summary] [LocalHost:]LocalPort ForwardHost:ForwardPort
java com.mortbay.Util.InetGateway propertyFile.prp
- Version:
- 1.0 Thu Feb 11 1999
- Author:
- Greg Wilkins (inspired by M Watson and J Gosnell)
Method Summary |
protected void |
handleConnection(java.io.InputStream in,
java.io.OutputStream out)
Handle new connection
This method should be overridden by the derived class to implement
the required handling. |
static void |
main(java.lang.String[] argv)
|
static void |
runGateways(java.lang.String propFile)
|
static void |
usage()
|
Methods inherited from class com.mortbay.Util.ThreadedServer |
accept,
address,
getInetAddress,
getInetAddrPort,
getMaxIdleTimeMs,
getMaxSize,
getMinSize,
getPort,
getSize,
handleConnection,
join,
newServerSocket,
port,
run,
setAddress,
setAddress,
setThreadClass,
start,
stop |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
InetGateway
public InetGateway(InetAddrPort local,
InetAddrPort remote)
throws java.io.IOException
- Constructor.
- Parameters:
local
- Listen address and port.remote
- Forward address and port.- Throws:
- java.io.IOException - Problem listening on local port.
InetGateway
public InetGateway(InetAddrPort local,
InetAddrPort remote,
java.lang.String[] l2rFilters,
java.lang.String[] r2lFilters)
throws java.io.IOException
- Constructor.
- Parameters:
local
- Listen address and port.remote
- Forward address and port.l2rFilters
- Array of class names of FilterOutputStream derived
classes used to filter data from local to remote.r2lFilters
- Array of class names of FilterOutputStream derived
classes used to filter data from remote to remote.- Throws:
- java.io.IOException - Problem listening on local port.
handleConnection
protected void handleConnection(java.io.InputStream in,
java.io.OutputStream out)
- Description copied from class: ThreadedServer
- Handle new connection
This method should be overridden by the derived class to implement
the required handling. It is called by a thread created for it and
does not need to return until it has finished it's task
- Overrides:
- handleConnection in class ThreadedServer
usage
public static void usage()
runGateways
public static void runGateways(java.lang.String propFile)
throws java.io.IOException
main
public static void main(java.lang.String[] argv)