|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.i2ptunnel.TunnelManager
Quick and dirty socket listener to control an I2PTunnel. Basically run this class as TunnelManager [listenHost] [listenPort] and then send it commands on that port. Commands are one shot deals - Send a command + newline, get a response plus newline, then get disconnected.
Implemented commands:------------------------------------------------- lookup <name>\n -- <base64 of the destination>\n or <error message, usually 'Unknown host'>\n Lookup the public key of a named destination (i.e. listed in hosts.txt) ------------------------------------------------- genkey\n -- <base64 of the destination>\t<base64 of private data>\n Generates a new public and private key pair ------------------------------------------------- convertprivate <base64 of privkey> -- <base64 of destination>\n or <error message>\n Returns the destination (pubkey) of a given private key. ------------------------------------------------- listen_on <ip>\n -- ok\n or error\n Sets the ip address clients will listen on. By default this is the localhost (127.0.0.1) ------------------------------------------------- openclient <listenPort> <peer>\n -- ok [<jobId>]\n or ok <listenPort> [<jobId>]\n or error\n Open a tunnel on the given <listenport> to the destination specified by <peer>. If <listenPort> is 0 a free port is picked and returned in the reply message. Otherwise the short reply message is used. Peer can be the base64 of the destination, a file with the public key specified as 'file:<filename>' or the name of a destination listed in hosts.txt. The <jobId> returned together with "ok" and <listenport> can later be used as argument for the "close" command. ------------------------------------------------- openhttpclient <listenPort> [<proxy>]\n -- ok [<jobId>]\n or ok <listenPort> [<jobId>]\n or error\n Open an HTTP proxy through the I2P on the given <listenport>. <proxy> (optional) specifies a destination to be used as an outbound proxy, to access normal WWW sites out of the .i2p domain. If <listenPort> is 0 a free port is picked and returned in the reply message. Otherwise the short reply message is used. <proxy> can be the base64 of the destination, a file with the public key specified as 'file:<filename>' or the name of a destination listed in hosts.txt. The <jobId> returned together with "ok" and <listenport> can later be used as argument for the "close" command. ------------------------------------------------- opensockstunnel <listenPort>\n -- ok [<jobId>]\n or ok <listenPort> [<jobId>]\n or error\n Open an SOCKS tunnel through the I2P on the given <listenport>. If <listenPort> is 0 a free port is picked and returned in the reply message. Otherwise the short reply message is used. The <jobId> returned together with "ok" and <listenport> can later be used as argument for the "close" command. ------------------------------------------------- openserver <serverHost> <serverPort> <serverKeys>\n -- ok [<jobId>]\n or error\n Starts receiving traffic for the destination specified by <serverKeys> and forwards it to the <serverPort> of <serverHost>. <serverKeys> is the base 64 encoded private key set of the local destination. The <joId> returned together with "ok" can later be used as argument for the "close" command. ------------------------------------------------- close [forced] <jobId>\n or close [forced] all\n -- ok\n or error\n Closes the job specified by <jobId> or all jobs. Use the list command for a list of running jobs. Normally a connection job is not closed when it still has an active connection. Use the optional 'forced' keyword to close connections regardless of their use. ------------------------------------------------- list\n -- Example output: [0] i2p.dnsalias.net/69.55.226.145:5555 <- C:\i2pKeys\squidPriv [1] 8767 -> HTTPClient [2] 7575 -> file:C:\i2pKeys\squidPub [3] 5252 -> sCcSANIO~f4AQtCNI1BvDp3ZBS~9Ag5O0k0Msm7XBWWz5eOnZWL3MQ-2rxlesucb9XnpASGhWzyYNBpWAfaIB3pux1J1xujQLOwscMIhm7T8BP76Ly5jx6BLZCYrrPj0BI0uV90XJyT~4UyQgUlC1jzFQdZ9HDgBPJDf1UI4-YjIwEHuJgdZynYlQ1oUFhgno~HhcDByXO~PDaO~1JDMDbBEfIh~v6MgmHp-Xchod1OfKFrxFrzHgcJbn7E8edTFjZA6JCi~DtFxFelQz1lSBd-QB1qJnA0g-pVL5qngNUojXJCXs4qWcQ7ICLpvIc-Fpfj-0F1gkVlGDSGkb1yLH3~8p4czYgR3W5D7OpwXzezz6clpV8kmbd~x2SotdWsXBPRhqpewO38coU4dJG3OEUbuYmdN~nJMfWbmlcM1lXzz2vBsys4sZzW6dV3hZnbvbfxNTqbdqOh-KXi1iAzXv7CVTun0ubw~CfeGpcAqutC5loRUq7Mq62ngOukyv8Z9AAAA Lists descriptions of all running jobs. The exact format of the description depends on the type of job. -------------------------------------------------
Constructor Summary | |
TunnelManager(int listenPort)
|
|
TunnelManager(java.lang.String listenHost,
int listenPort)
|
Method Summary | |
void |
error(java.lang.String msg,
java.io.OutputStream out)
|
static void |
main(java.lang.String[] args)
|
void |
processClose(java.lang.String which,
boolean forced,
java.io.OutputStream out)
|
void |
processConvertPrivate(java.lang.String priv,
java.io.OutputStream out)
|
void |
processGenKey(java.io.OutputStream out)
"genkey" returns with the base64 of the destination, followed by a tab, then the base64 of that destination's private keys, then a newline. |
void |
processList(java.io.OutputStream out)
|
void |
processListenOn(java.lang.String ip,
java.io.OutputStream out)
|
void |
processLookup(java.lang.String name,
java.io.OutputStream out)
"lookup |
void |
processOpenClient(int listenPort,
java.lang.String peer,
java.io.OutputStream out)
|
void |
processOpenHTTPClient(int listenPort,
java.lang.String proxy,
java.io.OutputStream out)
|
void |
processOpenServer(java.lang.String serverHost,
int serverPort,
java.lang.String privateKeys,
java.io.OutputStream out)
|
void |
processOpenSOCKSTunnel(int listenPort,
java.io.OutputStream out)
|
void |
processQuit(java.io.OutputStream out)
|
void |
processTestDestination(java.lang.String destKey,
java.io.OutputStream out)
|
void |
run()
|
void |
unknownCommand(java.lang.String command,
java.io.OutputStream out)
Frisbee. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TunnelManager(int listenPort)
public TunnelManager(java.lang.String listenHost, int listenPort)
Method Detail |
public static void main(java.lang.String[] args)
public void run()
run
in interface java.lang.Runnable
public void error(java.lang.String msg, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void processQuit(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void processList(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void processListenOn(java.lang.String ip, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void processLookup(java.lang.String name, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void processTestDestination(java.lang.String destKey, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void processConvertPrivate(java.lang.String priv, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void processClose(java.lang.String which, boolean forced, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void processGenKey(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void processOpenClient(int listenPort, java.lang.String peer, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void processOpenHTTPClient(int listenPort, java.lang.String proxy, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void processOpenSOCKSTunnel(int listenPort, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void processOpenServer(java.lang.String serverHost, int serverPort, java.lang.String privateKeys, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void unknownCommand(java.lang.String command, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |