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:
- because of out of sequence backports, I had to apply a change from core#22937 to i2p.cpp (line 323) to explicitely convert a fs::path to a string.
- This includes a change from https://github.com/bitcoin/bitcoin/pull/21407/commits/80a5a8ea2b7ad512c74c29df5b504e9be6cf23a0 i2p: limit the size of incoming messages. The rest of that commit was included in D11023
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.
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D11025