forked from I2P_Developers/i2p.i2p
* Socks: Pass remote port through
* I2PTunnel: More javadoc warnings on default options
This commit is contained in:
@@ -209,8 +209,9 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic options used for clients and servers
|
||||
* @return not a copy
|
||||
* Generic options used for clients and servers.
|
||||
* NOT a copy, Do NOT modify for per-connection options, make a copy.
|
||||
* @return NOT a copy, do NOT modify for per-connection options
|
||||
*/
|
||||
public Properties getClientOptions() { return _clientOptions; }
|
||||
|
||||
|
@@ -471,8 +471,9 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
}
|
||||
|
||||
/**
|
||||
* create the default options (using the default timeout, etc)
|
||||
*
|
||||
* Create the default options (using the default timeout, etc).
|
||||
* Warning, this does not make a copy of I2PTunnel's client options,
|
||||
* it modifies them directly.
|
||||
*/
|
||||
protected I2PSocketOptions getDefaultOptions() {
|
||||
Properties defaultOpts = getTunnel().getClientOptions();
|
||||
@@ -483,8 +484,10 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
||||
}
|
||||
|
||||
/**
|
||||
* create the default options (using the default timeout, etc)
|
||||
*
|
||||
* Create the default options (using the default timeout, etc).
|
||||
* Warning, this does not make a copy of I2PTunnel's client options,
|
||||
* it modifies them directly.
|
||||
* Do not use overrides for per-socket options.
|
||||
*/
|
||||
protected I2PSocketOptions getDefaultOptions(Properties overrides) {
|
||||
Properties defaultOpts = getTunnel().getClientOptions();
|
||||
|
@@ -132,8 +132,9 @@ public class I2PTunnelConnectClient extends I2PTunnelHTTPClientBase implements R
|
||||
}
|
||||
|
||||
/**
|
||||
* create the default options (using the default timeout, etc)
|
||||
*
|
||||
* Create the default options (using the default timeout, etc).
|
||||
* Warning, this does not make a copy of I2PTunnel's client options,
|
||||
* it modifies them directly.
|
||||
*/
|
||||
@Override
|
||||
protected I2PSocketOptions getDefaultOptions() {
|
||||
|
@@ -225,7 +225,9 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
}
|
||||
|
||||
/**
|
||||
* create the default options (using the default timeout, etc)
|
||||
* Create the default options (using the default timeout, etc).
|
||||
* Warning, this does not make a copy of I2PTunnel's client options,
|
||||
* it modifies them directly.
|
||||
* unused?
|
||||
*/
|
||||
@Override
|
||||
@@ -244,8 +246,10 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
}
|
||||
|
||||
/**
|
||||
* create the default options (using the default timeout, etc)
|
||||
*
|
||||
* Create the default options (using the default timeout, etc).
|
||||
* Warning, this does not make a copy of I2PTunnel's client options,
|
||||
* it modifies them directly.
|
||||
* Do not use overrides for per-socket options.
|
||||
*/
|
||||
@Override
|
||||
protected I2PSocketOptions getDefaultOptions(Properties overrides) {
|
||||
@@ -965,12 +969,13 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
return;
|
||||
}
|
||||
|
||||
Properties opts = new Properties();
|
||||
//Properties opts = new Properties();
|
||||
//opts.setProperty("i2p.streaming.inactivityTimeout", ""+120*1000);
|
||||
// 1 == disconnect. see ConnectionOptions in the new streaming lib, which i
|
||||
// dont want to hard link to here
|
||||
//opts.setProperty("i2p.streaming.inactivityTimeoutAction", ""+1);
|
||||
I2PSocketOptions sktOpts = getDefaultOptions(opts);
|
||||
//I2PSocketOptions sktOpts = getDefaultOptions(opts);
|
||||
I2PSocketOptions sktOpts = getDefaultOptions();
|
||||
if (remotePort > 0)
|
||||
sktOpts.setPort(remotePort);
|
||||
I2PSocket i2ps = createI2PSocket(clientDest, sktOpts);
|
||||
|
@@ -15,10 +15,12 @@ import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Properties;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.I2PException;
|
||||
import net.i2p.client.streaming.I2PSocket;
|
||||
import net.i2p.client.streaming.I2PSocketOptions;
|
||||
import net.i2p.data.DataFormatException;
|
||||
import net.i2p.util.HexDump;
|
||||
import net.i2p.util.Log;
|
||||
@@ -203,7 +205,10 @@ public class SOCKS4aServer extends SOCKSServer {
|
||||
// Let's not due a new Dest for every request, huh?
|
||||
//I2PSocketManager sm = I2PSocketManagerFactory.createManager();
|
||||
//destSock = sm.connect(I2PTunnel.destFromName(connHostName), null);
|
||||
destSock = t.createI2PSocket(I2PAppContext.getGlobalContext().namingService().lookup(connHostName));
|
||||
Properties overrides = new Properties();
|
||||
I2PSocketOptions sktOpts = t.buildOptions(overrides);
|
||||
sktOpts.setPort(connPort);
|
||||
destSock = t.createI2PSocket(I2PAppContext.getGlobalContext().namingService().lookup(connHostName), sktOpts);
|
||||
} else if ("localhost".equals(connHostName) || "127.0.0.1".equals(connHostName)) {
|
||||
String err = "No localhost accesses allowed through the Socks Proxy";
|
||||
_log.error(err);
|
||||
|
@@ -366,7 +366,10 @@ public class SOCKS5Server extends SOCKSServer {
|
||||
} catch (IOException ioe) {}
|
||||
throw new SOCKSException("Host not found");
|
||||
}
|
||||
destSock = t.createI2PSocket(I2PAppContext.getGlobalContext().namingService().lookup(connHostName));
|
||||
Properties overrides = new Properties();
|
||||
I2PSocketOptions sktOpts = t.buildOptions(overrides);
|
||||
sktOpts.setPort(connPort);
|
||||
destSock = t.createI2PSocket(I2PAppContext.getGlobalContext().namingService().lookup(connHostName), sktOpts);
|
||||
} else if ("localhost".equals(connHostName) || "127.0.0.1".equals(connHostName)) {
|
||||
String err = "No localhost accesses allowed through the Socks Proxy";
|
||||
_log.error(err);
|
||||
|
Reference in New Issue
Block a user