Page MenuHomePhabricator

net: implement the necessary parts of the I2P SAM protocol
ClosedPublic

Authored by PiRK on Feb 9 2022, 09:16.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC8a84a1c2cfff: net: implement the necessary parts of the I2P SAM protocol
Summary

Implement the following commands from the I2P SAM protocol:

  • HELLO: needed for all of the remaining ones
  • DEST GENERATE: to generate our private key and destination
  • NAMING LOOKUP: to convert .i2p addresses to destinations
  • SESSION CREATE: needed for STREAM CONNECT and STREAM ACCEPT
  • STREAM CONNECT: to make outgoing connections
  • STREAM ACCEPT: to accept incoming connections

This is a backport of core#20685 [14/20]
https://github.com/bitcoin/bitcoin/pull/20685/commits/c22daa2ecff1acd25426cd46f98f2587d1d324c3

Notes:

Test Plan

ninja all check-all

ninja && src/bitcoind -debug=i2p

For now only the compilation of the new code and the fact that the two additional lines of code in logging.{h|cpp} don't break anything are tested.
The next commit will make this code reachable, add functional tests, and provide a manual testing plan by actually using bitcoind with I2P.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Feb 9 2022, 09:16
PiRK planned changes to this revision.Feb 9 2022, 15:58

I need to include the missing change from core#21407 not backported in previous diff

PiRK edited the summary of this revision. (Show Details)
PiRK edited the test plan for this revision. (Show Details)

Include the missing change from core#21407: i2p: limit the size of incoming messages
This is needed because the rest of that commit was backported in D11023 to provide a way to test Sock::RecvUntilTerminator and SendComplete, and it provide a protection against spam attacks.

PiRK planned changes to this revision.Feb 10 2022, 16:02

needs more manual testing

PiRK requested review of this revision.Feb 11 2022, 10:04

There is still no test in this commit, but the added code in i2p.cpp is not reachable by users, so there is no risk of introducing a bug through the new code. The changes in logging.{h|cpp} are tested with ninja && src/bitcoind -debug=i2p (at the moment this does not print anything, but it demonstrates that the i2p debug category is recognized.

I managed to test all of this after the next commit (D11027).

This revision is now accepted and ready to land.Feb 14 2022, 09:43