i2ptunnel: I2Ping CLI tunnel quantity 1

Show current setting for owndest in CLI
Skip a irrelevant log message for I2Ping
Break wait on interrupt
Log level tweaks
This commit is contained in:
zzz
2020-09-27 14:38:44 +00:00
parent 4108007b26
commit cd699c587b
3 changed files with 26 additions and 18 deletions

View File

@ -307,6 +307,7 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
try { try {
wait(); wait();
} catch (InterruptedException ie) { } catch (InterruptedException ie) {
break;
} }
} }
} }
@ -1400,7 +1401,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
notifyEvent("owndestResult", "ok"); notifyEvent("owndestResult", "ok");
} else { } else {
l.log("owndest yes|no\n" + l.log("owndest yes|no\n" +
" Specifies whether to use its own destination \n" + " for each outgoing tunnel"); " Specifies whether to use its own destination \n" + " for each outgoing tunnel\n" +
"Current setting: " + (ownDest ? "yes" : "no (shared client)"));
notifyEvent("owndestResult", "error"); notifyEvent("owndestResult", "error");
} }
} }
@ -1692,6 +1694,10 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
_clientOptions.setProperty("inbound.nickname", "I2Ping"); _clientOptions.setProperty("inbound.nickname", "I2Ping");
if (!_clientOptions.containsKey("outbound.nickname")) if (!_clientOptions.containsKey("outbound.nickname"))
_clientOptions.setProperty("outbound.nickname", "I2Ping"); _clientOptions.setProperty("outbound.nickname", "I2Ping");
if (!_clientOptions.containsKey("inbound.quantity"))
_clientOptions.setProperty("inbound.quantity", "1");
if (!_clientOptions.containsKey("outbound.quantity"))
_clientOptions.setProperty("outbound.quantity", "1");
} }
I2PTunnelClientBase task = new I2Ping(l, ownDest, this, this); I2PTunnelClientBase task = new I2Ping(l, ownDest, this, this);
task.startRunning(); task.startRunning();

View File

@ -564,11 +564,13 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
} }
if (open && listenerReady) { if (open && listenerReady) {
boolean openNow = !Boolean.parseBoolean(getTunnel().getClientOptions().getProperty("i2cp.delayOpen")); if (localPort > 0) { // -1 for I2Ping
if (openNow || chained) boolean openNow = !Boolean.parseBoolean(getTunnel().getClientOptions().getProperty("i2cp.delayOpen"));
l.log("Client ready, listening on " + getTunnel().listenHost + ':' + localPort); if (openNow || chained)
else l.log("Client ready, listening on " + getTunnel().listenHost + ':' + localPort);
l.log("Client ready, listening on " + getTunnel().listenHost + ':' + localPort + ", delaying tunnel open until required"); else
l.log("Client ready, listening on " + getTunnel().listenHost + ':' + localPort + ", delaying tunnel open until required");
}
notifyEvent("openBaseClientResult", "ok"); notifyEvent("openBaseClientResult", "ok");
} else { } else {
l.log("Client error for " + getTunnel().listenHost + ':' + localPort + ", check logs"); l.log("Client error for " + getTunnel().listenHost + ':' + localPort + ", check logs");

View File

@ -550,8 +550,8 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
String val = opts.getProperty(TunnelController.PROP_TUN_GZIP); String val = opts.getProperty(TunnelController.PROP_TUN_GZIP);
if ( (val != null) && (!Boolean.parseBoolean(val)) ) if ( (val != null) && (!Boolean.parseBoolean(val)) )
allowGZIP = false; allowGZIP = false;
if (_log.shouldLog(Log.INFO)) if (_log.shouldDebug())
_log.info("HTTP server encoding header: " + enc + "/" + altEnc); _log.debug("HTTP server encoding header: " + enc + "/" + altEnc);
boolean alt = (altEnc != null) && (altEnc.indexOf("x-i2p-gzip") >= 0); boolean alt = (altEnc != null) && (altEnc.indexOf("x-i2p-gzip") >= 0);
boolean useGZIP = alt || ( (enc != null) && (enc.indexOf("x-i2p-gzip") >= 0) ); boolean useGZIP = alt || ( (enc != null) && (enc.indexOf("x-i2p-gzip") >= 0) );
// Don't pass this on, outproxies should strip so I2P traffic isn't so obvious but they probably don't // Don't pass this on, outproxies should strip so I2P traffic isn't so obvious but they probably don't
@ -646,8 +646,8 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
} }
public void run() { public void run() {
if (_log.shouldLog(Log.INFO)) if (_log.shouldDebug())
_log.info("Compressed requestor running"); _log.debug("Compressed requestor running");
OutputStream serverout = null; OutputStream serverout = null;
OutputStream browserout = null; OutputStream browserout = null;
InputStream browserin = null; InputStream browserin = null;
@ -701,11 +701,11 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
compressedOut.write(DataHelper.getUTF8(modifiedHeaders)); compressedOut.write(DataHelper.getUTF8(modifiedHeaders));
s = new Sender(compressedOut, serverin, "server: server to browser", _log); s = new Sender(compressedOut, serverin, "server: server to browser", _log);
if (_log.shouldLog(Log.INFO)) if (_log.shouldDebug())
_log.info("Before pumping the compressed response"); _log.debug("Before pumping the compressed response");
s.run(); // same thread s.run(); // same thread
if (_log.shouldLog(Log.INFO)) if (_log.shouldDebug())
_log.info("After pumping the compressed response: " + compressedOut.getTotalRead() + "/" + compressedOut.getTotalCompressed()); _log.debug("After pumping the compressed response: " + compressedOut.getTotalRead() + "/" + compressedOut.getTotalCompressed());
} catch (SSLException she) { } catch (SSLException she) {
_log.error("SSL error", she); _log.error("SSL error", she);
try { try {
@ -780,12 +780,12 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
} }
public void run() { public void run() {
if (_log.shouldLog(Log.INFO)) if (_log.shouldDebug())
_log.info(_name + ": Begin sending"); _log.debug(_name + ": Begin sending");
try { try {
DataHelper.copy(_in, _out); DataHelper.copy(_in, _out);
if (_log.shouldLog(Log.INFO)) if (_log.shouldDebug())
_log.info(_name + ": Done sending"); _log.debug(_name + ": Done sending");
//_out.flush(); //_out.flush();
} catch (IOException ioe) { } catch (IOException ioe) {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))