I2CP: Add config to disable loopback for testing

This commit is contained in:
zzz
2019-10-23 14:02:30 +00:00
parent 3ed8620e5a
commit 129e474ecb

View File

@@ -79,6 +79,8 @@ class ClientManager {
private static final String PROP_DISABLE_EXTERNAL = "i2cp.disableInterface"; private static final String PROP_DISABLE_EXTERNAL = "i2cp.disableInterface";
/** SSL interface (only) @since 0.8.3 */ /** SSL interface (only) @since 0.8.3 */
private static final String PROP_ENABLE_SSL = "i2cp.SSL"; private static final String PROP_ENABLE_SSL = "i2cp.SSL";
/** Disable local-local "loopback", force all traffic through tunnels @since 0.9.44 */
private static final String PROP_DISABLE_LOOPBACK = "i2cp.disableLoopback";
private static final int INTERNAL_QUEUE_SIZE = 256; private static final int INTERNAL_QUEUE_SIZE = 256;
@@ -431,8 +433,13 @@ class ClientManager {
*/ */
void distributeMessage(Destination fromDest, Destination toDest, Payload payload, void distributeMessage(Destination fromDest, Destination toDest, Payload payload,
MessageId msgId, long messageNonce, long expiration, int flags) { MessageId msgId, long messageNonce, long expiration, int flags) {
// check if there is a runner for it ClientConnectionRunner runner;
ClientConnectionRunner runner = getRunner(toDest); if (_ctx.getBooleanProperty(PROP_DISABLE_LOOPBACK)) {
runner = null;
} else {
// check if there is a runner for it
runner = getRunner(toDest);
}
if (runner != null) { if (runner != null) {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("Message " + msgId + " is targeting a local destination. distribute it as such"); _log.debug("Message " + msgId + " is targeting a local destination. distribute it as such");