Search in sources :

Example 61 with Log

use of net.i2p.util.Log in project i2p.i2p by i2p.

the class MultiSink method send.

/**
 *  May throw RuntimeException from underlying sinks
 *  @throws RuntimeException
 */
public void send(Destination from, byte[] data) {
    Sink s = this.cache.get(from);
    if (s == null) {
        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);
}
Also used : Log(net.i2p.util.Log)

Example 62 with Log

use of net.i2p.util.Log in project i2p.i2p by i2p.

the class SOCKSUDPUnwrapper method send.

/**
 *  May throw RuntimeException from underlying sink
 *  @throws RuntimeException
 */
public void send(Destination ignored_from, byte[] data) {
    SOCKSHeader h;
    try {
        h = new SOCKSHeader(data);
    } catch (IllegalArgumentException iae) {
        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 log = I2PAppContext.getGlobalContext().logManager().getLog(SOCKSUDPUnwrapper.class);
        log.error("Destination not found: " + h.getHost());
        return;
    }
    cache.put(dest, h);
    int headerlen = h.getBytes().length;
    byte[] unwrapped = new byte[data.length - headerlen];
    System.arraycopy(data, headerlen, unwrapped, 0, unwrapped.length);
    this.sink.send(dest, unwrapped);
}
Also used : Destination(net.i2p.data.Destination) Log(net.i2p.util.Log)

Example 63 with Log

use of net.i2p.util.Log in project i2p.i2p by i2p.

the class XSSRequestWrapper method getParameter.

/**
 *  Parameter names starting with "nofilter_" will not be filtered.
 */
@Override
public String getParameter(String parameter) {
    String value = super.getParameter(parameter);
    if (parameter.startsWith(NOFILTER))
        return value;
    String rv = stripXSS(value, parameterValuePattern);
    if (value != null && rv == null) {
        Log log = I2PAppContext.getGlobalContext().logManager().getLog(XSSRequestWrapper.class);
        log.logAlways(Log.WARN, "URL \"" + getServletPath() + "\" Stripped param \"" + parameter + "\" : \"" + value + '"');
    }
    return rv;
}
Also used : Log(net.i2p.util.Log)

Example 64 with Log

use of net.i2p.util.Log in project i2p.i2p by i2p.

the class XSSRequestWrapper method getHeader.

@Override
public String getHeader(String name) {
    String value = super.getHeader(name);
    String rv = stripXSS(value, headerValuePattern);
    if (value != null && rv == null) {
        Log log = I2PAppContext.getGlobalContext().logManager().getLog(XSSRequestWrapper.class);
        log.logAlways(Log.WARN, "URL \"" + getServletPath() + "\" Stripped header \"" + name + "\" : \"" + value + '"');
    }
    return rv;
}
Also used : Log(net.i2p.util.Log)

Example 65 with Log

use of net.i2p.util.Log in project i2p.i2p by i2p.

the class I2PSource method run.

public void run() {
    // create dissector
    I2PDatagramDissector diss = new I2PDatagramDissector();
    _running = true;
    while (_running) {
        try {
            // get id
            int id = this.queue.take();
            // receive message
            byte[] msg = this.sess.receiveMessage(id);
            if (!this.raw) {
                // load datagram into it
                diss.loadI2PDatagram(msg);
                // now call sink
                if (this.verify)
                    this.sink.send(diss.getSender(), diss.getPayload());
                else
                    this.sink.send(diss.extractSender(), diss.extractPayload());
            } else {
                // verify is ignored
                this.sink.send(null, msg);
            }
        // System.out.print("r");
        } catch (Exception e) {
            Log log = I2PAppContext.getGlobalContext().logManager().getLog(getClass());
            if (log.shouldWarn())
                log.warn("error sending", e);
            break;
        }
    }
}
Also used : I2PDatagramDissector(net.i2p.client.datagram.I2PDatagramDissector) Log(net.i2p.util.Log)

Aggregations

Log (net.i2p.util.Log)94 IOException (java.io.IOException)30 File (java.io.File)13 Properties (java.util.Properties)11 DataFormatException (net.i2p.data.DataFormatException)11 FileInputStream (java.io.FileInputStream)7 GeneralSecurityException (java.security.GeneralSecurityException)7 ArrayList (java.util.ArrayList)7 Hash (net.i2p.data.Hash)6 HashMap (java.util.HashMap)5 InputStream (java.io.InputStream)4 EventLog (net.i2p.router.util.EventLog)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 Map (java.util.Map)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 I2PAppContext (net.i2p.I2PAppContext)3 I2PSession (net.i2p.client.I2PSession)3 I2PSessionException (net.i2p.client.I2PSessionException)3 SigType (net.i2p.crypto.SigType)3 RouterInfo (net.i2p.data.router.RouterInfo)3