Tunnels: Changes for new build messages (Prop. 157)

- Remove ITBM, change record length from 236 to 218 bytes
- Fix check of blank record in BuildReplyHandler
- Fix offset constants for short record in BuildRequestRecord
- Fix BuildMessageTestStandalone test 6 (short inbound)
- ITBM class removal TODO
This commit is contained in:
zzz
2021-06-22 09:06:40 -04:00
parent d71a472367
commit bb19fcdac3
10 changed files with 29 additions and 92 deletions

View File

@@ -24,7 +24,6 @@ import net.i2p.data.i2np.EncryptedBuildRecord;
import net.i2p.data.i2np.I2NPMessage;
import net.i2p.data.i2np.I2NPMessageException;
import net.i2p.data.i2np.I2NPMessageHandler;
import net.i2p.data.i2np.InboundTunnelBuildMessage;
import net.i2p.data.i2np.OutboundTunnelBuildReplyMessage;
import net.i2p.data.i2np.ShortTunnelBuildMessage;
import net.i2p.data.i2np.ShortTunnelBuildReplyMessage;
@@ -84,20 +83,8 @@ public class BuildMessageTestStandalone extends TestCase {
// populate and encrypt the message
TunnelBuildMessage msg;
if (testType == 3) {
if (testType == 3 || testType == 6) {
msg = new ShortTunnelBuildMessage(ctx, TunnelBuildMessage.MAX_RECORD_COUNT);
} else if (testType == 6) {
InboundTunnelBuildMessage itbm = new InboundTunnelBuildMessage(ctx, TunnelBuildMessage.MAX_RECORD_COUNT);
// set plaintext record for ibgw
for (int i = 0; i < order.size(); i++) {
int hop = order.get(i).intValue();
if (hop == 0) {
// TODO
itbm.setPlaintextRecord(i, new byte[100]);
break;
}
}
msg = itbm;
} else {
msg = new TunnelBuildMessage(ctx);
}
@@ -109,9 +96,7 @@ public class BuildMessageTestStandalone extends TestCase {
PublicKey key = null;
if (hop < end)
key = _pubKeys[hop];
// don't do this for ibgw in itbm
if (testType != 6 || hop != 0)
BuildMessageGenerator.createRecord(i, hop, msg, cfg, _replyRouter, _replyTunnel, ctx, key);
BuildMessageGenerator.createRecord(i, hop, msg, cfg, _replyRouter, _replyTunnel, ctx, key);
}
BuildMessageGenerator.layeredEncrypt(ctx, msg, cfg, order);