I2CP: Consolidate all the port 7654 definitions

This commit is contained in:
zzz
2018-12-03 15:22:36 +00:00
parent af2eea5916
commit 5e7a277e98
15 changed files with 44 additions and 28 deletions

View File

@@ -97,7 +97,7 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
public boolean ownDest = false;
/** the I2CP port, non-null */
public String port = System.getProperty(I2PClient.PROP_TCP_PORT, "7654");
public String port = System.getProperty(I2PClient.PROP_TCP_PORT, Integer.toString(I2PSession.DEFAULT_LISTEN_PORT));
/** the I2CP host, non-null */
public String host = System.getProperty(I2PClient.PROP_TCP_HOST, "127.0.0.1");
/** the listen-on host. Sadly the listen-on port does not have a field. */

View File

@@ -409,7 +409,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
Log _log = tunnel.getContext().logManager().getLog(I2PTunnelClientBase.class);
Properties props = new Properties();
props.putAll(tunnel.getClientOptions());
int portNum = 7654;
int portNum = I2PSession.DEFAULT_LISTEN_PORT;
if (tunnel.port != null) {
try {
portNum = Integer.parseInt(tunnel.port);
@@ -471,7 +471,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
// try to make this error sensible as it will happen...
String portNum = getTunnel().port;
if (portNum == null)
portNum = "7654";
portNum = Integer.toString(I2PSession.DEFAULT_LISTEN_PORT);
String msg;
if (getTunnel().getContext().isRouterContext())
msg = "Unable to build tunnels for the client";

View File

@@ -210,7 +210,7 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
private I2PSocketManager createManager(InputStream privData) {
Properties props = new Properties();
props.putAll(getTunnel().getClientOptions());
int portNum = 7654;
int portNum = I2PSession.DEFAULT_LISTEN_PORT;
if (getTunnel().port != null) {
try {
portNum = Integer.parseInt(getTunnel().port);
@@ -305,7 +305,7 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
// try to make this error sensible as it will happen...
String portNum = getTunnel().port;
if (portNum == null)
portNum = "7654";
portNum = Integer.toString(I2PSession.DEFAULT_LISTEN_PORT);
String msg;
if (getTunnel().getContext().isRouterContext())
msg = "Unable to build tunnels for the server at " + remoteHost.getHostAddress() + ':' + remotePort;

View File

@@ -733,10 +733,10 @@ public class TunnelController implements Logging {
int portNum = Integer.parseInt(port);
_tunnel.port = String.valueOf(portNum);
} catch (NumberFormatException nfe) {
_tunnel.port = "7654";
_tunnel.port = Integer.toString(I2PSession.DEFAULT_LISTEN_PORT);
}
} else {
_tunnel.port = "7654";
_tunnel.port = Integer.toString(I2PSession.DEFAULT_LISTEN_PORT);
}
}

View File

@@ -11,6 +11,7 @@ import java.util.concurrent.ConcurrentHashMap;
import net.i2p.I2PAppContext;
import net.i2p.client.I2PClient;
import net.i2p.client.I2PSession;
import net.i2p.crypto.KeyGenerator;
import net.i2p.crypto.SigType;
import net.i2p.data.Base64;
@@ -836,7 +837,7 @@ public class TunnelConfig {
if ( (_i2cpPort != null) && (_i2cpPort.trim().length() > 0) ) {
config.setProperty(TunnelController.PROP_I2CP_PORT, _i2cpPort);
} else {
config.setProperty(TunnelController.PROP_I2CP_PORT, "7654");
config.setProperty(TunnelController.PROP_I2CP_PORT, Integer.toString(I2PSession.DEFAULT_LISTEN_PORT));
}
}
if (_privKeyFile != null)

View File

@@ -14,6 +14,7 @@ import java.util.List;
import java.util.Set;
import net.i2p.I2PException;
import net.i2p.client.I2PSession;
import net.i2p.crypto.SigType;
import net.i2p.data.Base64;
import net.i2p.data.DataHelper;
@@ -446,7 +447,7 @@ public class EditBean extends IndexBean {
if (tun != null)
return tun.getI2CPPort();
else
return "7654";
return Integer.toString(I2PSession.DEFAULT_LISTEN_PORT);
}
public String getCustomOptions(int tunnel) {