33 CreateSock = [&fuzzed_data_provider](int, int, int) {
34 return std::make_unique<FuzzedSock>(fuzzed_data_provider);
37 const fs::path private_key_path =
gArgs.GetDataDirNet() /
"fuzzed_i2p_private_key";
39 const Proxy sam_proxy{addr,
false};
45 if (session.
Listen(conn)) {
46 if (session.
Accept(conn)) {
49 }
catch (
const std::runtime_error&) {
58 conn.
sock->SendComplete(
"verack\n", 10ms, *interrupt);
59 }
catch (
const std::runtime_error&) {
63 fs::remove_all(private_key_path);
A combination of a network address (CNetAddr) and a (TCP) port.
bool Listen(Connection &conn) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Start listening for an incoming connection.
bool Connect(const CService &to, Connection &conn, bool &proxy_error) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Connect to an I2P peer.
bool Accept(Connection &conn) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
Wait for and accept a new incoming connection.
#define COMPAT_IN6ADDR_LOOPBACK_INIT
static constexpr size_t MAX_MSG_SIZE
The maximum size of an incoming message from the I2P SAM proxy (in bytes).
std::function< std::unique_ptr< Sock >(int, int, int)> CreateSock
Socket factory.
std::unique_ptr< T > MakeNoLogFileContext(const ChainType chain_type=ChainType::REGTEST, TestOpts opts={})
Make a test setup that has disk access to the debug.log file disabled.
An established connection with another peer.
std::unique_ptr< Sock > sock
Connected socket.
std::shared_ptr< CThreadInterrupt > ConsumeThreadInterrupt(FuzzedDataProvider &fuzzed_data_provider)
NodeSeconds ConsumeTime(FuzzedDataProvider &fuzzed_data_provider, const std::optional< int64_t > &min, const std::optional< int64_t > &max) noexcept
void SeedRandomStateForTest(SeedRand seedtype)
Seed the global RNG state for testing and log the seed value.
@ ZEROS
Seed with a compile time constant of zeros.
void SetMockTime(int64_t nMockTimeIn)
DEPRECATED Use SetMockTime with chrono type.