combine help strings

This commit is contained in:
zzz
2014-02-04 14:32:36 +00:00
parent 0cd774273c
commit 936f2bb317

View File

@@ -312,30 +312,30 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
* @param l logger to receive events and output
*/
private static void runHelp(Logging l) {
l.log("Command list:");
l.log("Command list:\n" +
// alphabetical please...
l.log(" auth <username> <password>");
l.log(" client <port> <pubkey>[,<pubkey,...]|file:<pubkeyfile> [<sharedClient>]");
l.log(" clientoptions [-acx] [key=value ]*");
l.log(" close [forced] <jobnumber>|all");
l.log(" config [-s] <i2phost> <i2pport>");
l.log(" connectclient <port> [<sharedClient>] [<proxy>]");
l.log(" genkeys <privkeyfile> [<pubkeyfile>]");
l.log(" gentextkeys");
l.log(" httpbidirserver <host> <port> <proxyport> <spoofedhost> <privkeyfile>");
l.log(" httpclient <port> [<sharedClient>] [<proxy>]");
l.log(" httpserver <host> <port> <spoofedhost> <privkeyfile>");
l.log(" ircclient <port> <pubkey>[,<pubkey,...]|file:<pubkeyfile> [<sharedClient>]");
l.log(" list");
l.log(" listen_on <ip>");
l.log(" lookup <name>");
l.log(" owndest yes|no");
l.log(" ping <args>");
l.log(" quit");
l.log(" read_timeout <msecs>");
l.log(" run <commandfile>");
l.log(" server <host> <port> <privkeyfile>");
l.log(" textserver <host> <port> <privkey>");
" auth <username> <password>\n" +
" client <port> <pubkey>[,<pubkey,...]|file:<pubkeyfile> [<sharedClient>]\n" +
" clientoptions [-acx] [key=value ]*\n" +
" close [forced] <jobnumber>|all\n" +
" config [-s] <i2phost> <i2pport>\n" +
" connectclient <port> [<sharedClient>] [<proxy>]\n" +
" genkeys <privkeyfile> [<pubkeyfile>]\n" +
" gentextkeys\n" +
" httpbidirserver <host> <port> <proxyport> <spoofedhost> <privkeyfile>\n" +
" httpclient <port> [<sharedClient>] [<proxy>]\n" +
" httpserver <host> <port> <spoofedhost> <privkeyfile>\n" +
" ircclient <port> <pubkey>[,<pubkey,...]|file:<pubkeyfile> [<sharedClient>]\n" +
" list\n" +
" listen_on <ip>\n" +
" lookup <name>\n" +
" owndest yes|no\n" +
" ping <args>\n" +
" quit\n" +
" read_timeout <msecs>\n" +
" run <commandfile>\n" +
" server <host> <port> <privkeyfile>\n" +
" textserver <host> <port> <privkey>\n");
}
/**
@@ -378,12 +378,12 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
_clientOptions.setProperty(key, val);
}
} else {
l.log("Usage:");
l.log(" clientoptions [key=value ]* // sets current options");
l.log(" clientoptions -a [key=value ]* // adds to current options");
l.log(" clientoptions -c // clears current options");
l.log(" clientoptions -x [key ]* // removes listed options");
l.log("Current options:");
l.log("Usage:\n" +
" clientoptions [key=value ]* // sets current options\n" +
" clientoptions -a [key=value ]* // adds to current options\n" +
" clientoptions -c // clears current options\n" +
" clientoptions -x [key ]* // removes listed options\n" +
"Current options:\n");
Properties p = new OrderedProperties();
p.putAll(_clientOptions);
for (Map.Entry<Object, Object> e : p.entrySet()) {
@@ -466,8 +466,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
notifyEvent("serverTaskId", Integer.valueOf(serv.getId()));
return;
} else {
l.log("server <host> <port> <privkeyfile>");
l.log(" creates a server that sends all incoming data\n" + " of its destination to host:port.");
l.log("server <host> <port> <privkeyfile>\n" +
" creates a server that sends all incoming data\n" + " of its destination to host:port.");
notifyEvent("serverTaskId", Integer.valueOf(-1));
}
}
@@ -517,8 +517,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
notifyEvent("serverTaskId", Integer.valueOf(serv.getId()));
return;
} else {
l.log("server <host> <port> <privkeyfile>");
l.log(" creates a server that sends all incoming data\n" + " of its destination to host:port.");
l.log("server <host> <port> <privkeyfile>\n" +
" creates a server that sends all incoming data\n" + " of its destination to host:port.");
notifyEvent("serverTaskId", Integer.valueOf(-1));
}
}
@@ -578,8 +578,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
notifyEvent("serverTaskId", Integer.valueOf(serv.getId()));
return;
} else {
l.log("httpserver <host> <port> <spoofedhost> <privkeyfile>");
l.log(" creates an HTTP server that sends all incoming data\n"
l.log("httpserver <host> <port> <spoofedhost> <privkeyfile>\n" +
" creates an HTTP server that sends all incoming data\n"
+ " of its destination to host:port., filtering the HTTP\n"
+ " headers so it looks like the request is to the spoofed host.");
notifyEvent("serverTaskId", Integer.valueOf(-1));
@@ -654,8 +654,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
notifyEvent("serverTaskId", Integer.valueOf(serv.getId()));
return;
} else {
l.log("httpserver <host> <port> <proxyport> <spoofedhost> <privkeyfile>");
l.log(" creates a bidirectional HTTP server that sends all incoming data\n"
l.log("httpserver <host> <port> <proxyport> <spoofedhost> <privkeyfile>\n" +
" creates a bidirectional HTTP server that sends all incoming data\n"
+ " of its destination to host:port., filtering the HTTP\n"
+ " headers so it looks like the request is to the spoofed host,"
+ " and listens to host:proxyport to proxy HTTP requests.");
@@ -707,8 +707,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
addtask(serv);
notifyEvent("serverTaskId", Integer.valueOf(serv.getId()));
} else {
l.log("textserver <host> <port> <privkey>");
l.log(" creates a server that sends all incoming data\n" + " of its destination to host:port.");
l.log("textserver <host> <port> <privkey>\n" +
" creates a server that sends all incoming data\n" + " of its destination to host:port.");
notifyEvent("textserverTaskId", Integer.valueOf(-1));
}
}
@@ -765,8 +765,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
throw iae;
}
} else {
l.log("client <port> <pubkey>[,<pubkey>]|file:<pubkeyfile>[ <sharedClient>] [<privKeyFile>]");
l.log(" creates a client that forwards port to the pubkey.\n"
l.log("client <port> <pubkey>[,<pubkey>]|file:<pubkeyfile>[ <sharedClient>] [<privKeyFile>]\n" +
" creates a client that forwards port to the pubkey.\n"
+ " use 0 as port to get a free port assigned. If you specify\n"
+ " a comma delimited list of pubkeys, it will rotate among them\n"
+ " randomlyl. sharedClient indicates if this client shares \n"
@@ -841,11 +841,11 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
throw iae;
}
} else {
l.log("httpclient <port> [<sharedClient>] [<proxy>]");
l.log(" creates a client that distributes HTTP requests.");
l.log(" <sharedClient> (optional) indicates if this client shares tunnels with other clients (true of false)");
l.log(" <proxy> (optional) indicates a proxy server to be used");
l.log(" when trying to access an address out of the .i2p domain");
l.log("httpclient <port> [<sharedClient>] [<proxy>]\n" +
" creates a client that distributes HTTP requests.\n" +
" <sharedClient> (optional) indicates if this client shares tunnels with other clients (true of false)\n" +
" <proxy> (optional) indicates a proxy server to be used\n" +
" when trying to access an address out of the .i2p domain");
notifyEvent("httpclientTaskId", Integer.valueOf(-1));
}
}
@@ -908,11 +908,11 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
throw iae;
}
} else {
l.log("connectclient <port> [<sharedClient>] [<proxy>]");
l.log(" creates a client that for SSL/HTTPS requests.");
l.log(" <sharedClient> (optional) indicates if this client shares tunnels with other clients (true of false)");
l.log(" <proxy> (optional) indicates a proxy server to be used");
l.log(" when trying to access an address out of the .i2p domain");
l.log("connectclient <port> [<sharedClient>] [<proxy>]\n" +
" creates a client that for SSL/HTTPS requests.\n" +
" <sharedClient> (optional) indicates if this client shares tunnels with other clients (true of false)\n" +
" <proxy> (optional) indicates a proxy server to be used\n" +
" when trying to access an address out of the .i2p domain\n");
}
}
@@ -975,9 +975,9 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
throw iae;
}
} else {
l.log("ircclient <port> [<sharedClient> [<privKeyFile>]]");
l.log(" creates a client that filter IRC protocol.");
l.log(" <sharedClient> (optional) indicates if this client shares tunnels with other clients (true of false)");
l.log("ircclient <port> [<sharedClient> [<privKeyFile>]]\n" +
" creates a client that filter IRC protocol.\n" +
" <sharedClient> (optional) indicates if this client shares tunnels with other clients (true of false)\n");
notifyEvent("ircclientTaskId", Integer.valueOf(-1));
}
}
@@ -1028,8 +1028,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
throw iae;
}
} else {
l.log("sockstunnel <port>");
l.log(" creates a tunnel that distributes SOCKS requests.");
l.log("sockstunnel <port>\n" +
" creates a tunnel that distributes SOCKS requests.");
notifyEvent("sockstunnelTaskId", Integer.valueOf(-1));
}
}
@@ -1075,8 +1075,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
throw iae;
}
} else {
l.log("socksirctunnel <port> [<sharedClient> [<privKeyFile>]]");
l.log(" creates a tunnel for SOCKS IRC.");
l.log("socksirctunnel <port> [<sharedClient> [<privKeyFile>]]\n" +
" creates a tunnel for SOCKS IRC.");
notifyEvent("sockstunnelTaskId", Integer.valueOf(-1));
}
}
@@ -1125,8 +1125,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
throw iae;
}
} else {
l.log("streamrclient <host> <port> <destination>");
l.log(" creates a tunnel that receives streaming data.");
l.log("streamrclient <host> <port> <destination>\n" +
" creates a tunnel that receives streaming data.");
notifyEvent("streamrtunnelTaskId", Integer.valueOf(-1));
}
}
@@ -1166,8 +1166,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
addtask(task);
notifyEvent("streamrtunnelTaskId", Integer.valueOf(task.getId()));
} else {
l.log("streamrserver <port> <privkeyfile>");
l.log(" creates a tunnel that sends streaming data.");
l.log("streamrserver <port> <privkeyfile>\n" +
" creates a tunnel that sends streaming data.");
notifyEvent("streamrtunnelTaskId", Integer.valueOf(-1));
}
}
@@ -1195,12 +1195,12 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
port = args[i];
notifyEvent("configResult", "ok");
} else {
l.log("Usage:");
l.log(" config [-s] <i2phost> <i2pport>");
l.log(" sets the connection to the i2p router.");
l.log("Current setting:");
boolean ssl = Boolean.parseBoolean(_clientOptions.getProperty("i2cp.SSL"));
l.log(" " + host + ' ' + port + (ssl ? " SSL" : ""));
l.log("Usage:\n" +
" config [-s] <i2phost> <i2pport>\n" +
" sets the connection to the i2p router.\n" +
"Current setting:\n" +
" " + host + ' ' + port + (ssl ? " SSL" : ""));
notifyEvent("configResult", "error");
}
}
@@ -1217,9 +1217,9 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
_clientOptions.setProperty("i2cp.username", args[0]);
_clientOptions.setProperty("i2cp.password", args[1]);
} else {
l.log("Usage:");
l.log(" auth <username> <password>");
l.log(" Sets the i2cp credentials");
l.log("Usage:\n" +
" auth <username> <password>\n" +
" Sets the i2cp credentials");
}
}
@@ -1237,8 +1237,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
ownDest = args[0].equalsIgnoreCase("yes");
notifyEvent("owndestResult", "ok");
} else {
l.log("owndest yes|no");
l.log(" Specifies whether to use its own destination \n" + " for each outgoing tunnel");
l.log("owndest yes|no\n" +
" Specifies whether to use its own destination \n" + " for each outgoing tunnel");
notifyEvent("owndestResult", "error");
}
}
@@ -1256,8 +1256,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
listenHost = args[0];
notifyEvent("listen_onResult", "ok");
} else {
l.log("listen_on <ip>");
l.log(" sets the interface to listen for the I2PClient.");
l.log("listen_on <ip>\n" +
" sets the interface to listen for the I2PClient.");
notifyEvent("listen_onResult", "error");
}
}
@@ -1279,8 +1279,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
}
notifyEvent("read_timeoutResult", "ok");
} else {
l.log("read_timeout <msecs>");
l.log(" sets the read timeout (in milliseconds) for I2P connections\n"
l.log("read_timeout <msecs>\n" +
" sets the read timeout (in milliseconds) for I2P connections\n"
+" Negative values will make the connections wait forever");
notifyEvent("read_timeoutResult", "error");
}
@@ -1307,8 +1307,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
return;
}
} else if (args.length != 1) {
l.log("genkeys <privkeyfile> [<pubkeyfile>]");
l.log(" creates a new keypair and prints the public key.\n"
l.log("genkeys <privkeyfile> [<pubkeyfile>]\n" +
" creates a new keypair and prints the public key.\n"
+ " if pubkeyfile is given, saves the public key there." + "\n"
+ " if the privkeyfile already exists, just print/save" + "the pubkey.");
//notifyEvent("genkeysResult", "error");
@@ -1394,8 +1394,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
*/
public void runClose(String args[], Logging l) {
if (args.length == 0 || args.length > 2) {
l.log("close [forced] <jobnumber>|all");
l.log(" stop running tasks. either only one or all.\n"
l.log("close [forced] <jobnumber>|all\n" +
" stop running tasks. either only one or all.\n"
+ " use 'forced' to also stop tasks with active connections.\n"
+ " use the 'list' command to show the job numbers");
notifyEvent("closeResult", "error");
@@ -1456,8 +1456,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
notifyEvent("runResult", "error");
}
} else {
l.log("run <commandfile>");
l.log(" loads commandfile and runs each line in it. \n"
l.log("run <commandfile>\n" +
" loads commandfile and runs each line in it. \n"
+ " You can also give the filename on the commandline.");
notifyEvent("runResult", "error");
}
@@ -1474,8 +1474,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
*/
private void runLookup(String args[], Logging l) {
if (args.length != 1) {
l.log("lookup <name>");
l.log(" try to resolve the name into a destination key");
l.log("lookup <name>\n" +
" try to resolve the name into a destination key");
notifyEvent("lookupResult", "invalidUsage");
} else {
try {
@@ -1597,8 +1597,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
l.log("Generating new keys...");
I2PClient client = I2PClientFactory.createClient();
Destination d = client.createDestination(writeTo);
l.log("Secret key saved.");
l.log("Public key: " + d.toBase64());
l.log("Secret key saved.\n" +
"Public key: " + d.toBase64());
writeTo.flush();
writeTo.close();
writePubKey(d, pubDest, l);