aboutsummaryrefslogtreecommitdiff
path: root/src/i2p.cpp
AgeCommit message (Collapse)Author
2021-04-08i2p: cancel the Accept() method if waiting on the socket errorsVasil Dimov
2021-03-16i2p: use pointers to Sock to accommodate mockingVasil Dimov
Change the types of `i2p::Connection::sock` and `i2p::sam::Session::m_control_sock` from `Sock` to `std::unique_ptr<Sock>`. Using pointers would allow us to sneak `FuzzedSock` instead of `Sock` and have the methods of the former called. After this change a test only needs to replace `CreateSock()` with a function that returns `FuzzedSock`.
2021-03-16net: change ConnectSocketDirectly() to take a Sock argumentVasil Dimov
Change `ConnectSocketDirectly()` to take a `Sock` argument instead of a bare `SOCKET`. With this, use the `Sock`'s (possibly mocked) methods `Connect()`, `Wait()` and `GetSockOpt()` instead of calling the OS functions directly.
2021-03-16i2p: limit the size of incoming messagesVasil Dimov
Put a limit on the amount of data `Sock::RecvUntilTerminator()` can read if no terminator is received. In the case of I2P this avoids a runaway (or malicious) I2P proxy sending us tons of data without a terminator before a timeout is triggered.
2021-03-01net: implement the necessary parts of the I2P SAM protocolVasil Dimov
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