forked from I2P_Developers/i2p.i2p
* SOCKS: Remove static logs
This commit is contained in:
@@ -2,6 +2,7 @@ package net.i2p.i2ptunnel.socks;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.data.Destination;
|
||||
import net.i2p.i2ptunnel.udp.*;
|
||||
import net.i2p.util.Log;
|
||||
@@ -11,7 +12,6 @@ import net.i2p.util.Log;
|
||||
* @author zzz modded from streamr/MultiSource
|
||||
*/
|
||||
public class MultiSink<S extends Sink> implements Source, Sink {
|
||||
private static final Log _log = new Log(MultiSink.class);
|
||||
|
||||
public MultiSink(Map<Destination, S> cache) {
|
||||
this.cache = cache;
|
||||
@@ -25,7 +25,8 @@ public class MultiSink<S extends Sink> implements Source, Sink {
|
||||
public void send(Destination from, byte[] data) {
|
||||
Sink s = this.cache.get(from);
|
||||
if (s == null) {
|
||||
_log.error("No where to go for " + from.calculateHash().toBase64().substring(0, 6));
|
||||
Log log = I2PAppContext.getGlobalContext().logManager().getLog(MultiSink.class);
|
||||
log.error("No where to go for " + from.calculateHash().toBase64().substring(0, 6));
|
||||
return;
|
||||
}
|
||||
s.send(from, data);
|
||||
|
@@ -11,7 +11,6 @@ import net.i2p.util.Log;
|
||||
* @author zzz
|
||||
*/
|
||||
public class ReplyTracker<S extends Sink> implements Source, Sink {
|
||||
private static final Log _log = new Log(MultiSink.class);
|
||||
|
||||
public ReplyTracker(S reply, Map<Destination, S> cache) {
|
||||
this.reply = reply;
|
||||
|
@@ -32,10 +32,10 @@ import net.i2p.util.Log;
|
||||
* @author zzz modded from SOCKS5Server
|
||||
*/
|
||||
public class SOCKS4aServer extends SOCKSServer {
|
||||
private static final Log _log = new Log(SOCKS4aServer.class);
|
||||
private final Log _log;
|
||||
|
||||
private Socket clientSock = null;
|
||||
private boolean setupCompleted = false;
|
||||
private final Socket clientSock;
|
||||
private boolean setupCompleted;
|
||||
|
||||
/**
|
||||
* Create a SOCKS4a server that communicates with the client using
|
||||
@@ -51,6 +51,7 @@ public class SOCKS4aServer extends SOCKSServer {
|
||||
public SOCKS4aServer(Socket clientSock, Properties props) {
|
||||
this.clientSock = clientSock;
|
||||
this.props = props;
|
||||
_log = I2PAppContext.getGlobalContext().logManager().getLog(SOCKS4aServer.class);
|
||||
}
|
||||
|
||||
public Socket getClientSocket() throws SOCKSException {
|
||||
|
@@ -37,7 +37,7 @@ import net.i2p.util.Log;
|
||||
* @author human
|
||||
*/
|
||||
public class SOCKS5Server extends SOCKSServer {
|
||||
private static final Log _log = new Log(SOCKS5Server.class);
|
||||
private final Log _log;
|
||||
|
||||
private static final int SOCKS_VERSION_5 = 0x05;
|
||||
|
||||
@@ -63,6 +63,7 @@ public class SOCKS5Server extends SOCKSServer {
|
||||
Boolean.parseBoolean(props.getProperty(I2PTunnelHTTPClientBase.PROP_AUTH)) &&
|
||||
props.containsKey(I2PTunnelHTTPClientBase.PROP_USER) &&
|
||||
props.containsKey(I2PTunnelHTTPClientBase.PROP_PW);
|
||||
_log = I2PAppContext.getGlobalContext().logManager().getLog(SOCKS5Server.class);
|
||||
}
|
||||
|
||||
public Socket getClientSocket() throws SOCKSException {
|
||||
|
@@ -10,7 +10,6 @@ import java.net.Socket;
|
||||
import java.util.Properties;
|
||||
|
||||
import net.i2p.client.streaming.I2PSocket;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* Abstract base class used by all SOCKS servers.
|
||||
@@ -18,7 +17,6 @@ import net.i2p.util.Log;
|
||||
* @author human
|
||||
*/
|
||||
public abstract class SOCKSServer {
|
||||
private static final Log _log = new Log(SOCKSServer.class);
|
||||
|
||||
private static final String PROP_MAPPING_PREFIX = "ipmapping.";
|
||||
|
||||
|
@@ -13,13 +13,11 @@ import java.net.Socket;
|
||||
import java.util.Properties;
|
||||
|
||||
import net.i2p.i2ptunnel.I2PTunnelHTTPClientBase;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* Factory class for creating SOCKS forwarders through I2P
|
||||
*/
|
||||
public class SOCKSServerFactory {
|
||||
private final static Log _log = new Log(SOCKSServerFactory.class);
|
||||
|
||||
private final static String ERR_REQUEST_DENIED =
|
||||
"HTTP/1.1 403 Access Denied - This is a SOCKS proxy, not a HTTP proxy\r\n" +
|
||||
@@ -71,7 +69,7 @@ public class SOCKSServerFactory {
|
||||
throw new SOCKSException("SOCKS protocol version not supported (" + Integer.toHexString(socksVer) + ")");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
_log.debug("error reading SOCKS protocol version");
|
||||
//_log.debug("error reading SOCKS protocol version");
|
||||
throw new SOCKSException("Connection error (" + e.getMessage() + ")");
|
||||
}
|
||||
|
||||
|
@@ -2,6 +2,7 @@ package net.i2p.i2ptunnel.socks;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.data.Destination;
|
||||
import net.i2p.i2ptunnel.udp.*;
|
||||
import net.i2p.util.Log;
|
||||
@@ -13,7 +14,6 @@ import net.i2p.util.Log;
|
||||
* @author zzz
|
||||
*/
|
||||
public class SOCKSUDPUnwrapper implements Source, Sink {
|
||||
private static final Log _log = new Log(SOCKSUDPUnwrapper.class);
|
||||
|
||||
/**
|
||||
* @param cache put headers here to pass to SOCKSUDPWrapper
|
||||
@@ -36,13 +36,15 @@ public class SOCKSUDPUnwrapper implements Source, Sink {
|
||||
try {
|
||||
h = new SOCKSHeader(data);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
_log.error(iae.toString());
|
||||
Log log = I2PAppContext.getGlobalContext().logManager().getLog(SOCKSUDPUnwrapper.class);
|
||||
log.error(iae.toString());
|
||||
return;
|
||||
}
|
||||
Destination dest = h.getDestination();
|
||||
if (dest == null) {
|
||||
// no, we aren't going to send non-i2p traffic to a UDP outproxy :)
|
||||
_log.error("Destination not found: " + h.getHost());
|
||||
Log log = I2PAppContext.getGlobalContext().logManager().getLog(SOCKSUDPUnwrapper.class);
|
||||
log.error("Destination not found: " + h.getHost());
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user