Package net.i2p.router.tunnel
Class HopProcessor
- java.lang.Object
-
- net.i2p.router.tunnel.HopProcessor
-
- Direct Known Subclasses:
InboundGatewayProcessor
class HopProcessor extends Object
Take a received tunnel message, verify that it isn't a duplicate, and translate it into what the next hop will want. The hop processor works the same on all peers - inbound and outbound participants, outbound endpoints, and inbound gateways (with a small modification per InboundGatewayProcessor).
-
-
Field Summary
Fields Modifier and Type Field Description protected HopConfig
_config
protected I2PAppContext
_context
(package private) static int
IV_LENGTH
as of i2p 0.6, the tunnel crypto changed to encrypt the IV both before and after using it at each hop so as to prevent a certain type of replay/confirmation attack.
-
Constructor Summary
Constructors Constructor Description HopProcessor(I2PAppContext ctx, HopConfig config)
Deprecated.used only by unit testsHopProcessor(I2PAppContext ctx, HopConfig config, IVValidator validator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
process(byte[] orig, int offset, int length, Hash prev)
Process the data for the current hop, overwriting the original data with what should be sent to the next peer.String
toString()
-
-
-
Field Detail
-
_context
protected final I2PAppContext _context
-
_config
protected final HopConfig _config
-
IV_LENGTH
static final int IV_LENGTH
as of i2p 0.6, the tunnel crypto changed to encrypt the IV both before and after using it at each hop so as to prevent a certain type of replay/confirmation attack. See: http://osdir.com/ml/network.i2p/2005-07/msg00031.html- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HopProcessor
@Deprecated HopProcessor(I2PAppContext ctx, HopConfig config)
Deprecated.used only by unit tests
-
HopProcessor
public HopProcessor(I2PAppContext ctx, HopConfig config, IVValidator validator)
-
-
Method Detail
-
process
public boolean process(byte[] orig, int offset, int length, Hash prev)
Process the data for the current hop, overwriting the original data with what should be sent to the next peer. This also validates the previous peer and the IV, making sure its not a repeat and not a loop.- Parameters:
orig
- IV+data of the messageoffset
- index into orig where the IV beginslength
- how long after the offset does the IV+message go for? Should always be 1024 bytes.prev
- previous hop in the tunnel, or null if we are the gateway- Returns:
- true if the message was updated and valid, false if it was not.
-
-