tunnel msg spec update
This commit is contained in:
@@ -106,38 +106,41 @@ fragments it across the necessary number of 1KB tunnel messages, and decides how
|
|||||||
each I2NP message should be handled by the tunnel endpoint, encoding that
|
each I2NP message should be handled by the tunnel endpoint, encoding that
|
||||||
data into the raw tunnel payload:</p>
|
data into the raw tunnel payload:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>the first 4 bytes of the SHA256 of the remaining preprocessed data concatenated
|
<li>the first 4 bytes of the SHA256 of (the remaining preprocessed data concatenated
|
||||||
with the IV, using the IV as will be seen on the tunnel endpoint (for
|
with the IV), using the IV as will be seen on the tunnel endpoint (for
|
||||||
outbound tunnels) or the IV as was seen on the tunnel gateway (for inbound
|
outbound tunnels), or the IV as was seen on the tunnel gateway (for inbound
|
||||||
tunnels) (see below for IV processing).</li>
|
tunnels) (see below for IV processing).</li>
|
||||||
<li>0 or more bytes containing random nonzero integers</li>
|
<li>0 or more bytes containing random nonzero integers</li>
|
||||||
<li>1 byte containing 0x00</li>
|
<li>1 byte containing 0x00</li>
|
||||||
<li>a series of zero or more { instructions, message } pairs</li>
|
<li>a series of zero or more { instructions, message } pairs</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<p>Note that the padding, if any, must be before the instruction/message pairs.
|
||||||
|
there is no provision for padding at the end.</p>
|
||||||
|
|
||||||
<p>The instructions are encoded with a single control byte, followed by any
|
<p>The instructions are encoded with a single control byte, followed by any
|
||||||
necessary additional information. The first bit in that control byte determines
|
necessary additional information. The first bit in that control byte determines
|
||||||
how the remainder of the header is interpreted - if it is not set, the message
|
how the remainder of the header is interpreted - if it is not set, the message
|
||||||
is either not fragmented or this is the first fragment in the message. If it is
|
is either not fragmented or this is the first fragment in the message. If it is
|
||||||
set, this is a follow on fragment.</p>
|
set, this is a follow on fragment.</p>
|
||||||
|
|
||||||
<p>With the first bit being 0, the instructions are:</p>
|
<p>With the first (leftmost or MSB) bit being 0, the instructions are:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>1 byte control byte:<pre>
|
<li>1 byte control byte:<pre>
|
||||||
bit 0: is follow on fragment? (1 = true, 0 = false, must be 0)
|
bit 0: is follow on fragment? (1 = true, 0 = false, must be 0)
|
||||||
bits 1-2: delivery type
|
bits 1-2: delivery type
|
||||||
(0x0 = LOCAL, 0x01 = TUNNEL, 0x02 = ROUTER)
|
(0x0 = LOCAL, 0x01 = TUNNEL, 0x02 = ROUTER)
|
||||||
bit 3: delay included? (1 = true, 0 = false)
|
bit 3: delay included? (1 = true, 0 = false) (unimplemented)
|
||||||
bit 4: fragmented? (1 = true, 0 = false)
|
bit 4: fragmented? (1 = true, 0 = false)
|
||||||
bit 5: extended options? (1 = true, 0 = false)
|
bit 5: extended options? (1 = true, 0 = false) (unimplemented)
|
||||||
bits 6-7: reserved</pre></li>
|
bits 6-7: reserved</pre></li>
|
||||||
<li>if the delivery type was TUNNEL, a 4 byte tunnel ID</li>
|
<li>if the delivery type was TUNNEL, a 4 byte tunnel ID</li>
|
||||||
<li>if the delivery type was TUNNEL or ROUTER, a 32 byte router hash</li>
|
<li>if the delivery type was TUNNEL or ROUTER, a 32 byte router hash</li>
|
||||||
<li>if the delay included flag is true, a 1 byte value:<pre>
|
<li>if the delay included flag is true, a 1 byte value (unimplemented):<pre>
|
||||||
bit 0: type (0 = strict, 1 = randomized)
|
bit 0: type (0 = strict, 1 = randomized)
|
||||||
bits 1-7: delay exponent (2^value minutes)</pre></li>
|
bits 1-7: delay exponent (2^value minutes)</pre></li>
|
||||||
<li>if the fragmented flag is true, a 4 byte message ID</li>
|
<li>if the fragmented flag is true, a 4 byte message ID</li>
|
||||||
<li>if the extended options flag is true:<pre>
|
<li>if the extended options flag is true (unimplemented):<pre>
|
||||||
= a 1 byte option size (in bytes)
|
= a 1 byte option size (in bytes)
|
||||||
= that many bytes</pre></li>
|
= that many bytes</pre></li>
|
||||||
<li>2 byte size of the I2NP message or this fragment</li>
|
<li>2 byte size of the I2NP message or this fragment</li>
|
||||||
|
Reference in New Issue
Block a user