diff --git a/android/assets/i2pd.conf b/android/assets/i2pd.conf index a18e13d7..312a24ea 100644 --- a/android/assets/i2pd.conf +++ b/android/assets/i2pd.conf @@ -37,7 +37,12 @@ port = 7070 enabled = true address = 127.0.0.1 port = 4444 -# keys = http-proxy-keys.dat +inbound.length = 1 +inbound.quantity = 5 +outbound.length = 1 +outbound.quantity = 5 +signaturetype=7 +keys = proxy-keys.dat # addresshelper = true # outproxy = http://false.i2p ## httpproxy section also accepts I2CP parameters, like "inbound.length" etc. @@ -46,7 +51,7 @@ port = 4444 enabled = true address = 127.0.0.1 port = 4447 -# keys = socks-proxy-keys.dat +keys = proxy-keys.dat # outproxy.enabled = false # outproxy = 127.0.0.1 # outproxyport = 9050 @@ -80,3 +85,6 @@ verify = true [limits] transittunnels = 50 + +[persist] +profiles = false diff --git a/contrib/i2pd.conf b/contrib/i2pd.conf index 7bd2c90f..1ef725bb 100644 --- a/contrib/i2pd.conf +++ b/contrib/i2pd.conf @@ -225,3 +225,7 @@ verify = true # inbound.quantity = 3 # outbound.length = 2 # outbound.quantity = 3 + +[persist] +## Save peer profiles on disk (default: true) +# profiles = true diff --git a/libi2pd/Config.cpp b/libi2pd/Config.cpp index 3251886b..0403275f 100644 --- a/libi2pd/Config.cpp +++ b/libi2pd/Config.cpp @@ -237,7 +237,7 @@ namespace config { options_description ntcp2("NTCP2 Options"); ntcp2.add_options() ("ntcp2.enabled", value()->default_value(true), "Enable NTCP2 (default: enabled)") - ("ntcp2.published", value()->default_value(false), "Publish NTCP2 (default: disabled)") + ("ntcp2.published", value()->default_value(false), "Publish NTCP2 (default: disabled)") ("ntcp2.port", value()->default_value(0), "Port to listen for incoming NTCP2 connections (default: auto)") ; @@ -249,10 +249,15 @@ namespace config { "1.pool.ntp.org," "2.pool.ntp.org," "3.pool.ntp.org" - ), "Comma separated list of NTCP servers") + ), "Comma separated list of NTCP servers") ("nettime.ntpsyncinterval", value()->default_value(72), "NTP sync interval in hours (default: 72)") ; + options_description persist("Network information persisting options"); + persist.add_options() + ("persist.profiles", value()->default_value(true), "Persist peer profiles (default: true)") + ; + m_OptionsDesc .add(general) .add(limits) @@ -272,6 +277,7 @@ namespace config { .add(exploratory) .add(ntcp2) .add(nettime) + .add(persist) ; } diff --git a/libi2pd/NetDb.cpp b/libi2pd/NetDb.cpp index 9647be3f..ebcc1c5d 100644 --- a/libi2pd/NetDb.cpp +++ b/libi2pd/NetDb.cpp @@ -44,10 +44,12 @@ namespace data m_Families.LoadCertificates (); Load (); - uint16_t threshold; i2p::config::GetOption("reseed.threshold", threshold); + uint16_t threshold; i2p::config::GetOption("reseed.threshold", threshold); if (m_RouterInfos.size () < threshold) // reseed if # of router less than threshold Reseed (); + i2p::config::GetOption("persist.profiles", m_PersistProfiles); + m_IsRunning = true; m_Thread = new std::thread (std::bind (&NetDb::Run, this)); } @@ -56,8 +58,9 @@ namespace data { if (m_IsRunning) { - for (auto& it: m_RouterInfos) - it.second->SaveProfile (); + if (m_PersistProfiles) + for (auto& it: m_RouterInfos) + it.second->SaveProfile (); DeleteObsoleteProfiles (); m_RouterInfos.clear (); m_Floodfills.clear (); @@ -539,7 +542,7 @@ namespace data { if (it->second->IsUnreachable ()) { - it->second->SaveProfile (); + if (m_PersistProfiles) it->second->SaveProfile (); it = m_RouterInfos.erase (it); continue; } diff --git a/libi2pd/NetDb.hpp b/libi2pd/NetDb.hpp index 53d1e685..b34458fb 100644 --- a/libi2pd/NetDb.hpp +++ b/libi2pd/NetDb.hpp @@ -144,6 +144,8 @@ namespace data friend class NetDbRequests; NetDbRequests m_Requests; + bool m_PersistProfiles; + /** router info we are bootstrapping from or nullptr if we are not currently doing that*/ std::shared_ptr m_FloodfillBootstrap; diff --git a/libi2pd/Transports.cpp b/libi2pd/Transports.cpp index f989bbef..64f41afd 100644 --- a/libi2pd/Transports.cpp +++ b/libi2pd/Transports.cpp @@ -817,7 +817,6 @@ namespace transport if (profile) { profile->TunnelNonReplied(); - profile->Save(it->first); } std::unique_lock l(m_PeersMutex); it = m_Peers.erase (it); diff --git a/libi2pd/util.cpp b/libi2pd/util.cpp index 1395c2e6..b558fca4 100644 --- a/libi2pd/util.cpp +++ b/libi2pd/util.cpp @@ -21,9 +21,9 @@ #define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x)) #define FREE(x) HeapFree(GetProcessHeap(), 0, (x)) +/* // No more needed. Exists in MinGW. int inet_pton(int af, const char *src, void *dst) -{ /* This function was written by Petar Korponai?. See -http://stackoverflow.com/questions/15660203/inet-pton-identifier-not-found */ +{ // This function was written by Petar Korponai?. See http://stackoverflow.com/questions/15660203/inet-pton-identifier-not-found struct sockaddr_storage ss; int size = sizeof (ss); char src_copy[INET6_ADDRSTRLEN + 1]; @@ -45,7 +45,7 @@ http://stackoverflow.com/questions/15660203/inet-pton-identifier-not-found */ } } return 0; -} +}*/ #else /* !WIN32 => UNIX */ #include #include