mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-29 04:07:49 +02:00
Logging: consistent capitalization and typo fixes
This commit is contained in:
parent
a5968a484b
commit
950234cd66
25 changed files with 792 additions and 792 deletions
|
@ -32,7 +32,7 @@ void SubscribeToEvents()
|
|||
Result = pNetworkListManager->IsConnectedToInternet(&IsConnect);
|
||||
if (SUCCEEDED(Result)) {
|
||||
i2p::transport::transports.SetOnline (true);
|
||||
LogPrint(eLogInfo, "NetState: current state: ", IsConnect == VARIANT_TRUE ? "connected" : "disconnected");
|
||||
LogPrint(eLogInfo, "NetState: Current state: ", IsConnect == VARIANT_TRUE ? "connected" : "disconnected");
|
||||
}
|
||||
|
||||
Result = pNetworkListManager->QueryInterface(IID_IConnectionPointContainer, (void **)&pCPContainer);
|
||||
|
@ -79,7 +79,7 @@ void UnSubscribeFromEvents()
|
|||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
LogPrint (eLogError, "NetState: received exception: ", ex.what ());
|
||||
LogPrint (eLogError, "NetState: Received exception: ", ex.what ());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -118,26 +118,26 @@ namespace util
|
|||
|
||||
i2p::log::Logger().SetLogLevel(loglevel);
|
||||
if (logstream) {
|
||||
LogPrint(eLogInfo, "Log: will send messages to std::ostream");
|
||||
LogPrint(eLogInfo, "Log: Sending messages to std::ostream");
|
||||
i2p::log::Logger().SendTo (logstream);
|
||||
} else if (logs == "file") {
|
||||
if (logfile == "")
|
||||
logfile = i2p::fs::DataDirPath("i2pd.log");
|
||||
LogPrint(eLogInfo, "Log: will send messages to ", logfile);
|
||||
LogPrint(eLogInfo, "Log: Sending messages to ", logfile);
|
||||
i2p::log::Logger().SendTo (logfile);
|
||||
#ifndef _WIN32
|
||||
} else if (logs == "syslog") {
|
||||
LogPrint(eLogInfo, "Log: will send messages to syslog");
|
||||
LogPrint(eLogInfo, "Log: Sending messages to syslog");
|
||||
i2p::log::Logger().SendTo("i2pd", LOG_DAEMON);
|
||||
#endif
|
||||
} else {
|
||||
// use stdout -- default
|
||||
}
|
||||
|
||||
LogPrint(eLogNone, "i2pd v", VERSION, " starting");
|
||||
LogPrint(eLogDebug, "FS: main config file: ", config);
|
||||
LogPrint(eLogDebug, "FS: data directory: ", datadir);
|
||||
LogPrint(eLogDebug, "FS: certificates directory: ", certsdir);
|
||||
LogPrint(eLogNone, "i2pd v", VERSION, " starting...");
|
||||
LogPrint(eLogDebug, "FS: Main config file: ", config);
|
||||
LogPrint(eLogDebug, "FS: Data directory: ", datadir);
|
||||
LogPrint(eLogDebug, "FS: Certificates directory: ", certsdir);
|
||||
|
||||
bool precomputation; i2p::config::GetOption("precomputation.elgamal", precomputation);
|
||||
bool aesni; i2p::config::GetOption("cpuext.aesni", aesni);
|
||||
|
@ -204,7 +204,7 @@ namespace util
|
|||
uint16_t port; i2p::config::GetOption("port", port);
|
||||
if (!i2p::config::IsDefault("port"))
|
||||
{
|
||||
LogPrint(eLogInfo, "Daemon: accepting incoming connections at port ", port);
|
||||
LogPrint(eLogInfo, "Daemon: Accepting incoming connections at port ", port);
|
||||
i2p::context.UpdatePort (port);
|
||||
}
|
||||
i2p::context.SetSupportsV6 (ipv6);
|
||||
|
@ -252,7 +252,7 @@ namespace util
|
|||
|
||||
bool isFloodfill; i2p::config::GetOption("floodfill", isFloodfill);
|
||||
if (isFloodfill) {
|
||||
LogPrint(eLogInfo, "Daemon: router will be floodfill");
|
||||
LogPrint(eLogInfo, "Daemon: Router configured as floodfill");
|
||||
i2p::context.SetFloodfill (true);
|
||||
}
|
||||
else
|
||||
|
@ -267,7 +267,7 @@ namespace util
|
|||
if (bandwidth[0] >= 'K' && bandwidth[0] <= 'X')
|
||||
{
|
||||
i2p::context.SetBandwidth (bandwidth[0]);
|
||||
LogPrint(eLogInfo, "Daemon: bandwidth set to ", i2p::context.GetBandwidthLimit (), "KBps");
|
||||
LogPrint(eLogInfo, "Daemon: Bandwidth set to ", i2p::context.GetBandwidthLimit (), "KBps");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -275,23 +275,23 @@ namespace util
|
|||
if (value > 0)
|
||||
{
|
||||
i2p::context.SetBandwidth (value);
|
||||
LogPrint(eLogInfo, "Daemon: bandwidth set to ", i2p::context.GetBandwidthLimit (), " KBps");
|
||||
LogPrint(eLogInfo, "Daemon: Bandwidth set to ", i2p::context.GetBandwidthLimit (), " KBps");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogPrint(eLogInfo, "Daemon: unexpected bandwidth ", bandwidth, ". Set to 'low'");
|
||||
LogPrint(eLogInfo, "Daemon: Unexpected bandwidth ", bandwidth, ". Set to 'low'");
|
||||
i2p::context.SetBandwidth (i2p::data::CAPS_FLAG_LOW_BANDWIDTH2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isFloodfill)
|
||||
{
|
||||
LogPrint(eLogInfo, "Daemon: floodfill bandwidth set to 'extra'");
|
||||
LogPrint(eLogInfo, "Daemon: Floodfill bandwidth set to 'extra'");
|
||||
i2p::context.SetBandwidth (i2p::data::CAPS_FLAG_EXTRA_BANDWIDTH2);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogPrint(eLogInfo, "Daemon: bandwidth set to 'low'");
|
||||
LogPrint(eLogInfo, "Daemon: Bandwidth set to 'low'");
|
||||
i2p::context.SetBandwidth (i2p::data::CAPS_FLAG_LOW_BANDWIDTH2);
|
||||
}
|
||||
|
||||
|
@ -301,12 +301,12 @@ namespace util
|
|||
std::string family; i2p::config::GetOption("family", family);
|
||||
i2p::context.SetFamily (family);
|
||||
if (family.length () > 0)
|
||||
LogPrint(eLogInfo, "Daemon: family set to ", family);
|
||||
LogPrint(eLogInfo, "Daemon: Router family set to ", family);
|
||||
|
||||
bool trust; i2p::config::GetOption("trust.enabled", trust);
|
||||
if (trust)
|
||||
{
|
||||
LogPrint(eLogInfo, "Daemon: explicit trust enabled");
|
||||
LogPrint(eLogInfo, "Daemon: Explicit trust enabled");
|
||||
std::string fam; i2p::config::GetOption("trust.family", fam);
|
||||
std::string routers; i2p::config::GetOption("trust.routers", routers);
|
||||
bool restricted = false;
|
||||
|
@ -336,18 +336,18 @@ namespace util
|
|||
pos = comma + 1;
|
||||
}
|
||||
while (comma != std::string::npos);
|
||||
LogPrint(eLogInfo, "Daemon: setting restricted routes to use ", idents.size(), " trusted routers");
|
||||
LogPrint(eLogInfo, "Daemon: Setting restricted routes to use ", idents.size(), " trusted routers");
|
||||
i2p::transport::transports.RestrictRoutesToRouters(idents);
|
||||
restricted = idents.size() > 0;
|
||||
}
|
||||
if(!restricted)
|
||||
LogPrint(eLogError, "Daemon: no trusted routers of families specified");
|
||||
LogPrint(eLogError, "Daemon: No trusted routers of families specified");
|
||||
}
|
||||
|
||||
bool hidden; i2p::config::GetOption("trust.hidden", hidden);
|
||||
if (hidden)
|
||||
{
|
||||
LogPrint(eLogInfo, "Daemon: using hidden mode");
|
||||
LogPrint(eLogInfo, "Daemon: Hidden mode enabled");
|
||||
i2p::data::netdb.SetHidden(true);
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ namespace util
|
|||
bool Daemon_Singleton::start()
|
||||
{
|
||||
i2p::log::Logger().Start();
|
||||
LogPrint(eLogInfo, "Daemon: starting NetDB");
|
||||
LogPrint(eLogInfo, "Daemon: Starting NetDB");
|
||||
i2p::data::netdb.Start();
|
||||
|
||||
bool upnp; i2p::config::GetOption("upnp.enabled", upnp);
|
||||
|
@ -379,9 +379,9 @@ namespace util
|
|||
bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2);
|
||||
bool ssu; i2p::config::GetOption("ssu", ssu);
|
||||
bool checkInReserved; i2p::config::GetOption("reservedrange", checkInReserved);
|
||||
LogPrint(eLogInfo, "Daemon: starting Transports");
|
||||
if(!ssu) LogPrint(eLogInfo, "Daemon: ssu disabled");
|
||||
if(!ntcp2) LogPrint(eLogInfo, "Daemon: ntcp2 disabled");
|
||||
LogPrint(eLogInfo, "Daemon: Starting Transports");
|
||||
if(!ssu) LogPrint(eLogInfo, "Daemon: SSU disabled");
|
||||
if(!ntcp2) LogPrint(eLogInfo, "Daemon: NTCP2 disabled");
|
||||
|
||||
i2p::transport::transports.SetCheckReserved(checkInReserved);
|
||||
i2p::transport::transports.Start(ntcp2, ssu);
|
||||
|
@ -389,7 +389,7 @@ namespace util
|
|||
LogPrint(eLogInfo, "Daemon: Transports started");
|
||||
else
|
||||
{
|
||||
LogPrint(eLogError, "Daemon: failed to start Transports");
|
||||
LogPrint(eLogError, "Daemon: Failed to start Transports");
|
||||
/** shut down netdb right away */
|
||||
i2p::transport::transports.Stop();
|
||||
i2p::data::netdb.Stop();
|
||||
|
@ -400,7 +400,7 @@ namespace util
|
|||
if (http) {
|
||||
std::string httpAddr; i2p::config::GetOption("http.address", httpAddr);
|
||||
uint16_t httpPort; i2p::config::GetOption("http.port", httpPort);
|
||||
LogPrint(eLogInfo, "Daemon: starting webconsole at ", httpAddr, ":", httpPort);
|
||||
LogPrint(eLogInfo, "Daemon: Starting Webconsole at ", httpAddr, ":", httpPort);
|
||||
try
|
||||
{
|
||||
d.httpServer = std::unique_ptr<i2p::http::HTTPServer>(new i2p::http::HTTPServer(httpAddr, httpPort));
|
||||
|
@ -408,16 +408,16 @@ namespace util
|
|||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
LogPrint (eLogError, "Daemon: failed to start webconsole: ", ex.what ());
|
||||
LogPrint (eLogError, "Daemon: Failed to start Webconsole: ", ex.what ());
|
||||
ThrowFatal ("Unable to start webconsole at ", httpAddr, ":", httpPort, ": ", ex.what ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LogPrint(eLogInfo, "Daemon: starting Tunnels");
|
||||
LogPrint(eLogInfo, "Daemon: Starting Tunnels");
|
||||
i2p::tunnel::tunnels.Start();
|
||||
|
||||
LogPrint(eLogInfo, "Daemon: starting Client");
|
||||
LogPrint(eLogInfo, "Daemon: Starting Client");
|
||||
i2p::client::context.Start ();
|
||||
|
||||
// I2P Control Protocol
|
||||
|
@ -425,7 +425,7 @@ namespace util
|
|||
if (i2pcontrol) {
|
||||
std::string i2pcpAddr; i2p::config::GetOption("i2pcontrol.address", i2pcpAddr);
|
||||
uint16_t i2pcpPort; i2p::config::GetOption("i2pcontrol.port", i2pcpPort);
|
||||
LogPrint(eLogInfo, "Daemon: starting I2PControl at ", i2pcpAddr, ":", i2pcpPort);
|
||||
LogPrint(eLogInfo, "Daemon: Starting I2PControl at ", i2pcpAddr, ":", i2pcpPort);
|
||||
try
|
||||
{
|
||||
d.m_I2PControlService = std::unique_ptr<i2p::client::I2PControlService>(new i2p::client::I2PControlService (i2pcpAddr, i2pcpPort));
|
||||
|
@ -433,7 +433,7 @@ namespace util
|
|||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
LogPrint (eLogError, "Daemon: failed to start I2PControl: ", ex.what ());
|
||||
LogPrint (eLogError, "Daemon: Failed to start I2PControl: ", ex.what ());
|
||||
ThrowFatal ("Unable to start I2PControl service at ", i2pcpAddr, ":", i2pcpPort, ": ", ex.what ());
|
||||
}
|
||||
}
|
||||
|
@ -442,10 +442,10 @@ namespace util
|
|||
|
||||
bool Daemon_Singleton::stop()
|
||||
{
|
||||
LogPrint(eLogInfo, "Daemon: shutting down");
|
||||
LogPrint(eLogInfo, "Daemon: stopping Client");
|
||||
LogPrint(eLogInfo, "Daemon: Shutting down");
|
||||
LogPrint(eLogInfo, "Daemon: Stopping Client");
|
||||
i2p::client::context.Stop();
|
||||
LogPrint(eLogInfo, "Daemon: stopping Tunnels");
|
||||
LogPrint(eLogInfo, "Daemon: Stopping Tunnels");
|
||||
i2p::tunnel::tunnels.Stop();
|
||||
|
||||
if (d.UPnP)
|
||||
|
@ -460,18 +460,18 @@ namespace util
|
|||
d.m_NTPSync = nullptr;
|
||||
}
|
||||
|
||||
LogPrint(eLogInfo, "Daemon: stopping Transports");
|
||||
LogPrint(eLogInfo, "Daemon: Stopping Transports");
|
||||
i2p::transport::transports.Stop();
|
||||
LogPrint(eLogInfo, "Daemon: stopping NetDB");
|
||||
LogPrint(eLogInfo, "Daemon: Stopping NetDB");
|
||||
i2p::data::netdb.Stop();
|
||||
if (d.httpServer) {
|
||||
LogPrint(eLogInfo, "Daemon: stopping HTTP Server");
|
||||
LogPrint(eLogInfo, "Daemon: Stopping HTTP Server");
|
||||
d.httpServer->Stop();
|
||||
d.httpServer = nullptr;
|
||||
}
|
||||
if (d.m_I2PControlService)
|
||||
{
|
||||
LogPrint(eLogInfo, "Daemon: stopping I2PControl");
|
||||
LogPrint(eLogInfo, "Daemon: Stopping I2PControl");
|
||||
d.m_I2PControlService->Stop ();
|
||||
d.m_I2PControlService = nullptr;
|
||||
}
|
||||
|
|
|
@ -48,10 +48,10 @@ namespace client
|
|||
if (i2pcp_key.at(0) != '/')
|
||||
i2pcp_key = i2p::fs::DataDirPath(i2pcp_key);
|
||||
if (!i2p::fs::Exists (i2pcp_crt) || !i2p::fs::Exists (i2pcp_key)) {
|
||||
LogPrint (eLogInfo, "I2PControl: creating new certificate for control connection");
|
||||
LogPrint (eLogInfo, "I2PControl: Creating new certificate for control connection");
|
||||
CreateCertificate (i2pcp_crt.c_str(), i2pcp_key.c_str());
|
||||
} else {
|
||||
LogPrint(eLogDebug, "I2PControl: using cert from ", i2pcp_crt);
|
||||
LogPrint(eLogDebug, "I2PControl: Using cert from ", i2pcp_crt);
|
||||
}
|
||||
m_SSLContext.set_options (boost::asio::ssl::context::default_workarounds | boost::asio::ssl::context::no_sslv2 | boost::asio::ssl::context::single_dh_use);
|
||||
m_SSLContext.use_certificate_file (i2pcp_crt, boost::asio::ssl::context::pem);
|
||||
|
@ -142,7 +142,7 @@ namespace client
|
|||
try {
|
||||
m_Service.run ();
|
||||
} catch (std::exception& ex) {
|
||||
LogPrint (eLogError, "I2PControl: runtime exception: ", ex.what ());
|
||||
LogPrint (eLogError, "I2PControl: Runtime exception: ", ex.what ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -160,10 +160,10 @@ namespace client
|
|||
Accept ();
|
||||
|
||||
if (ecode) {
|
||||
LogPrint (eLogError, "I2PControl: accept error: ", ecode.message ());
|
||||
LogPrint (eLogError, "I2PControl: Accept error: ", ecode.message ());
|
||||
return;
|
||||
}
|
||||
LogPrint (eLogDebug, "I2PControl: new request from ", socket->lowest_layer ().remote_endpoint ());
|
||||
LogPrint (eLogDebug, "I2PControl: New request from ", socket->lowest_layer ().remote_endpoint ());
|
||||
Handshake (socket);
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ namespace client
|
|||
void I2PControlService::HandleHandshake (const boost::system::error_code& ecode, std::shared_ptr<ssl_socket> socket)
|
||||
{
|
||||
if (ecode) {
|
||||
LogPrint (eLogError, "I2PControl: handshake error: ", ecode.message ());
|
||||
LogPrint (eLogError, "I2PControl: Handshake error: ", ecode.message ());
|
||||
return;
|
||||
}
|
||||
//std::this_thread::sleep_for (std::chrono::milliseconds(5));
|
||||
|
@ -202,7 +202,7 @@ namespace client
|
|||
{
|
||||
if (ecode)
|
||||
{
|
||||
LogPrint (eLogError, "I2PControl: read error: ", ecode.message ());
|
||||
LogPrint (eLogError, "I2PControl: Read error: ", ecode.message ());
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -225,7 +225,7 @@ namespace client
|
|||
}
|
||||
if (ss.eof ())
|
||||
{
|
||||
LogPrint (eLogError, "I2PControl: malformed request, HTTP header expected");
|
||||
LogPrint (eLogError, "I2PControl: Malformed request, HTTP header expected");
|
||||
return; // TODO:
|
||||
}
|
||||
std::streamoff rem = contentLength + ss.tellg () - bytes_transferred; // more bytes to read
|
||||
|
@ -250,7 +250,7 @@ namespace client
|
|||
}
|
||||
else
|
||||
{
|
||||
LogPrint (eLogWarning, "I2PControl: unknown method ", method);
|
||||
LogPrint (eLogWarning, "I2PControl: Unknown method ", method);
|
||||
response << "{\"id\":null,\"error\":";
|
||||
response << "{\"code\":-32601,\"message\":\"Method not found\"},";
|
||||
response << "\"jsonrpc\":\"2.0\"}";
|
||||
|
@ -259,7 +259,7 @@ namespace client
|
|||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
LogPrint (eLogError, "I2PControl: exception when handle request: ", ex.what ());
|
||||
LogPrint (eLogError, "I2PControl: Exception when handle request: ", ex.what ());
|
||||
std::ostringstream response;
|
||||
response << "{\"id\":null,\"error\":";
|
||||
response << "{\"code\":-32700,\"message\":\"" << ex.what () << "\"},";
|
||||
|
@ -268,7 +268,7 @@ namespace client
|
|||
}
|
||||
catch (...)
|
||||
{
|
||||
LogPrint (eLogError, "I2PControl: handle request unknown exception");
|
||||
LogPrint (eLogError, "I2PControl: Handle request unknown exception");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ namespace client
|
|||
std::shared_ptr<ssl_socket> socket, std::shared_ptr<I2PControlBuffer> buf)
|
||||
{
|
||||
if (ecode) {
|
||||
LogPrint (eLogError, "I2PControl: write error: ", ecode.message ());
|
||||
LogPrint (eLogError, "I2PControl: Write error: ", ecode.message ());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ namespace client
|
|||
|
||||
void I2PControlService::PasswordHandler (const std::string& value)
|
||||
{
|
||||
LogPrint (eLogWarning, "I2PControl: new password=", value, ", to make it persistent you should update your config!");
|
||||
LogPrint (eLogWarning, "I2PControl: New password=", value, ", to make it persistent you should update your config!");
|
||||
m_Password = value;
|
||||
m_Tokens.clear ();
|
||||
}
|
||||
|
@ -577,25 +577,25 @@ namespace client
|
|||
|
||||
// save cert
|
||||
if ((f = fopen (crt_path, "wb")) != NULL) {
|
||||
LogPrint (eLogInfo, "I2PControl: saving new cert to ", crt_path);
|
||||
LogPrint (eLogInfo, "I2PControl: Saving new cert to ", crt_path);
|
||||
PEM_write_X509 (f, x509);
|
||||
fclose (f);
|
||||
} else {
|
||||
LogPrint (eLogError, "I2PControl: can't write cert: ", strerror(errno));
|
||||
LogPrint (eLogError, "I2PControl: Can't write cert: ", strerror(errno));
|
||||
}
|
||||
|
||||
// save key
|
||||
if ((f = fopen (key_path, "wb")) != NULL) {
|
||||
LogPrint (eLogInfo, "I2PControl: saving cert key to ", key_path);
|
||||
LogPrint (eLogInfo, "I2PControl: Saving cert key to ", key_path);
|
||||
PEM_write_PrivateKey (f, pkey, NULL, NULL, 0, NULL, NULL);
|
||||
fclose (f);
|
||||
} else {
|
||||
LogPrint (eLogError, "I2PControl: can't write key: ", strerror(errno));
|
||||
LogPrint (eLogError, "I2PControl: Can't write key: ", strerror(errno));
|
||||
}
|
||||
|
||||
X509_free (x509);
|
||||
} else {
|
||||
LogPrint (eLogError, "I2PControl: can't create RSA key for certificate");
|
||||
LogPrint (eLogError, "I2PControl: Can't create RSA key for certificate");
|
||||
}
|
||||
EVP_PKEY_free (pkey);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace transport
|
|||
{
|
||||
if (m_IsRunning)
|
||||
{
|
||||
LogPrint(eLogInfo, "UPnP: stopping");
|
||||
LogPrint(eLogInfo, "UPnP: Stopping");
|
||||
m_IsRunning = false;
|
||||
m_Timer.cancel ();
|
||||
m_Service.stop ();
|
||||
|
@ -46,7 +46,7 @@ namespace transport
|
|||
void UPnP::Start()
|
||||
{
|
||||
m_IsRunning = true;
|
||||
LogPrint(eLogInfo, "UPnP: starting");
|
||||
LogPrint(eLogInfo, "UPnP: Starting");
|
||||
m_Service.post (std::bind (&UPnP::Discover, this));
|
||||
std::unique_lock<std::mutex> l(m_StartedMutex);
|
||||
m_Thread.reset (new std::thread (std::bind (&UPnP::Run, this)));
|
||||
|
@ -72,7 +72,7 @@ namespace transport
|
|||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
LogPrint (eLogError, "UPnP: runtime exception: ", ex.what ());
|
||||
LogPrint (eLogError, "UPnP: Runtime exception: ", ex.what ());
|
||||
PortMapping ();
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ namespace transport
|
|||
|
||||
if (isError)
|
||||
{
|
||||
LogPrint (eLogError, "UPnP: unable to discover Internet Gateway Devices: error ", err);
|
||||
LogPrint (eLogError, "UPnP: Unable to discover Internet Gateway Devices: error ", err);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -117,22 +117,22 @@ namespace transport
|
|||
err = UPNP_GetExternalIPAddress (m_upnpUrls.controlURL, m_upnpData.first.servicetype, m_externalIPAddress);
|
||||
if(err != UPNPCOMMAND_SUCCESS)
|
||||
{
|
||||
LogPrint (eLogError, "UPnP: unable to get external address: error ", err);
|
||||
LogPrint (eLogError, "UPnP: Unable to get external address: error ", err);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogPrint (eLogError, "UPnP: found Internet Gateway Device ", m_upnpUrls.controlURL);
|
||||
LogPrint (eLogError, "UPnP: Found Internet Gateway Device ", m_upnpUrls.controlURL);
|
||||
if (!m_externalIPAddress[0])
|
||||
{
|
||||
LogPrint (eLogError, "UPnP: found Internet Gateway Device doesn't know our external address");
|
||||
LogPrint (eLogError, "UPnP: Found Internet Gateway Device doesn't know our external address");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogPrint (eLogError, "UPnP: unable to find valid Internet Gateway Device: error ", err);
|
||||
LogPrint (eLogError, "UPnP: Unable to find valid Internet Gateway Device: error ", err);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ namespace transport
|
|||
err = CheckMapping (strPort.c_str (), strType.c_str ());
|
||||
if (err != UPNPCOMMAND_SUCCESS) // if mapping not found
|
||||
{
|
||||
LogPrint (eLogDebug, "UPnP: possibly port ", strPort, " is not forwarded: return code ", err);
|
||||
LogPrint (eLogDebug, "UPnP: Port ", strPort, " is possibly not forwarded: return code ", err);
|
||||
|
||||
#if ((MINIUPNPC_API_VERSION >= 8) || defined (UPNPDISCOVER_SUCCESS))
|
||||
err = UPNP_AddPortMapping (m_upnpUrls.controlURL, m_upnpData.first.servicetype, strPort.c_str (), strPort.c_str (), m_NetworkAddr, strDesc.c_str (), strType.c_str (), NULL, NULL);
|
||||
|
@ -192,18 +192,18 @@ namespace transport
|
|||
#endif
|
||||
if (err != UPNPCOMMAND_SUCCESS)
|
||||
{
|
||||
LogPrint (eLogError, "UPnP: port forwarding to ", m_NetworkAddr, ":", strPort, " failed: return code ", err);
|
||||
LogPrint (eLogError, "UPnP: Port forwarding to ", m_NetworkAddr, ":", strPort, " failed: return code ", err);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogPrint (eLogInfo, "UPnP: port successfully forwarded (", m_externalIPAddress ,":", strPort, " type ", strType, " -> ", m_NetworkAddr ,":", strPort ,")");
|
||||
LogPrint (eLogInfo, "UPnP: Port successfully forwarded (", m_externalIPAddress ,":", strPort, " type ", strType, " -> ", m_NetworkAddr ,":", strPort ,")");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogPrint (eLogDebug, "UPnP: external forward from ", m_NetworkAddr, ":", strPort, " exists on current Internet Gateway Device");
|
||||
LogPrint (eLogDebug, "UPnP: External forward from ", m_NetworkAddr, ":", strPort, " exists on current Internet Gateway Device");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ void handle_signal(int sig)
|
|||
{
|
||||
i2p::context.SetAcceptsTunnels (false);
|
||||
Daemon.gracefulShutdownInterval = 10*60; // 10 minutes
|
||||
LogPrint(eLogInfo, "Graceful shutdown after ", Daemon.gracefulShutdownInterval, " seconds");
|
||||
LogPrint(eLogInfo, "Graceful shutdown in ", Daemon.gracefulShutdownInterval, " seconds");
|
||||
}
|
||||
else
|
||||
Daemon.running = 0;
|
||||
|
@ -72,7 +72,7 @@ namespace i2p
|
|||
|
||||
if (pid < 0) // error
|
||||
{
|
||||
LogPrint(eLogError, "Daemon: could not fork: ", strerror(errno));
|
||||
LogPrint(eLogError, "Daemon: Could not fork: ", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -81,13 +81,13 @@ namespace i2p
|
|||
int sid = setsid();
|
||||
if (sid < 0)
|
||||
{
|
||||
LogPrint(eLogError, "Daemon: could not create process group.");
|
||||
LogPrint(eLogError, "Daemon: Could not create process group.");
|
||||
return false;
|
||||
}
|
||||
std::string d = i2p::fs::GetDataDir();
|
||||
if (chdir(d.c_str()) != 0)
|
||||
{
|
||||
LogPrint(eLogError, "Daemon: could not chdir: ", strerror(errno));
|
||||
LogPrint(eLogError, "Daemon: Could not chdir: ", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -102,14 +102,14 @@ namespace i2p
|
|||
uint16_t nfiles; i2p::config::GetOption("limits.openfiles", nfiles);
|
||||
getrlimit(RLIMIT_NOFILE, &limit);
|
||||
if (nfiles == 0) {
|
||||
LogPrint(eLogInfo, "Daemon: using system limit in ", limit.rlim_cur, " max open files");
|
||||
LogPrint(eLogInfo, "Daemon: Using system limit in ", limit.rlim_cur, " max open files");
|
||||
} else if (nfiles <= limit.rlim_max) {
|
||||
limit.rlim_cur = nfiles;
|
||||
if (setrlimit(RLIMIT_NOFILE, &limit) == 0) {
|
||||
LogPrint(eLogInfo, "Daemon: set max number of open files to ",
|
||||
LogPrint(eLogInfo, "Daemon: Set max number of open files to ",
|
||||
nfiles, " (system limit is ", limit.rlim_max, ")");
|
||||
} else {
|
||||
LogPrint(eLogError, "Daemon: can't set max number of open files: ", strerror(errno));
|
||||
LogPrint(eLogError, "Daemon: Can't set max number of open files: ", strerror(errno));
|
||||
}
|
||||
} else {
|
||||
LogPrint(eLogError, "Daemon: limits.openfiles exceeds system limit: ", limit.rlim_max);
|
||||
|
@ -122,11 +122,11 @@ namespace i2p
|
|||
if (cfsize <= limit.rlim_max) {
|
||||
limit.rlim_cur = cfsize;
|
||||
if (setrlimit(RLIMIT_CORE, &limit) != 0) {
|
||||
LogPrint(eLogError, "Daemon: can't set max size of coredump: ", strerror(errno));
|
||||
LogPrint(eLogError, "Daemon: Can't set max size of coredump: ", strerror(errno));
|
||||
} else if (cfsize == 0) {
|
||||
LogPrint(eLogInfo, "Daemon: coredumps disabled");
|
||||
} else {
|
||||
LogPrint(eLogInfo, "Daemon: set max size of core files to ", cfsize / 1024, "Kb");
|
||||
LogPrint(eLogInfo, "Daemon: Set max size of core files to ", cfsize / 1024, "Kb");
|
||||
}
|
||||
} else {
|
||||
LogPrint(eLogError, "Daemon: limits.coresize exceeds system limit: ", limit.rlim_max);
|
||||
|
@ -143,14 +143,14 @@ namespace i2p
|
|||
pidFH = open(pidfile.c_str(), O_RDWR | O_CREAT, 0600);
|
||||
if (pidFH < 0)
|
||||
{
|
||||
LogPrint(eLogError, "Daemon: could not create pid file ", pidfile, ": ", strerror(errno));
|
||||
LogPrint(eLogError, "Daemon: Could not create pid file ", pidfile, ": ", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef ANDROID
|
||||
if (lockf(pidFH, F_TLOCK, 0) != 0)
|
||||
{
|
||||
LogPrint(eLogError, "Daemon: could not lock pid file ", pidfile, ": ", strerror(errno));
|
||||
LogPrint(eLogError, "Daemon: Could not lock pid file ", pidfile, ": ", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -159,7 +159,7 @@ namespace i2p
|
|||
ftruncate(pidFH, 0);
|
||||
if (write(pidFH, pid, strlen(pid)) < 0)
|
||||
{
|
||||
LogPrint(eLogError, "Daemon: could not write pidfile: ", strerror(errno));
|
||||
LogPrint(eLogError, "Daemon: Could not write pidfile: ", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace data
|
|||
break;
|
||||
}
|
||||
default:
|
||||
LogPrint (eLogError, "Blinding: signature type ", (int)sigType, " is not ECDSA");
|
||||
LogPrint (eLogError, "Blinding: Signature type ", (int)sigType, " is not ECDSA");
|
||||
}
|
||||
if (group)
|
||||
{
|
||||
|
@ -156,7 +156,7 @@ namespace data
|
|||
size_t l = i2p::data::Base32ToByteStream (b33.c_str (), b33.length (), addr, 40);
|
||||
if (l < 32)
|
||||
{
|
||||
LogPrint (eLogError, "Blinding: malformed b33 ", b33);
|
||||
LogPrint (eLogError, "Blinding: Malformed b33 ", b33);
|
||||
return;
|
||||
}
|
||||
uint32_t checksum = crc32 (0, addr + 3, l - 3);
|
||||
|
@ -186,10 +186,10 @@ namespace data
|
|||
memcpy (m_PublicKey.data (), addr + offset, len);
|
||||
}
|
||||
else
|
||||
LogPrint (eLogError, "Blinding: public key in b33 address is too short for signature type ", (int)m_SigType);
|
||||
LogPrint (eLogError, "Blinding: Public key in b33 address is too short for signature type ", (int)m_SigType);
|
||||
}
|
||||
else
|
||||
LogPrint (eLogError, "Blinding: unknown signature type ", (int)m_SigType, " in b33");
|
||||
LogPrint (eLogError, "Blinding: Unknown signature type ", (int)m_SigType, " in b33");
|
||||
}
|
||||
|
||||
std::string BlindedPublicKey::ToB33 () const
|
||||
|
@ -256,7 +256,7 @@ namespace data
|
|||
publicKeyLength = i2p::crypto::EDDSA25519_PUBLIC_KEY_LENGTH;
|
||||
break;
|
||||
default:
|
||||
LogPrint (eLogError, "Blinding: can't blind signature type ", (int)m_SigType);
|
||||
LogPrint (eLogError, "Blinding: Can't blind signature type ", (int)m_SigType);
|
||||
}
|
||||
return publicKeyLength;
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ namespace data
|
|||
break;
|
||||
}
|
||||
default:
|
||||
LogPrint (eLogError, "Blinding: can't blind signature type ", (int)m_SigType);
|
||||
LogPrint (eLogError, "Blinding: Can't blind signature type ", (int)m_SigType);
|
||||
}
|
||||
return publicKeyLength;
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ namespace data
|
|||
SHA256_Final ((uint8_t *)hash, &ctx);
|
||||
}
|
||||
else
|
||||
LogPrint (eLogError, "Blinding: blinded key type ", (int)m_BlindedSigType, " is not supported");
|
||||
LogPrint (eLogError, "Blinding: Blinded key type ", (int)m_BlindedSigType, " is not supported");
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace client
|
|||
it = params->find (I2CP_PARAM_TAGS_TO_SEND);
|
||||
if (it != params->end ())
|
||||
numTags = std::stoi(it->second);
|
||||
LogPrint (eLogInfo, "Destination: parameters for tunnel set to: ", inQty, " inbound (", inLen, " hops), ", outQty, " outbound (", outLen, " hops), ", numTags, " tags");
|
||||
LogPrint (eLogInfo, "Destination: Parameters for tunnel set to: ", inQty, " inbound (", inLen, " hops), ", outQty, " outbound (", outLen, " hops), ", numTags, " tags");
|
||||
it = params->find (I2CP_PARAM_RATCHET_INBOUND_TAGS);
|
||||
if (it != params->end ())
|
||||
SetNumRatchetInboundTags (std::stoi(it->second));
|
||||
|
@ -112,7 +112,7 @@ namespace client
|
|||
m_LeaseSetPrivKey.reset (new i2p::data::Tag<32>());
|
||||
if (m_LeaseSetPrivKey->FromBase64 (it->second) != 32)
|
||||
{
|
||||
LogPrint(eLogError, "Destination: invalid value i2cp.leaseSetPrivKey ", it->second);
|
||||
LogPrint(eLogError, "Destination: Invalid value i2cp.leaseSetPrivKey ", it->second);
|
||||
m_LeaseSetPrivKey.reset (nullptr);
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ namespace client
|
|||
}
|
||||
catch (std::exception & ex)
|
||||
{
|
||||
LogPrint(eLogError, "Destination: unable to parse parameters for destination: ", ex.what());
|
||||
LogPrint(eLogError, "Destination: Unable to parse parameters for destination: ", ex.what());
|
||||
}
|
||||
SetNumTags (numTags);
|
||||
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (inLen, outLen, inQty, outQty);
|
||||
|
@ -136,7 +136,7 @@ namespace client
|
|||
auto minlatency = std::stoi(itr->second);
|
||||
if ( minlatency > 0 && maxlatency > 0 ) {
|
||||
// set tunnel pool latency
|
||||
LogPrint(eLogInfo, "Destination: requiring tunnel latency [", minlatency, "ms, ", maxlatency, "ms]");
|
||||
LogPrint(eLogInfo, "Destination: Requiring tunnel latency [", minlatency, "ms, ", maxlatency, "ms]");
|
||||
m_Pool->RequireLatency(minlatency, maxlatency);
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ namespace client
|
|||
}
|
||||
else
|
||||
{
|
||||
LogPrint (eLogWarning, "Destination: remote LeaseSet expired");
|
||||
LogPrint (eLogWarning, "Destination: Remote LeaseSet expired");
|
||||
std::lock_guard<std::mutex> lock(m_RemoteLeaseSetsMutex);
|
||||
m_RemoteLeaseSets.erase (ident);
|
||||
return nullptr;
|
||||
|
@ -966,7 +966,7 @@ namespace client
|
|||
}
|
||||
catch (std::exception & ex)
|
||||
{
|
||||
LogPrint(eLogError, "Destination: unable to parse parameters for destination: ", ex.what());
|
||||
LogPrint(eLogError, "Destination: Unable to parse parameters for destination: ", ex.what());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1050,7 +1050,7 @@ namespace client
|
|||
{
|
||||
if (!streamRequestComplete)
|
||||
{
|
||||
LogPrint (eLogError, "Destination: request callback is not specified in CreateStream");
|
||||
LogPrint (eLogError, "Destination: Request callback is not specified in CreateStream");
|
||||
return;
|
||||
}
|
||||
auto leaseSet = FindLeaseSet (dest);
|
||||
|
@ -1074,7 +1074,7 @@ namespace client
|
|||
{
|
||||
if (!streamRequestComplete)
|
||||
{
|
||||
LogPrint (eLogError, "Destination: request callback is not specified in CreateStream");
|
||||
LogPrint (eLogError, "Destination: Request callback is not specified in CreateStream");
|
||||
return;
|
||||
}
|
||||
auto s = GetSharedFromThis ();
|
||||
|
@ -1253,7 +1253,7 @@ namespace client
|
|||
if (m_StandardEncryptionKey && m_StandardEncryptionKey->decryptor)
|
||||
return m_StandardEncryptionKey->decryptor->Decrypt (encrypted, data);
|
||||
else
|
||||
LogPrint (eLogError, "Destinations: decryptor is not set");
|
||||
LogPrint (eLogError, "Destinations: Decryptor is not set");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -381,7 +381,7 @@ namespace garlic
|
|||
newTagset->NextSessionTagRatchet ();
|
||||
m_SendTagset = newTagset;
|
||||
m_SendForwardKey = false;
|
||||
LogPrint (eLogDebug, "Garlic: next send tagset ", newTagset->GetTagSetID (), " created");
|
||||
LogPrint (eLogDebug, "Garlic: Next send tagset ", newTagset->GetTagSetID (), " created");
|
||||
}
|
||||
else
|
||||
LogPrint (eLogDebug, "Garlic: Unexpected next key ", keyID);
|
||||
|
@ -424,7 +424,7 @@ namespace garlic
|
|||
GenerateMoreReceiveTags (newTagset, (GetOwner () && GetOwner ()->GetNumRatchetInboundTags () > 0) ?
|
||||
GetOwner ()->GetNumRatchetInboundTags () : ECIESX25519_MAX_NUM_GENERATED_TAGS);
|
||||
receiveTagset->Expire ();
|
||||
LogPrint (eLogDebug, "Garlic: next receive tagset ", tagsetID, " created");
|
||||
LogPrint (eLogDebug, "Garlic: Next receive tagset ", tagsetID, " created");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -446,7 +446,7 @@ namespace garlic
|
|||
m_NextSendRatchet->key = i2p::transport::transports.GetNextX25519KeysPair ();
|
||||
|
||||
m_SendForwardKey = true;
|
||||
LogPrint (eLogDebug, "Garlic: new send ratchet ", m_NextSendRatchet->newKey ? "new" : "old", " key ", m_NextSendRatchet->keyID, " created");
|
||||
LogPrint (eLogDebug, "Garlic: New send ratchet ", m_NextSendRatchet->newKey ? "new" : "old", " key ", m_NextSendRatchet->keyID, " created");
|
||||
}
|
||||
|
||||
bool ECIESX25519AEADRatchetSession::NewOutgoingSessionMessage (const uint8_t * payload, size_t len, uint8_t * out, size_t outLen, bool isStatic)
|
||||
|
@ -618,7 +618,7 @@ namespace garlic
|
|||
bool ECIESX25519AEADRatchetSession::HandleNewOutgoingSessionReply (uint8_t * buf, size_t len)
|
||||
{
|
||||
// we are Alice
|
||||
LogPrint (eLogDebug, "Garlic: reply received");
|
||||
LogPrint (eLogDebug, "Garlic: Reply received");
|
||||
const uint8_t * tag = buf;
|
||||
buf += 8; len -= 8; // tag
|
||||
uint8_t bepk[32]; // Bob's ephemeral key
|
||||
|
@ -700,7 +700,7 @@ namespace garlic
|
|||
uint64_t tag = m_SendTagset->GetNextSessionTag ();
|
||||
if (!tag)
|
||||
{
|
||||
LogPrint (eLogError, "Garlic: can't create new ECIES-X25519-AEAD-Ratchet tag for send tagset");
|
||||
LogPrint (eLogError, "Garlic: Can't create new ECIES-X25519-AEAD-Ratchet tag for send tagset");
|
||||
if (GetOwner ())
|
||||
GetOwner ()->RemoveECIESx25519Session (m_RemoteStaticKey);
|
||||
return false;
|
||||
|
@ -912,7 +912,7 @@ namespace garlic
|
|||
{
|
||||
if (payloadLen > I2NP_MAX_MESSAGE_SIZE)
|
||||
{
|
||||
LogPrint (eLogError, "Garlic: payload length ", payloadLen, " is too long");
|
||||
LogPrint (eLogError, "Garlic: Payload length ", payloadLen, " is too long");
|
||||
return 0;
|
||||
}
|
||||
m_LastSentTimestamp = ts;
|
||||
|
|
|
@ -586,7 +586,7 @@ namespace garlic
|
|||
if (it->second.tagset->HandleNextMessage (buf, len, it->second.index))
|
||||
m_LastTagset = it->second.tagset;
|
||||
else
|
||||
LogPrint (eLogError, "Garlic: can't handle ECIES-X25519-AEAD-Ratchet message");
|
||||
LogPrint (eLogError, "Garlic: Can't handle ECIES-X25519-AEAD-Ratchet message");
|
||||
m_ECIESx25519Tags.erase (it);
|
||||
return true;
|
||||
}
|
||||
|
@ -629,7 +629,7 @@ namespace garlic
|
|||
SHA256 (buf, payloadSize, digest);
|
||||
if (memcmp (payloadHash, digest, 32)) // payload hash doesn't match
|
||||
{
|
||||
LogPrint (eLogError, "Garlic: wrong payload hash");
|
||||
LogPrint (eLogError, "Garlic: Wrong payload hash");
|
||||
return;
|
||||
}
|
||||
HandleGarlicPayload (buf, payloadSize, from);
|
||||
|
@ -639,7 +639,7 @@ namespace garlic
|
|||
{
|
||||
if (len < 1)
|
||||
{
|
||||
LogPrint (eLogError, "Garlic: payload is too short");
|
||||
LogPrint (eLogError, "Garlic: Payload is too short");
|
||||
return;
|
||||
}
|
||||
int numCloves = buf[0];
|
||||
|
@ -654,7 +654,7 @@ namespace garlic
|
|||
if (flag & 0x80) // encrypted?
|
||||
{
|
||||
// TODO: implement
|
||||
LogPrint (eLogWarning, "Garlic: clove encrypted");
|
||||
LogPrint (eLogWarning, "Garlic: Clove encrypted");
|
||||
buf += 32;
|
||||
}
|
||||
ptrdiff_t offset = buf - buf1;
|
||||
|
@ -662,35 +662,35 @@ namespace garlic
|
|||
switch (deliveryType)
|
||||
{
|
||||
case eGarlicDeliveryTypeLocal:
|
||||
LogPrint (eLogDebug, "Garlic: type local");
|
||||
LogPrint (eLogDebug, "Garlic: Type local");
|
||||
if (offset > (int)len)
|
||||
{
|
||||
LogPrint (eLogError, "Garlic: message is too short");
|
||||
LogPrint (eLogError, "Garlic: Message is too short");
|
||||
break;
|
||||
}
|
||||
HandleI2NPMessage (buf, len - offset);
|
||||
break;
|
||||
case eGarlicDeliveryTypeDestination:
|
||||
LogPrint (eLogDebug, "Garlic: type destination");
|
||||
LogPrint (eLogDebug, "Garlic: Type destination");
|
||||
buf += 32; // destination. check it later or for multiple destinations
|
||||
offset = buf - buf1;
|
||||
if (offset > (int)len)
|
||||
{
|
||||
LogPrint (eLogError, "Garlic: message is too short");
|
||||
LogPrint (eLogError, "Garlic: Message is too short");
|
||||
break;
|
||||
}
|
||||
HandleI2NPMessage (buf, len - offset);
|
||||
break;
|
||||
case eGarlicDeliveryTypeTunnel:
|
||||
{
|
||||
LogPrint (eLogDebug, "Garlic: type tunnel");
|
||||
LogPrint (eLogDebug, "Garlic: Type tunnel");
|
||||
// gwHash and gwTunnel sequence is reverted
|
||||
uint8_t * gwHash = buf;
|
||||
buf += 32;
|
||||
offset = buf - buf1;
|
||||
if (offset + 4 > (int)len)
|
||||
{
|
||||
LogPrint (eLogError, "Garlic: message is too short");
|
||||
LogPrint (eLogError, "Garlic: Message is too short");
|
||||
break;
|
||||
}
|
||||
uint32_t gwTunnel = bufbe32toh (buf);
|
||||
|
@ -721,22 +721,22 @@ namespace garlic
|
|||
{
|
||||
if (offset > (int)len)
|
||||
{
|
||||
LogPrint (eLogError, "Garlic: message is too short");
|
||||
LogPrint (eLogError, "Garlic: Message is too short");
|
||||
break;
|
||||
}
|
||||
i2p::transport::transports.SendMessage (ident,
|
||||
CreateI2NPMessage (buf, GetI2NPMessageLength (buf, len - offset)));
|
||||
}
|
||||
else
|
||||
LogPrint (eLogWarning, "Garlic: type router for inbound tunnels not supported");
|
||||
LogPrint (eLogWarning, "Garlic: Type router for inbound tunnels not supported");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
LogPrint (eLogWarning, "Garlic: unknown delivery type ", (int)deliveryType);
|
||||
LogPrint (eLogWarning, "Garlic: Unknown delivery type ", (int)deliveryType);
|
||||
}
|
||||
if (offset > (int)len)
|
||||
{
|
||||
LogPrint (eLogError, "Garlic: message is too short");
|
||||
LogPrint (eLogError, "Garlic: Message is too short");
|
||||
break;
|
||||
}
|
||||
buf += GetI2NPMessageLength (buf, len - offset); // I2NP
|
||||
|
@ -746,7 +746,7 @@ namespace garlic
|
|||
offset = buf - buf1;
|
||||
if (offset > (int)len)
|
||||
{
|
||||
LogPrint (eLogError, "Garlic: clove is too long");
|
||||
LogPrint (eLogError, "Garlic: Clove is too long");
|
||||
break;
|
||||
}
|
||||
len -= offset;
|
||||
|
@ -780,7 +780,7 @@ namespace garlic
|
|||
session = it->second;
|
||||
if (session->IsInactive (i2p::util::GetSecondsSinceEpoch ()))
|
||||
{
|
||||
LogPrint (eLogDebug, "Garlic: session restarted");
|
||||
LogPrint (eLogDebug, "Garlic: Session restarted");
|
||||
session = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -1030,7 +1030,7 @@ namespace garlic
|
|||
switch (deliveryType)
|
||||
{
|
||||
case eGarlicDeliveryTypeDestination:
|
||||
LogPrint (eLogDebug, "Garlic: type destination");
|
||||
LogPrint (eLogDebug, "Garlic: Type destination");
|
||||
buf += 32; // TODO: check destination
|
||||
#if (__cplusplus >= 201703L) // C++ 17 or higher
|
||||
[[fallthrough]];
|
||||
|
@ -1038,7 +1038,7 @@ namespace garlic
|
|||
// no break here
|
||||
case eGarlicDeliveryTypeLocal:
|
||||
{
|
||||
LogPrint (eLogDebug, "Garlic: type local");
|
||||
LogPrint (eLogDebug, "Garlic: Type local");
|
||||
I2NPMessageType typeID = (I2NPMessageType)(buf[0]); buf++; // typeid
|
||||
int32_t msgID = bufbe32toh (buf); buf += 4; // msgID
|
||||
buf += 4; // expiration
|
||||
|
@ -1046,19 +1046,19 @@ namespace garlic
|
|||
if (offset <= (int)len)
|
||||
HandleCloveI2NPMessage (typeID, buf, len - offset, msgID);
|
||||
else
|
||||
LogPrint (eLogError, "Garlic: clove is too long");
|
||||
LogPrint (eLogError, "Garlic: Clove is too long");
|
||||
break;
|
||||
}
|
||||
case eGarlicDeliveryTypeTunnel:
|
||||
{
|
||||
LogPrint (eLogDebug, "Garlic: type tunnel");
|
||||
LogPrint (eLogDebug, "Garlic: Type tunnel");
|
||||
// gwHash and gwTunnel sequence is reverted
|
||||
const uint8_t * gwHash = buf;
|
||||
buf += 32;
|
||||
ptrdiff_t offset = buf - buf1;
|
||||
if (offset + 13 > (int)len)
|
||||
{
|
||||
LogPrint (eLogError, "Garlic: message is too short");
|
||||
LogPrint (eLogError, "Garlic: Message is too short");
|
||||
break;
|
||||
}
|
||||
uint32_t gwTunnel = bufbe32toh (buf); buf += 4;
|
||||
|
@ -1079,7 +1079,7 @@ namespace garlic
|
|||
break;
|
||||
}
|
||||
default:
|
||||
LogPrint (eLogWarning, "Garlic: unexpected delivery type ", (int)deliveryType);
|
||||
LogPrint (eLogWarning, "Garlic: Unexpected delivery type ", (int)deliveryType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace i2p
|
|||
{
|
||||
auto msg = NewI2NPMessage (len);
|
||||
if (msg->Concat (buf, len) < len)
|
||||
LogPrint (eLogError, "I2NP: message length ", len, " exceeds max length ", msg->maxLen);
|
||||
LogPrint (eLogError, "I2NP: Message length ", len, " exceeds max length ", msg->maxLen);
|
||||
msg->FillI2NPMessageHeader (msgType, replyMsgID);
|
||||
return msg;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ namespace i2p
|
|||
msg->from = from;
|
||||
}
|
||||
else
|
||||
LogPrint (eLogError, "I2NP: message length ", len, " exceeds max length");
|
||||
LogPrint (eLogError, "I2NP: Message length ", len, " exceeds max length");
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
@ -698,7 +698,7 @@ namespace i2p
|
|||
htobe16buf (payload + TUNNEL_GATEWAY_HEADER_LENGTH_OFFSET, len);
|
||||
msg->len += TUNNEL_GATEWAY_HEADER_SIZE;
|
||||
if (msg->Concat (buf, len) < len)
|
||||
LogPrint (eLogError, "I2NP: tunnel gateway buffer overflow ", msg->maxLen);
|
||||
LogPrint (eLogError, "I2NP: Tunnel gateway buffer overflow ", msg->maxLen);
|
||||
msg->FillI2NPMessageHeader (eI2NPTunnelGateway);
|
||||
return msg;
|
||||
}
|
||||
|
@ -729,7 +729,7 @@ namespace i2p
|
|||
msg->offset += gatewayMsgOffset;
|
||||
msg->len += gatewayMsgOffset;
|
||||
if (msg->Concat (buf, len) < len)
|
||||
LogPrint (eLogError, "I2NP: tunnel gateway buffer overflow ", msg->maxLen);
|
||||
LogPrint (eLogError, "I2NP: Tunnel gateway buffer overflow ", msg->maxLen);
|
||||
msg->FillI2NPMessageHeader (msgType, replyMsgID); // create content message
|
||||
len = msg->GetLength ();
|
||||
msg->offset -= gatewayMsgOffset;
|
||||
|
@ -744,13 +744,13 @@ namespace i2p
|
|||
{
|
||||
if (len < I2NP_HEADER_SIZE_OFFSET + 2)
|
||||
{
|
||||
LogPrint (eLogError, "I2NP: message length ", len, " is smaller than header");
|
||||
LogPrint (eLogError, "I2NP: Message length ", len, " is smaller than header");
|
||||
return len;
|
||||
}
|
||||
auto l = bufbe16toh (msg + I2NP_HEADER_SIZE_OFFSET) + I2NP_HEADER_SIZE;
|
||||
if (l > len)
|
||||
{
|
||||
LogPrint (eLogError, "I2NP: message length ", l, " exceeds buffer length ", len);
|
||||
LogPrint (eLogError, "I2NP: Message length ", l, " exceeds buffer length ", len);
|
||||
l = len;
|
||||
}
|
||||
return l;
|
||||
|
@ -760,18 +760,18 @@ namespace i2p
|
|||
{
|
||||
if (len < I2NP_HEADER_SIZE)
|
||||
{
|
||||
LogPrint (eLogError, "I2NP: message length ", len, " is smaller than header");
|
||||
LogPrint (eLogError, "I2NP: Message length ", len, " is smaller than header");
|
||||
return;
|
||||
}
|
||||
uint8_t typeID = msg[I2NP_HEADER_TYPEID_OFFSET];
|
||||
uint32_t msgID = bufbe32toh (msg + I2NP_HEADER_MSGID_OFFSET);
|
||||
LogPrint (eLogDebug, "I2NP: msg received len=", len,", type=", (int)typeID, ", msgID=", (unsigned int)msgID);
|
||||
LogPrint (eLogDebug, "I2NP: Message received len=", len,", type=", (int)typeID, ", msgID=", (unsigned int)msgID);
|
||||
uint8_t * buf = msg + I2NP_HEADER_SIZE;
|
||||
auto size = bufbe16toh (msg + I2NP_HEADER_SIZE_OFFSET);
|
||||
len -= I2NP_HEADER_SIZE;
|
||||
if (size > len)
|
||||
{
|
||||
LogPrint (eLogError, "I2NP: payload size ", size, " exceeds buffer length ", len);
|
||||
LogPrint (eLogError, "I2NP: Payload size ", size, " exceeds buffer length ", len);
|
||||
size = len;
|
||||
}
|
||||
switch (typeID)
|
||||
|
|
|
@ -214,7 +214,7 @@ namespace data
|
|||
{
|
||||
if (len < DEFAULT_IDENTITY_SIZE)
|
||||
{
|
||||
LogPrint (eLogError, "Identity: buffer length ", len, " is too small");
|
||||
LogPrint (eLogError, "Identity: Buffer length ", len, " is too small");
|
||||
return 0;
|
||||
}
|
||||
memcpy (&m_StandardIdentity, buf, DEFAULT_IDENTITY_SIZE);
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace data
|
|||
LogPrint (eLogDebug, "LeaseSet: read num=", (int)num);
|
||||
if (!num || num > MAX_NUM_LEASES)
|
||||
{
|
||||
LogPrint (eLogError, "LeaseSet: incorrect number of leases", (int)num);
|
||||
LogPrint (eLogError, "LeaseSet: Incorrect number of leases", (int)num);
|
||||
m_IsValid = false;
|
||||
return;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ namespace data
|
|||
}
|
||||
if (!m_ExpirationTime)
|
||||
{
|
||||
LogPrint (eLogWarning, "LeaseSet: all leases are expired. Dropped");
|
||||
LogPrint (eLogWarning, "LeaseSet: All leases have expired, dropping");
|
||||
m_IsValid = false;
|
||||
return;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ namespace data
|
|||
}
|
||||
else if (!m_Identity->Verify (m_Buffer, signedSize, leases))
|
||||
{
|
||||
LogPrint (eLogWarning, "LeaseSet: verification failed");
|
||||
LogPrint (eLogWarning, "LeaseSet: Verification failed");
|
||||
m_IsValid = false;
|
||||
}
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ namespace data
|
|||
{
|
||||
if (len <= m_BufferLen) m_BufferLen = len;
|
||||
else
|
||||
LogPrint (eLogError, "LeaseSet2: actual buffer size ", len , " exceeds full buffer size ", m_BufferLen);
|
||||
LogPrint (eLogError, "LeaseSet2: Actual buffer size ", len , " exceeds full buffer size ", m_BufferLen);
|
||||
}
|
||||
|
||||
LeaseSet2::LeaseSet2 (uint8_t storeType, const uint8_t * buf, size_t len, bool storeLeases, CryptoKeyType preferredCrypto):
|
||||
|
@ -331,7 +331,7 @@ namespace data
|
|||
m_TransientVerifier = ProcessOfflineSignature (identity, buf, len, offset);
|
||||
if (!m_TransientVerifier)
|
||||
{
|
||||
LogPrint (eLogError, "LeaseSet2: offline signature failed");
|
||||
LogPrint (eLogError, "LeaseSet2: Offline signature failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ namespace data
|
|||
bool verified = verifier->Verify (buf - 1, signatureOffset + 1, buf + signatureOffset);
|
||||
const_cast<uint8_t *>(buf)[-1] = c;
|
||||
if (!verified)
|
||||
LogPrint (eLogWarning, "LeaseSet2: verification failed");
|
||||
LogPrint (eLogWarning, "LeaseSet2: Verification failed");
|
||||
return verified;
|
||||
}
|
||||
|
||||
|
@ -489,7 +489,7 @@ namespace data
|
|||
m_TransientVerifier = ProcessOfflineSignature (blindedVerifier, buf, len, offset);
|
||||
if (!m_TransientVerifier)
|
||||
{
|
||||
LogPrint (eLogError, "LeaseSet2: offline signature failed");
|
||||
LogPrint (eLogError, "LeaseSet2: Offline signature failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ namespace data
|
|||
key->GetBlindedKey (date, blinded.data ());
|
||||
if (memcmp (blindedPublicKey, blinded.data (), blindedKeyLen))
|
||||
{
|
||||
LogPrint (eLogError, "LeaseSet2: blinded public key doesn't match");
|
||||
LogPrint (eLogError, "LeaseSet2: Blinded public key doesn't match");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ namespace data
|
|||
ReadFromBuffer (innerPlainText.data () + 1, lenInnerPlaintext - 1);
|
||||
}
|
||||
else
|
||||
LogPrint (eLogError, "LeaseSet2: unexpected LeaseSet type ", (int)innerPlainText[0], " inside encrypted LeaseSet");
|
||||
LogPrint (eLogError, "LeaseSet2: Unexpected LeaseSet type ", (int)innerPlainText[0], " inside encrypted LeaseSet");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -653,7 +653,7 @@ namespace data
|
|||
LogPrint (eLogError, "LeaseSet2: Can't calculate authCookie: psk_i is not provided");
|
||||
}
|
||||
else
|
||||
LogPrint (eLogError, "LeaseSet2: unknown client auth type ", (int)flag);
|
||||
LogPrint (eLogError, "LeaseSet2: Unknown client auth type ", (int)flag);
|
||||
}
|
||||
return offset - 1;
|
||||
}
|
||||
|
@ -768,7 +768,7 @@ namespace data
|
|||
size_t size = ident.GetFullLen ();
|
||||
if (size > sz)
|
||||
{
|
||||
LogPrint (eLogError, "LeaseSet: identity length ", size, " exceeds buffer size ", sz);
|
||||
LogPrint (eLogError, "LeaseSet: Identity length ", size, " exceeds buffer size ", sz);
|
||||
return false;
|
||||
}
|
||||
// encryption key
|
||||
|
@ -779,7 +779,7 @@ namespace data
|
|||
++size;
|
||||
if (!numLeases || numLeases > MAX_NUM_LEASES)
|
||||
{
|
||||
LogPrint (eLogError, "LeaseSet: incorrect number of leases", (int)numLeases);
|
||||
LogPrint (eLogError, "LeaseSet: Incorrect number of leases", (int)numLeases);
|
||||
return false;
|
||||
}
|
||||
const uint8_t * leases = ptr + size;
|
||||
|
@ -979,7 +979,7 @@ namespace data
|
|||
m_StoreHash = blindedKey->GetStoreHash ();
|
||||
}
|
||||
else
|
||||
LogPrint (eLogError, "LeaseSet2: couldn't extract inner layer");
|
||||
LogPrint (eLogError, "LeaseSet2: Couldn't extract inner layer");
|
||||
}
|
||||
|
||||
void LocalEncryptedLeaseSet2::CreateClientAuthData (const uint8_t * subcredential, int authType, std::shared_ptr<std::vector<AuthPublicKey> > authKeys, const uint8_t * authCookie, uint8_t * authData) const
|
||||
|
|
|
@ -129,10 +129,10 @@ namespace log {
|
|||
else if (level == "info") { m_MinLevel = eLogInfo; }
|
||||
else if (level == "debug") { m_MinLevel = eLogDebug; }
|
||||
else {
|
||||
LogPrint(eLogError, "Log: unknown loglevel: ", level);
|
||||
LogPrint(eLogError, "Log: Unknown loglevel: ", level);
|
||||
return;
|
||||
}
|
||||
LogPrint(eLogInfo, "Log: min messages level set to ", level);
|
||||
LogPrint(eLogInfo, "Log: Logging level set to ", level);
|
||||
}
|
||||
|
||||
const char * Log::TimeAsString(std::time_t t) {
|
||||
|
@ -212,7 +212,7 @@ namespace log {
|
|||
m_LogStream = os;
|
||||
return;
|
||||
}
|
||||
LogPrint(eLogError, "Log: can't open file ", path);
|
||||
LogPrint(eLogError, "Log: Can't open file ", path);
|
||||
}
|
||||
|
||||
void Log::SendTo (std::shared_ptr<std::ostream> os) {
|
||||
|
|
|
@ -377,7 +377,7 @@ namespace transport
|
|||
transports.PeerDisconnected (shared_from_this ());
|
||||
m_Server.RemoveNTCP2Session (shared_from_this ());
|
||||
m_SendQueue.clear ();
|
||||
LogPrint (eLogDebug, "NTCP2: session terminated");
|
||||
LogPrint (eLogDebug, "NTCP2: Session terminated");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -435,7 +435,7 @@ namespace transport
|
|||
(void) bytes_transferred;
|
||||
if (ecode)
|
||||
{
|
||||
LogPrint (eLogWarning, "NTCP2: couldn't send SessionRequest message: ", ecode.message ());
|
||||
LogPrint (eLogWarning, "NTCP2: Couldn't send SessionRequest message: ", ecode.message ());
|
||||
Terminate ();
|
||||
}
|
||||
else
|
||||
|
@ -566,7 +566,7 @@ namespace transport
|
|||
(void) bytes_transferred;
|
||||
if (ecode)
|
||||
{
|
||||
LogPrint (eLogWarning, "NTCP2: couldn't send SessionConfirmed message: ", ecode.message ());
|
||||
LogPrint (eLogWarning, "NTCP2: Couldn't send SessionConfirmed message: ", ecode.message ());
|
||||
Terminate ();
|
||||
}
|
||||
else
|
||||
|
@ -593,7 +593,7 @@ namespace transport
|
|||
(void) bytes_transferred;
|
||||
if (ecode)
|
||||
{
|
||||
LogPrint (eLogWarning, "NTCP2: couldn't send SessionCreated message: ", ecode.message ());
|
||||
LogPrint (eLogWarning, "NTCP2: Couldn't send SessionCreated message: ", ecode.message ());
|
||||
Terminate ();
|
||||
}
|
||||
else
|
||||
|
@ -636,7 +636,7 @@ namespace transport
|
|||
// process RI
|
||||
if (buf[0] != eNTCP2BlkRouterInfo)
|
||||
{
|
||||
LogPrint (eLogWarning, "NTCP2: unexpected block ", (int)buf[0], " in SessionConfirmed");
|
||||
LogPrint (eLogWarning, "NTCP2: Unexpected block ", (int)buf[0], " in SessionConfirmed");
|
||||
Terminate ();
|
||||
return;
|
||||
}
|
||||
|
@ -741,7 +741,7 @@ namespace transport
|
|||
if (ecode)
|
||||
{
|
||||
if (ecode != boost::asio::error::operation_aborted)
|
||||
LogPrint (eLogWarning, "NTCP2: receive length read error: ", ecode.message ());
|
||||
LogPrint (eLogWarning, "NTCP2: Receive length read error: ", ecode.message ());
|
||||
Terminate ();
|
||||
}
|
||||
else
|
||||
|
@ -756,7 +756,7 @@ namespace transport
|
|||
#endif
|
||||
// m_NextReceivedLen comes from the network in BigEndian
|
||||
m_NextReceivedLen = be16toh (m_NextReceivedLen) ^ le16toh (m_ReceiveIV.key);
|
||||
LogPrint (eLogDebug, "NTCP2: received length ", m_NextReceivedLen);
|
||||
LogPrint (eLogDebug, "NTCP2: Received length ", m_NextReceivedLen);
|
||||
if (m_NextReceivedLen >= 16)
|
||||
{
|
||||
if (m_NextReceivedBuffer) delete[] m_NextReceivedBuffer;
|
||||
|
@ -774,7 +774,7 @@ namespace transport
|
|||
}
|
||||
else
|
||||
{
|
||||
LogPrint (eLogError, "NTCP2: received length ", m_NextReceivedLen, " is too short");
|
||||
LogPrint (eLogError, "NTCP2: Received length ", m_NextReceivedLen, " is too short");
|
||||
Terminate ();
|
||||
}
|
||||
}
|
||||
|
@ -796,7 +796,7 @@ namespace transport
|
|||
if (ecode)
|
||||
{
|
||||
if (ecode != boost::asio::error::operation_aborted)
|
||||
LogPrint (eLogWarning, "NTCP2: receive read error: ", ecode.message ());
|
||||
LogPrint (eLogWarning, "NTCP2: Receive read error: ", ecode.message ());
|
||||
Terminate ();
|
||||
}
|
||||
else
|
||||
|
@ -808,7 +808,7 @@ namespace transport
|
|||
CreateNonce (m_ReceiveSequenceNumber, nonce); m_ReceiveSequenceNumber++;
|
||||
if (i2p::crypto::AEADChaCha20Poly1305 (m_NextReceivedBuffer, m_NextReceivedLen-16, nullptr, 0, m_ReceiveKey, nonce, m_NextReceivedBuffer, m_NextReceivedLen, false))
|
||||
{
|
||||
LogPrint (eLogDebug, "NTCP2: received message decrypted");
|
||||
LogPrint (eLogDebug, "NTCP2: Received message decrypted");
|
||||
ProcessNextFrame (m_NextReceivedBuffer, m_NextReceivedLen-16);
|
||||
delete[] m_NextReceivedBuffer; m_NextReceivedBuffer = nullptr; // we don't need received buffer anymore
|
||||
ReceiveLength ();
|
||||
|
@ -869,14 +869,14 @@ namespace transport
|
|||
case eNTCP2BlkTermination:
|
||||
if (size >= 9)
|
||||
{
|
||||
LogPrint (eLogDebug, "NTCP2: termination. reason=", (int)(frame[offset + 8]));
|
||||
LogPrint (eLogDebug, "NTCP2: Termination. reason=", (int)(frame[offset + 8]));
|
||||
Terminate ();
|
||||
}
|
||||
else
|
||||
LogPrint (eLogWarning, "NTCP2: Unexpected termination block size ", size);
|
||||
break;
|
||||
case eNTCP2BlkPadding:
|
||||
LogPrint (eLogDebug, "NTCP2: padding");
|
||||
LogPrint (eLogDebug, "NTCP2: Padding");
|
||||
break;
|
||||
default:
|
||||
LogPrint (eLogWarning, "NTCP2: Unknown block type ", (int)blk);
|
||||
|
@ -898,7 +898,7 @@ namespace transport
|
|||
#endif
|
||||
// length must be in BigEndian
|
||||
htobe16buf (lengthBuf, frameLen ^ le16toh (m_SendIV.key));
|
||||
LogPrint (eLogDebug, "NTCP2: sent length ", frameLen);
|
||||
LogPrint (eLogDebug, "NTCP2: Sent length ", frameLen);
|
||||
}
|
||||
|
||||
void NTCP2Session::SendI2NPMsgs (std::vector<std::shared_ptr<I2NPMessage> >& msgs)
|
||||
|
@ -1126,7 +1126,7 @@ namespace transport
|
|||
SendQueue ();
|
||||
else if (m_SendQueue.size () > NTCP2_MAX_OUTGOING_QUEUE_SIZE)
|
||||
{
|
||||
LogPrint (eLogWarning, "NTCP2: outgoing messages queue size to ",
|
||||
LogPrint (eLogWarning, "NTCP2: Outgoing messages queue size to ",
|
||||
GetIdentHashBase64(), " exceeds ", NTCP2_MAX_OUTGOING_QUEUE_SIZE);
|
||||
Terminate ();
|
||||
}
|
||||
|
@ -1232,7 +1232,7 @@ namespace transport
|
|||
}
|
||||
catch ( std::exception & ex )
|
||||
{
|
||||
LogPrint(eLogError, "NTCP2: failed to bind to v6 port ", address->port, ": ", ex.what());
|
||||
LogPrint(eLogError, "NTCP2: Failed to bind to v6 port ", address->port, ": ", ex.what());
|
||||
ThrowFatal ("Unable to start IPv6 NTCP2 transport at port ", address->port, ": ", ex.what ());
|
||||
continue;
|
||||
}
|
||||
|
@ -1273,7 +1273,7 @@ namespace transport
|
|||
auto it = m_NTCP2Sessions.find (ident);
|
||||
if (it != m_NTCP2Sessions.end ())
|
||||
{
|
||||
LogPrint (eLogWarning, "NTCP2: session to ", ident.ToBase64 (), " already exists");
|
||||
LogPrint (eLogWarning, "NTCP2: Session to ", ident.ToBase64 (), " already exists");
|
||||
if (incoming)
|
||||
// replace by new session
|
||||
it->second->Terminate ();
|
||||
|
@ -1342,7 +1342,7 @@ namespace transport
|
|||
boost::system::error_code ec;
|
||||
conn->GetSocket ().bind (*localAddress, ec);
|
||||
if (ec)
|
||||
LogPrint (eLogError, "NTCP2: can't bind to ", localAddress->address ().to_string (), ": ", ec.message ());
|
||||
LogPrint (eLogError, "NTCP2: Can't bind to ", localAddress->address ().to_string (), ": ", ec.message ());
|
||||
}
|
||||
conn->GetSocket ().async_connect (conn->GetRemoteEndpoint (), std::bind (&NTCP2Server::HandleConnect, this, std::placeholders::_1, conn, timer));
|
||||
}
|
||||
|
@ -1509,7 +1509,7 @@ namespace transport
|
|||
{
|
||||
if (ecode)
|
||||
{
|
||||
LogPrint(eLogWarning, "NTCP2: failed to connect to proxy ", ecode.message());
|
||||
LogPrint(eLogWarning, "NTCP2: Failed to connect to proxy ", ecode.message());
|
||||
timer->cancel();
|
||||
conn->Terminate();
|
||||
return;
|
||||
|
@ -1526,7 +1526,7 @@ namespace transport
|
|||
(void) transferred;
|
||||
if(ec)
|
||||
{
|
||||
LogPrint(eLogWarning, "NTCP2: socks5 write error ", ec.message());
|
||||
LogPrint(eLogWarning, "NTCP2: SOCKS5 write error ", ec.message());
|
||||
}
|
||||
});
|
||||
auto readbuff = std::make_shared<std::vector<uint8_t> >(2);
|
||||
|
@ -1535,7 +1535,7 @@ namespace transport
|
|||
{
|
||||
if(ec)
|
||||
{
|
||||
LogPrint(eLogError, "NTCP2: socks5 read error ", ec.message());
|
||||
LogPrint(eLogError, "NTCP2: SOCKS5 read error ", ec.message());
|
||||
timer->cancel();
|
||||
conn->Terminate();
|
||||
return;
|
||||
|
@ -1549,14 +1549,14 @@ namespace transport
|
|||
}
|
||||
else if ((*readbuff)[1] == 0xff)
|
||||
{
|
||||
LogPrint(eLogError, "NTCP2: socks5 proxy rejected authentication");
|
||||
LogPrint(eLogError, "NTCP2: SOCKS5 proxy rejected authentication");
|
||||
timer->cancel();
|
||||
conn->Terminate();
|
||||
return;
|
||||
}
|
||||
LogPrint(eLogError, "NTCP2:", (int)(*readbuff)[1]);
|
||||
}
|
||||
LogPrint(eLogError, "NTCP2: socks5 server gave invalid response");
|
||||
LogPrint(eLogError, "NTCP2: SOCKS5 server gave invalid response");
|
||||
timer->cancel();
|
||||
conn->Terminate();
|
||||
});
|
||||
|
@ -1584,7 +1584,7 @@ namespace transport
|
|||
{
|
||||
(void) transferred;
|
||||
if(ec)
|
||||
LogPrint(eLogError, "NTCP2: http proxy write error ", ec.message());
|
||||
LogPrint(eLogError, "NTCP2: HTTP proxy write error ", ec.message());
|
||||
});
|
||||
|
||||
boost::asio::streambuf * readbuff = new boost::asio::streambuf;
|
||||
|
@ -1593,7 +1593,7 @@ namespace transport
|
|||
{
|
||||
if(ec)
|
||||
{
|
||||
LogPrint(eLogError, "NTCP2: http proxy read error ", ec.message());
|
||||
LogPrint(eLogError, "NTCP2: HTTP proxy read error ", ec.message());
|
||||
timer->cancel();
|
||||
conn->Terminate();
|
||||
}
|
||||
|
@ -1611,10 +1611,10 @@ namespace transport
|
|||
return;
|
||||
}
|
||||
else
|
||||
LogPrint(eLogError, "NTCP2: http proxy rejected request ", res.code);
|
||||
LogPrint(eLogError, "NTCP2: HTTP proxy rejected request ", res.code);
|
||||
}
|
||||
else
|
||||
LogPrint(eLogError, "NTCP2: http proxy gave malformed response");
|
||||
LogPrint(eLogError, "NTCP2: HTTP proxy gave malformed response");
|
||||
timer->cancel();
|
||||
conn->Terminate();
|
||||
delete readbuff;
|
||||
|
@ -1623,7 +1623,7 @@ namespace transport
|
|||
break;
|
||||
}
|
||||
default:
|
||||
LogPrint(eLogError, "NTCP2: unknown proxy type, invalid state");
|
||||
LogPrint(eLogError, "NTCP2: Unknown proxy type, invalid state");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1664,7 +1664,7 @@ namespace transport
|
|||
{
|
||||
if(ec)
|
||||
{
|
||||
LogPrint(eLogError, "NTCP2: failed to write handshake to socks proxy ", ec.message());
|
||||
LogPrint(eLogError, "NTCP2: Failed to write handshake to socks proxy ", ec.message());
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
@ -1674,7 +1674,7 @@ namespace transport
|
|||
{
|
||||
if(e)
|
||||
{
|
||||
LogPrint(eLogError, "NTCP2: socks proxy read error ", e.message());
|
||||
LogPrint(eLogError, "NTCP2: SOCKS proxy read error ", e.message());
|
||||
}
|
||||
else if(transferred == sz)
|
||||
{
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace data
|
|||
int numMsgs = 0;
|
||||
while (msg)
|
||||
{
|
||||
LogPrint(eLogDebug, "NetDb: got request with type ", (int) msg->GetTypeID ());
|
||||
LogPrint(eLogDebug, "NetDb: Got request with type ", (int) msg->GetTypeID ());
|
||||
switch (msg->GetTypeID ())
|
||||
{
|
||||
case eI2NPDatabaseStore:
|
||||
|
@ -138,7 +138,7 @@ namespace data
|
|||
HandleNTCP2RouterInfoMsg (msg);
|
||||
break;
|
||||
default: // WTF?
|
||||
LogPrint (eLogError, "NetDb: unexpected message type ", (int) msg->GetTypeID ());
|
||||
LogPrint (eLogError, "NetDb: Unexpected message type ", (int) msg->GetTypeID ());
|
||||
//i2p::HandleI2NPMessage (msg);
|
||||
}
|
||||
if (numMsgs > 100) break;
|
||||
|
@ -216,7 +216,7 @@ namespace data
|
|||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
LogPrint (eLogError, "NetDb: runtime exception: ", ex.what ());
|
||||
LogPrint (eLogError, "NetDb: Runtime exception: ", ex.what ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ namespace data
|
|||
updated = true;
|
||||
}
|
||||
else
|
||||
LogPrint (eLogError, "NetDb: new LeaseSet validation failed: ", ident.ToBase32());
|
||||
LogPrint (eLogError, "NetDb: New LeaseSet validation failed: ", ident.ToBase32());
|
||||
}
|
||||
return updated;
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ namespace data
|
|||
}
|
||||
}
|
||||
else
|
||||
LogPrint (eLogError, "NetDb: new LeaseSet2 validation failed: ", ident.ToBase32());
|
||||
LogPrint (eLogError, "NetDb: New LeaseSet2 validation failed: ", ident.ToBase32());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -430,7 +430,7 @@ namespace data
|
|||
int riLen = ri->GetBufferLen();
|
||||
if(!i2p::data::netdb.AddRouterInfo(riData, riLen)) {
|
||||
// bad router info
|
||||
LogPrint(eLogError, "NetDb: bad router info");
|
||||
LogPrint(eLogError, "NetDb: Bad RouterInfo");
|
||||
return;
|
||||
}
|
||||
m_FloodfillBootstrap = ri;
|
||||
|
@ -445,7 +445,7 @@ namespace data
|
|||
|
||||
void NetDb::ReseedFromFloodfill(const RouterInfo & ri, int numRouters, int numFloodfills)
|
||||
{
|
||||
LogPrint(eLogInfo, "NetDB: reseeding from floodfill ", ri.GetIdentHashBase64());
|
||||
LogPrint(eLogInfo, "NetDB: Reseeding from floodfill ", ri.GetIdentHashBase64());
|
||||
std::vector<std::shared_ptr<i2p::I2NPMessage> > requests;
|
||||
|
||||
i2p::data::IdentHash ourIdent = i2p::context.GetIdentHash();
|
||||
|
@ -631,10 +631,10 @@ namespace data
|
|||
} // m_RouterInfos iteration
|
||||
|
||||
if (updatedCount > 0)
|
||||
LogPrint (eLogInfo, "NetDb: saved ", updatedCount, " new/updated routers");
|
||||
LogPrint (eLogInfo, "NetDb: Saved ", updatedCount, " new/updated routers");
|
||||
if (deletedCount > 0)
|
||||
{
|
||||
LogPrint (eLogInfo, "NetDb: deleting ", deletedCount, " unreachable routers");
|
||||
LogPrint (eLogInfo, "NetDb: Deleting ", deletedCount, " unreachable routers");
|
||||
// clean up RouterInfos table
|
||||
{
|
||||
std::unique_lock<std::mutex> l(m_RouterInfosMutex);
|
||||
|
@ -666,7 +666,7 @@ namespace data
|
|||
auto dest = m_Requests.CreateRequest (destination, false, requestComplete); // non-exploratory
|
||||
if (!dest)
|
||||
{
|
||||
LogPrint (eLogWarning, "NetDb: destination ", destination.ToBase64(), " is requested already");
|
||||
LogPrint (eLogWarning, "NetDb: Destination ", destination.ToBase64(), " has already been requested");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -705,10 +705,10 @@ namespace data
|
|||
auto dest = m_Requests.CreateRequest (destination, exploritory, requestComplete); // non-exploratory
|
||||
if (!dest)
|
||||
{
|
||||
LogPrint (eLogWarning, "NetDb: destination ", destination.ToBase64(), " is requested already");
|
||||
LogPrint (eLogWarning, "NetDb: Destination ", destination.ToBase64(), " is requested already");
|
||||
return;
|
||||
}
|
||||
LogPrint(eLogInfo, "NetDb: destination ", destination.ToBase64(), " being requested directly from ", from.ToBase64());
|
||||
LogPrint(eLogInfo, "NetDb: Destination ", destination.ToBase64(), " being requested directly from ", from.ToBase64());
|
||||
// direct
|
||||
transports.SendMessage (from, dest->CreateRequestMessage (nullptr, nullptr));
|
||||
}
|
||||
|
@ -732,7 +732,7 @@ namespace data
|
|||
IdentHash ident (buf + DATABASE_STORE_KEY_OFFSET);
|
||||
if (ident.IsZero ())
|
||||
{
|
||||
LogPrint (eLogDebug, "NetDb: database store with zero ident, dropped");
|
||||
LogPrint (eLogDebug, "NetDb: Database store with zero ident, dropped");
|
||||
return;
|
||||
}
|
||||
uint32_t replyToken = bufbe32toh (buf + DATABASE_STORE_REPLY_TOKEN_OFFSET);
|
||||
|
@ -751,14 +751,14 @@ namespace data
|
|||
if (outbound)
|
||||
outbound->SendTunnelDataMsg (buf + offset, tunnelID, deliveryStatus);
|
||||
else
|
||||
LogPrint (eLogWarning, "NetDb: no outbound tunnels for DatabaseStore reply found");
|
||||
LogPrint (eLogWarning, "NetDb: No outbound tunnels for DatabaseStore reply found");
|
||||
}
|
||||
offset += 32;
|
||||
}
|
||||
// we must send reply back before this check
|
||||
if (ident == i2p::context.GetIdentHash ())
|
||||
{
|
||||
LogPrint (eLogDebug, "NetDb: database store with own RouterInfo received, dropped");
|
||||
LogPrint (eLogDebug, "NetDb: Database store with own RouterInfo received, dropped");
|
||||
return;
|
||||
}
|
||||
size_t payloadOffset = offset;
|
||||
|
@ -771,24 +771,24 @@ namespace data
|
|||
{
|
||||
if (storeType == NETDB_STORE_TYPE_LEASESET) // 1
|
||||
{
|
||||
LogPrint (eLogDebug, "NetDb: store request: LeaseSet for ", ident.ToBase32());
|
||||
LogPrint (eLogDebug, "NetDb: Store request: LeaseSet for ", ident.ToBase32());
|
||||
updated = AddLeaseSet (ident, buf + offset, len - offset);
|
||||
}
|
||||
else // all others are considered as LeaseSet2
|
||||
{
|
||||
LogPrint (eLogDebug, "NetDb: store request: LeaseSet2 of type ", storeType, " for ", ident.ToBase32());
|
||||
LogPrint (eLogDebug, "NetDb: Store request: LeaseSet2 of type ", storeType, " for ", ident.ToBase32());
|
||||
updated = AddLeaseSet2 (ident, buf + offset, len - offset, storeType);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // RouterInfo
|
||||
{
|
||||
LogPrint (eLogDebug, "NetDb: store request: RouterInfo");
|
||||
LogPrint (eLogDebug, "NetDb: Store request: RouterInfo");
|
||||
size_t size = bufbe16toh (buf + offset);
|
||||
offset += 2;
|
||||
if (size > MAX_RI_BUFFER_SIZE || size > len - offset)
|
||||
{
|
||||
LogPrint (eLogError, "NetDb: invalid RouterInfo length ", (int)size);
|
||||
LogPrint (eLogError, "NetDb: Invalid RouterInfo length ", (int)size);
|
||||
return;
|
||||
}
|
||||
uint8_t uncompressed[MAX_RI_BUFFER_SIZE];
|
||||
|
@ -797,7 +797,7 @@ namespace data
|
|||
updated = AddRouterInfo (ident, uncompressed, uncompressedSize);
|
||||
else
|
||||
{
|
||||
LogPrint (eLogInfo, "NetDb: decompression failed ", uncompressedSize);
|
||||
LogPrint (eLogInfo, "NetDb: Decompression failed ", uncompressedSize);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -872,7 +872,7 @@ namespace data
|
|||
m_Requests.RequestComplete (ident, nullptr);
|
||||
}
|
||||
else if(!m_FloodfillBootstrap)
|
||||
LogPrint (eLogWarning, "NetDb: requested destination for ", key, " not found");
|
||||
LogPrint (eLogWarning, "NetDb: Requested destination for ", key, " not found");
|
||||
|
||||
// try responses
|
||||
for (int i = 0; i < num; i++)
|
||||
|
@ -887,7 +887,7 @@ namespace data
|
|||
if (!r || i2p::util::GetMillisecondsSinceEpoch () > r->GetTimestamp () + 3600*1000LL)
|
||||
{
|
||||
// router with ident not found or too old (1 hour)
|
||||
LogPrint (eLogDebug, "NetDb: found new/outdated router. Requesting RouterInfo ...");
|
||||
LogPrint (eLogDebug, "NetDb: Found new/outdated router. Requesting RouterInfo ...");
|
||||
if(m_FloodfillBootstrap)
|
||||
RequestDestinationFrom(router, m_FloodfillBootstrap->GetIdentHash(), true);
|
||||
else
|
||||
|
@ -928,14 +928,14 @@ namespace data
|
|||
excluded += 2;
|
||||
if (numExcluded > 512)
|
||||
{
|
||||
LogPrint (eLogWarning, "NetDb: number of excluded peers", numExcluded, " exceeds 512");
|
||||
LogPrint (eLogWarning, "NetDb: Number of excluded peers", numExcluded, " exceeds 512");
|
||||
return;
|
||||
}
|
||||
|
||||
std::shared_ptr<I2NPMessage> replyMsg;
|
||||
if (lookupType == DATABASE_LOOKUP_TYPE_EXPLORATORY_LOOKUP)
|
||||
{
|
||||
LogPrint (eLogInfo, "NetDb: exploratory close to ", key, " ", numExcluded, " excluded");
|
||||
LogPrint (eLogInfo, "NetDb: Exploratory close to ", key, " ", numExcluded, " excluded");
|
||||
std::set<IdentHash> excludedRouters;
|
||||
for (int i = 0; i < numExcluded; i++)
|
||||
{
|
||||
|
@ -962,7 +962,7 @@ namespace data
|
|||
auto router = FindRouter (ident);
|
||||
if (router)
|
||||
{
|
||||
LogPrint (eLogDebug, "NetDb: requested RouterInfo ", key, " found");
|
||||
LogPrint (eLogDebug, "NetDb: Requested RouterInfo ", key, " found");
|
||||
router->LoadBuffer ();
|
||||
if (router->GetBuffer ())
|
||||
replyMsg = CreateDatabaseStoreMsg (router);
|
||||
|
@ -976,11 +976,11 @@ namespace data
|
|||
if (!leaseSet)
|
||||
{
|
||||
// no lease set found
|
||||
LogPrint(eLogDebug, "NetDb: requested LeaseSet not found for ", ident.ToBase32());
|
||||
LogPrint(eLogDebug, "NetDb: Requested LeaseSet not found for ", ident.ToBase32());
|
||||
}
|
||||
else if (!leaseSet->IsExpired ()) // we don't send back our LeaseSets
|
||||
{
|
||||
LogPrint (eLogDebug, "NetDb: requested LeaseSet ", key, " found");
|
||||
LogPrint (eLogDebug, "NetDb: Requested LeaseSet ", key, " found");
|
||||
replyMsg = CreateDatabaseStoreMsg (ident, leaseSet);
|
||||
}
|
||||
}
|
||||
|
@ -1062,14 +1062,14 @@ namespace data
|
|||
|
||||
uint8_t randomHash[32];
|
||||
std::vector<i2p::tunnel::TunnelMessageBlock> msgs;
|
||||
LogPrint (eLogInfo, "NetDb: exploring new ", numDestinations, " routers ...");
|
||||
LogPrint (eLogInfo, "NetDb: Exploring new ", numDestinations, " routers ...");
|
||||
for (int i = 0; i < numDestinations; i++)
|
||||
{
|
||||
RAND_bytes (randomHash, 32);
|
||||
auto dest = m_Requests.CreateRequest (randomHash, true); // exploratory
|
||||
if (!dest)
|
||||
{
|
||||
LogPrint (eLogWarning, "NetDb: exploratory destination is requested already");
|
||||
LogPrint (eLogWarning, "NetDb: Exploratory destination is requested already");
|
||||
return;
|
||||
}
|
||||
auto floodfill = GetClosestFloodfill (randomHash, dest->GetExcludedPeers ());
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace data
|
|||
|
||||
if (!i2p::fs::Exists(path))
|
||||
{
|
||||
LogPrint(eLogWarning, "Profiling: no profile yet for ", ident);
|
||||
LogPrint(eLogWarning, "Profiling: No profile yet for ", ident);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ namespace data
|
|||
continue;
|
||||
}
|
||||
if (((now - st.st_mtime) / 3600) >= PEER_PROFILE_EXPIRATION_TIMEOUT) {
|
||||
LogPrint(eLogDebug, "Profiling: removing expired peer profile: ", path);
|
||||
LogPrint(eLogDebug, "Profiling: Removing expired peer profile: ", path);
|
||||
i2p::fs::Remove(path);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,19 +60,19 @@ namespace data
|
|||
num = ProcessSU3File (su3FileName.c_str ());
|
||||
}
|
||||
if (num == 0)
|
||||
LogPrint (eLogWarning, "Reseed: failed to reseed from ", su3FileName);
|
||||
LogPrint (eLogWarning, "Reseed: Failed to reseed from ", su3FileName);
|
||||
}
|
||||
else if (zipFileName.length() > 0) // bootstrap from ZIP file
|
||||
{
|
||||
int num = ProcessZIPFile (zipFileName.c_str ());
|
||||
if (num == 0)
|
||||
LogPrint (eLogWarning, "Reseed: failed to reseed from ", zipFileName);
|
||||
LogPrint (eLogWarning, "Reseed: Failed to reseed from ", zipFileName);
|
||||
}
|
||||
else // bootstrap from reseed servers
|
||||
{
|
||||
int num = ReseedFromServers ();
|
||||
if (num == 0)
|
||||
LogPrint (eLogWarning, "Reseed: failed to reseed from servers");
|
||||
LogPrint (eLogWarning, "Reseed: Failed to reseed from servers");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ namespace data
|
|||
if (num > 0) return num; // success
|
||||
reseedRetries++;
|
||||
}
|
||||
LogPrint (eLogWarning, "Reseed: failed to reseed from servers after 10 attempts");
|
||||
LogPrint (eLogWarning, "Reseed: Failed to reseed from servers after 10 attempts");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -509,7 +509,7 @@ namespace data
|
|||
|
||||
for (const std::string & file : files) {
|
||||
if (file.compare(file.size() - 4, 4, ".crt") != 0) {
|
||||
LogPrint(eLogWarning, "Reseed: ignoring file ", file);
|
||||
LogPrint(eLogWarning, "Reseed: Ignoring file ", file);
|
||||
continue;
|
||||
}
|
||||
LoadCertificate (file);
|
||||
|
@ -533,17 +533,17 @@ namespace data
|
|||
}
|
||||
// check for valid proxy url schema
|
||||
if (proxyUrl.schema != "http" && proxyUrl.schema != "socks") {
|
||||
LogPrint(eLogError, "Reseed: bad proxy url: ", proxy);
|
||||
LogPrint(eLogError, "Reseed: Bad proxy URL: ", proxy);
|
||||
return "";
|
||||
}
|
||||
} else {
|
||||
LogPrint(eLogError, "Reseed: bad proxy url: ", proxy);
|
||||
LogPrint(eLogError, "Reseed: Bad proxy URL: ", proxy);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
i2p::http::URL url;
|
||||
if (!url.parse(address)) {
|
||||
LogPrint(eLogError, "Reseed: failed to parse url: ", address);
|
||||
LogPrint(eLogError, "Reseed: Failed to parse URL: ", address);
|
||||
return "";
|
||||
}
|
||||
url.schema = "https";
|
||||
|
@ -743,22 +743,22 @@ namespace data
|
|||
i2p::http::HTTPRes res;
|
||||
int len = res.parse(data);
|
||||
if (len <= 0) {
|
||||
LogPrint(eLogWarning, "Reseed: incomplete/broken response from ", uri);
|
||||
LogPrint(eLogWarning, "Reseed: Incomplete/broken response from ", uri);
|
||||
return "";
|
||||
}
|
||||
if (res.code != 200) {
|
||||
LogPrint(eLogError, "Reseed: failed to reseed from ", uri, ", http code ", res.code);
|
||||
LogPrint(eLogError, "Reseed: Failed to reseed from ", uri, ", http code ", res.code);
|
||||
return "";
|
||||
}
|
||||
data.erase(0, len); /* drop http headers from response */
|
||||
LogPrint(eLogDebug, "Reseed: got ", data.length(), " bytes of data from ", uri);
|
||||
LogPrint(eLogDebug, "Reseed: Got ", data.length(), " bytes of data from ", uri);
|
||||
if (res.is_chunked()) {
|
||||
std::stringstream in(data), out;
|
||||
if (!i2p::http::MergeChunkedResponse(in, out)) {
|
||||
LogPrint(eLogWarning, "Reseed: failed to merge chunked response from ", uri);
|
||||
LogPrint(eLogWarning, "Reseed: Failed to merge chunked response from ", uri);
|
||||
return "";
|
||||
}
|
||||
LogPrint(eLogDebug, "Reseed: got ", data.length(), "(", out.tellg(), ") bytes of data from ", uri);
|
||||
LogPrint(eLogDebug, "Reseed: Got ", data.length(), "(", out.tellg(), ") bytes of data from ", uri);
|
||||
data = out.str();
|
||||
}
|
||||
return data;
|
||||
|
@ -769,7 +769,7 @@ namespace data
|
|||
i2p::http::URL url;
|
||||
if (!url.parse(address))
|
||||
{
|
||||
LogPrint(eLogError, "Reseed: failed to parse url: ", address);
|
||||
LogPrint(eLogError, "Reseed: Failed to parse URL: ", address);
|
||||
return "";
|
||||
}
|
||||
url.schema = "http";
|
||||
|
|
|
@ -809,7 +809,7 @@ namespace data
|
|||
}
|
||||
else
|
||||
{
|
||||
LogPrint (eLogWarning, "RouterInfo: string length ", (int)l, " exceeds buffer size ", len);
|
||||
LogPrint (eLogWarning, "RouterInfo: String length ", (int)l, " exceeds buffer size ", len);
|
||||
s.seekg (l, std::ios::cur); // skip
|
||||
str[0] = 0;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace transport
|
|||
}
|
||||
catch ( std::exception & ex )
|
||||
{
|
||||
LogPrint (eLogError, "SSU: failed to bind to v4 port ", m_Endpoint.port(), ": ", ex.what());
|
||||
LogPrint (eLogError, "SSU: Failed to bind to v4 port ", m_Endpoint.port(), ": ", ex.what());
|
||||
ThrowFatal ("Unable to start IPv4 SSU transport at port ", m_Endpoint.port(), ": ", ex.what ());
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ namespace transport
|
|||
}
|
||||
catch ( std::exception & ex )
|
||||
{
|
||||
LogPrint (eLogError, "SSU: failed to bind to v6 port ", m_EndpointV6.port(), ": ", ex.what());
|
||||
LogPrint (eLogError, "SSU: Failed to bind to v6 port ", m_EndpointV6.port(), ": ", ex.what());
|
||||
ThrowFatal ("Unable to start IPv6 SSU transport at port ", m_Endpoint.port(), ": ", ex.what ());
|
||||
}
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ namespace transport
|
|||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
LogPrint (eLogError, "SSU: server runtime exception: ", ex.what ());
|
||||
LogPrint (eLogError, "SSU: Server runtime exception: ", ex.what ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ namespace transport
|
|||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
LogPrint (eLogError, "SSU: receivers runtime exception: ", ex.what ());
|
||||
LogPrint (eLogError, "SSU: Receivers runtime exception: ", ex.what ());
|
||||
if (m_IsRunning)
|
||||
{
|
||||
// restart socket
|
||||
|
@ -249,7 +249,7 @@ namespace transport
|
|||
|
||||
if (ec)
|
||||
{
|
||||
LogPrint (eLogError, "SSU: send exception: ", ec.message (), " while trying to send data to ", to.address (), ":", to.port (), " (length: ", len, ")");
|
||||
LogPrint (eLogError, "SSU: Send exception: ", ec.message (), " while trying to send data to ", to.address (), ":", to.port (), " (length: ", len, ")");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ namespace transport
|
|||
delete packet;
|
||||
if (ecode != boost::asio::error::operation_aborted)
|
||||
{
|
||||
LogPrint (eLogError, "SSU: receive error: code ", ecode.value(), ": ", ecode.message ());
|
||||
LogPrint (eLogError, "SSU: Receive error: code ", ecode.value(), ": ", ecode.message ());
|
||||
m_Socket.close ();
|
||||
OpenSocket ();
|
||||
Receive ();
|
||||
|
@ -409,7 +409,7 @@ namespace transport
|
|||
session = std::make_shared<SSUSession> (*this, packet->from);
|
||||
session->WaitForConnect ();
|
||||
(*sessions)[packet->from] = session;
|
||||
LogPrint (eLogDebug, "SSU: new session from ", packet->from.address ().to_string (), ":", packet->from.port (), " created");
|
||||
LogPrint (eLogDebug, "SSU: New session from ", packet->from.address ().to_string (), ":", packet->from.port (), " created");
|
||||
}
|
||||
}
|
||||
if (session)
|
||||
|
@ -548,7 +548,7 @@ namespace transport
|
|||
}
|
||||
if (!introducer)
|
||||
{
|
||||
LogPrint (eLogWarning, "SSU: Can't connect to unreachable router and no compatibe non-expired introducers presented");
|
||||
LogPrint (eLogWarning, "SSU: Can't connect to unreachable router, no compatible introducers");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -797,7 +797,7 @@ namespace transport
|
|||
if (sessions.empty () && !introducers.empty ())
|
||||
{
|
||||
// bump creation time for previous introducers if no new sessions found
|
||||
LogPrint (eLogDebug, "SSU: no new introducers found. Trying to reuse existing");
|
||||
LogPrint (eLogDebug, "SSU: No new introducers found. Trying to reuse existing");
|
||||
for (const auto& it : introducers)
|
||||
{
|
||||
auto session = FindSession (it);
|
||||
|
@ -847,7 +847,7 @@ namespace transport
|
|||
}
|
||||
else
|
||||
{
|
||||
LogPrint (eLogDebug, "SSU: can't find more introducers");
|
||||
LogPrint (eLogDebug, "SSU: Can't find more introducers");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -945,10 +945,10 @@ namespace transport
|
|||
{
|
||||
auto session = it.second;
|
||||
if (it.first != session->GetRemoteEndpoint ())
|
||||
LogPrint (eLogWarning, "SSU: remote endpoint ", session->GetRemoteEndpoint (), " doesn't match key ", it.first, " adjusted");
|
||||
LogPrint (eLogWarning, "SSU: Remote endpoint ", session->GetRemoteEndpoint (), " doesn't match key ", it.first, " adjusted");
|
||||
m_Service.post ([session]
|
||||
{
|
||||
LogPrint (eLogWarning, "SSU: no activity with ", session->GetRemoteEndpoint (), " for ", session->GetTerminationTimeout (), " seconds");
|
||||
LogPrint (eLogWarning, "SSU: No activity with ", session->GetRemoteEndpoint (), " for ", session->GetTerminationTimeout (), " seconds");
|
||||
session->Failed ();
|
||||
});
|
||||
}
|
||||
|
@ -973,10 +973,10 @@ namespace transport
|
|||
{
|
||||
auto session = it.second;
|
||||
if (it.first != session->GetRemoteEndpoint ())
|
||||
LogPrint (eLogWarning, "SSU: remote endpoint ", session->GetRemoteEndpoint (), " doesn't match key ", it.first);
|
||||
LogPrint (eLogWarning, "SSU: Remote endpoint ", session->GetRemoteEndpoint (), " doesn't match key ", it.first);
|
||||
m_Service.post ([session]
|
||||
{
|
||||
LogPrint (eLogWarning, "SSU: no activity with ", session->GetRemoteEndpoint (), " for ", session->GetTerminationTimeout (), " seconds");
|
||||
LogPrint (eLogWarning, "SSU: No activity with ", session->GetRemoteEndpoint (), " for ", session->GetTerminationTimeout (), " seconds");
|
||||
session->Failed ();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -177,12 +177,12 @@ namespace transport
|
|||
ProcessSessionConfirmed (buf, len); // buf with header
|
||||
break;
|
||||
case PAYLOAD_TYPE_PEER_TEST:
|
||||
LogPrint (eLogDebug, "SSU: peer test received");
|
||||
LogPrint (eLogDebug, "SSU: Peer test received");
|
||||
ProcessPeerTest (buf + headerSize, len - headerSize, senderEndpoint);
|
||||
break;
|
||||
case PAYLOAD_TYPE_SESSION_DESTROYED:
|
||||
{
|
||||
LogPrint (eLogDebug, "SSU: session destroy received");
|
||||
LogPrint (eLogDebug, "SSU: Session destroy received");
|
||||
m_Server.DeleteSession (shared_from_this ());
|
||||
break;
|
||||
}
|
||||
|
@ -192,11 +192,11 @@ namespace transport
|
|||
m_Server.DeleteSession (shared_from_this ());
|
||||
break;
|
||||
case PAYLOAD_TYPE_RELAY_REQUEST:
|
||||
LogPrint (eLogDebug, "SSU: relay request received");
|
||||
LogPrint (eLogDebug, "SSU: Relay request received");
|
||||
ProcessRelayRequest (buf + headerSize, len - headerSize, senderEndpoint);
|
||||
break;
|
||||
case PAYLOAD_TYPE_RELAY_INTRO:
|
||||
LogPrint (eLogDebug, "SSU: relay intro received");
|
||||
LogPrint (eLogDebug, "SSU: Relay intro received");
|
||||
ProcessRelayIntro (buf + headerSize, len - headerSize);
|
||||
break;
|
||||
default:
|
||||
|
@ -206,7 +206,7 @@ namespace transport
|
|||
|
||||
void SSUSession::ProcessSessionRequest (const uint8_t * buf, size_t len)
|
||||
{
|
||||
LogPrint (eLogDebug, "SSU message: session request");
|
||||
LogPrint (eLogDebug, "SSU: Session request");
|
||||
bool sendRelayTag = true;
|
||||
auto headerSize = sizeof (SSUHeader);
|
||||
if (((SSUHeader *)buf)->IsExtendedOptions ())
|
||||
|
@ -222,7 +222,7 @@ namespace transport
|
|||
}
|
||||
if (headerSize >= len)
|
||||
{
|
||||
LogPrint (eLogError, "Session request header size ", headerSize, " exceeds packet length ", len);
|
||||
LogPrint (eLogError, "SSU: Session request header size ", headerSize, " exceeds packet length ", len);
|
||||
return;
|
||||
}
|
||||
if (!m_DHKeysPair)
|
||||
|
@ -243,13 +243,13 @@ namespace transport
|
|||
return;
|
||||
}
|
||||
|
||||
LogPrint (eLogDebug, "SSU message: session created");
|
||||
LogPrint (eLogDebug, "SSU: Session created");
|
||||
m_ConnectTimer.cancel (); // connect timer
|
||||
SignedData s; // x,y, our IP, our port, remote IP, remote port, relayTag, signed on time
|
||||
auto headerSize = GetSSUHeaderSize (buf);
|
||||
if (headerSize >= len)
|
||||
{
|
||||
LogPrint (eLogError, "Session created header size ", headerSize, " exceeds packet length ", len);
|
||||
LogPrint (eLogError, "SSU: Session created header size ", headerSize, " exceeds packet length ", len);
|
||||
return;
|
||||
}
|
||||
uint8_t * payload = buf + headerSize;
|
||||
|
@ -280,7 +280,7 @@ namespace transport
|
|||
uint32_t signedOnTime = bufbe32toh(payload);
|
||||
if (signedOnTime < ts - SSU_CLOCK_SKEW || signedOnTime > ts + SSU_CLOCK_SKEW)
|
||||
{
|
||||
LogPrint (eLogError, "SSU: clock skew detected ", (int)ts - signedOnTime, ". Check your clock");
|
||||
LogPrint (eLogError, "SSU: Clock skew detected ", (int)ts - signedOnTime, ". Check your clock!");
|
||||
i2p::context.SetError (eRouterErrorClockSkew);
|
||||
}
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ namespace transport
|
|||
}
|
||||
else
|
||||
{
|
||||
LogPrint (eLogError, "SSU: message 'created' signature verification failed");
|
||||
LogPrint (eLogError, "SSU: Message 'created' signature verification failed");
|
||||
Failed ();
|
||||
}
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ namespace transport
|
|||
uint32_t signedOnTime = bufbe32toh(payload);
|
||||
if (signedOnTime < ts - SSU_CLOCK_SKEW || signedOnTime > ts + SSU_CLOCK_SKEW)
|
||||
{
|
||||
LogPrint (eLogError, "SSU message 'confirmed' time difference ", (int)ts - signedOnTime, " exceeds clock skew");
|
||||
LogPrint (eLogError, "SSU: 'Confirmed' time difference ", (int)ts - signedOnTime, " exceeds clock skew");
|
||||
Failed ();
|
||||
return;
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ namespace transport
|
|||
}
|
||||
else
|
||||
{
|
||||
LogPrint (eLogError, "SSU message 'confirmed' signature verification failed");
|
||||
LogPrint (eLogError, "SSU: 'Confirmed' signature verification failed");
|
||||
Failed ();
|
||||
}
|
||||
}
|
||||
|
@ -647,7 +647,7 @@ namespace transport
|
|||
FillHeaderAndEncrypt (PAYLOAD_TYPE_RELAY_RESPONSE, buf, isV4 ? 64 : 80, introKey, iv, introKey);
|
||||
m_Server.Send (buf, isV4 ? 64 : 80, from);
|
||||
}
|
||||
LogPrint (eLogDebug, "SSU: relay response sent");
|
||||
LogPrint (eLogDebug, "SSU: Relay response sent");
|
||||
}
|
||||
|
||||
void SSUSession::SendRelayIntro (std::shared_ptr<SSUSession> session, const boost::asio::ip::udp::endpoint& from)
|
||||
|
@ -683,12 +683,12 @@ namespace transport
|
|||
RAND_bytes (iv, 16); // random iv
|
||||
FillHeaderAndEncrypt (PAYLOAD_TYPE_RELAY_INTRO, buf, isV4 ? 48 : 64, session->m_SessionKey, iv, session->m_MacKey);
|
||||
m_Server.Send (buf, isV4 ? 48 : 64, session->m_RemoteEndpoint);
|
||||
LogPrint (eLogDebug, "SSU: relay intro sent");
|
||||
LogPrint (eLogDebug, "SSU: Relay intro sent");
|
||||
}
|
||||
|
||||
void SSUSession::ProcessRelayResponse (const uint8_t * buf, size_t len)
|
||||
{
|
||||
LogPrint (eLogDebug, "SSU message: Relay response received");
|
||||
LogPrint (eLogDebug, "SSU: Relay response received");
|
||||
boost::asio::ip::address remoteIP;
|
||||
uint16_t remotePort = 0;
|
||||
auto remoteSize = ExtractIPAddressAndPort (buf, len, remoteIP, remotePort);
|
||||
|
@ -872,7 +872,7 @@ namespace transport
|
|||
if (!IsOutgoing ()) // incoming session
|
||||
ScheduleConnectTimer ();
|
||||
else
|
||||
LogPrint (eLogError, "SSU: wait for connect for outgoing session");
|
||||
LogPrint (eLogError, "SSU: Wait for connect for outgoing session");
|
||||
}
|
||||
|
||||
void SSUSession::ScheduleConnectTimer ()
|
||||
|
@ -888,7 +888,7 @@ namespace transport
|
|||
if (!ecode)
|
||||
{
|
||||
// timeout expired
|
||||
LogPrint (eLogWarning, "SSU: session with ", m_RemoteEndpoint, " was not established after ", SSU_CONNECT_TIMEOUT, " seconds");
|
||||
LogPrint (eLogWarning, "SSU: Session with ", m_RemoteEndpoint, " was not established after ", SSU_CONNECT_TIMEOUT, " seconds");
|
||||
Failed ();
|
||||
}
|
||||
}
|
||||
|
@ -1023,7 +1023,7 @@ namespace transport
|
|||
{
|
||||
if (m_Server.GetPeerTestSession (nonce) == shared_from_this ()) // Alice-Bob
|
||||
{
|
||||
LogPrint (eLogDebug, "SSU: peer test from Bob. We are Alice");
|
||||
LogPrint (eLogDebug, "SSU: Peer test from Bob. We are Alice");
|
||||
if (IsV6 ())
|
||||
{
|
||||
if (i2p::context.GetStatusV6 () == eRouterStatusTesting)
|
||||
|
@ -1040,9 +1040,9 @@ namespace transport
|
|||
}
|
||||
else
|
||||
{
|
||||
LogPrint (eLogDebug, "SSU: first peer test from Charlie. We are Alice");
|
||||
LogPrint (eLogDebug, "SSU: First peer test from Charlie. We are Alice");
|
||||
if (m_State == eSessionStateEstablished)
|
||||
LogPrint (eLogWarning, "SSU: first peer test from Charlie through established session. We are Alice");
|
||||
LogPrint (eLogWarning, "SSU: First peer test from Charlie through established session. We are Alice");
|
||||
if (IsV6 ())
|
||||
i2p::context.SetStatusV6 (eRouterStatusOK);
|
||||
else
|
||||
|
@ -1055,11 +1055,11 @@ namespace transport
|
|||
case ePeerTestParticipantAlice2:
|
||||
{
|
||||
if (m_Server.GetPeerTestSession (nonce) == shared_from_this ()) // Alice-Bob
|
||||
LogPrint (eLogDebug, "SSU: peer test from Bob. We are Alice");
|
||||
LogPrint (eLogDebug, "SSU: Peer test from Bob. We are Alice");
|
||||
else
|
||||
{
|
||||
// peer test successive
|
||||
LogPrint (eLogDebug, "SSU: second peer test from Charlie. We are Alice");
|
||||
LogPrint (eLogDebug, "SSU: Second peer test from Charlie. We are Alice");
|
||||
if (IsV6 ())
|
||||
i2p::context.SetStatusV6 (eRouterStatusOK);
|
||||
else
|
||||
|
@ -1070,7 +1070,7 @@ namespace transport
|
|||
}
|
||||
case ePeerTestParticipantBob:
|
||||
{
|
||||
LogPrint (eLogDebug, "SSU: peer test from Charlie. We are Bob");
|
||||
LogPrint (eLogDebug, "SSU: Peer test from Charlie. We are Bob");
|
||||
auto session = m_Server.GetPeerTestSession (nonce); // session with Alice from PeerTest
|
||||
if (session && session->m_State == eSessionStateEstablished)
|
||||
{
|
||||
|
@ -1082,7 +1082,7 @@ namespace transport
|
|||
}
|
||||
case ePeerTestParticipantCharlie:
|
||||
{
|
||||
LogPrint (eLogDebug, "SSU: peer test from Alice. We are Charlie");
|
||||
LogPrint (eLogDebug, "SSU: Peer test from Alice. We are Charlie");
|
||||
SendPeerTest (nonce, senderEndpoint.address (), senderEndpoint.port (), introKey); // to Alice with her actual address
|
||||
m_Server.RemovePeerTest (nonce); // nonce has been used
|
||||
break;
|
||||
|
@ -1095,7 +1095,7 @@ namespace transport
|
|||
// new test
|
||||
if (port)
|
||||
{
|
||||
LogPrint (eLogDebug, "SSU: peer test from Bob. We are Charlie");
|
||||
LogPrint (eLogDebug, "SSU: Peer test from Bob. We are Charlie");
|
||||
Send (PAYLOAD_TYPE_PEER_TEST, buf, len); // back to Bob
|
||||
if (!addr.is_unspecified () && !i2p::util::net::IsInReservedRange(addr))
|
||||
{
|
||||
|
@ -1105,7 +1105,7 @@ namespace transport
|
|||
}
|
||||
else
|
||||
{
|
||||
LogPrint (eLogDebug, "SSU: peer test from Alice. We are Bob");
|
||||
LogPrint (eLogDebug, "SSU: Peer test from Alice. We are Bob");
|
||||
auto session = senderEndpoint.address ().is_v4 () ? m_Server.GetRandomEstablishedV4Session (shared_from_this ()) : m_Server.GetRandomEstablishedV6Session (shared_from_this ()); // Charlie
|
||||
if (session)
|
||||
{
|
||||
|
@ -1115,7 +1115,7 @@ namespace transport
|
|||
}
|
||||
}
|
||||
else
|
||||
LogPrint (eLogError, "SSU: unexpected peer test");
|
||||
LogPrint (eLogError, "SSU: Unexpected peer test");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1188,7 +1188,7 @@ namespace transport
|
|||
void SSUSession::SendPeerTest ()
|
||||
{
|
||||
// we are Alice
|
||||
LogPrint (eLogDebug, "SSU: sending peer test");
|
||||
LogPrint (eLogDebug, "SSU: Initiating peer test");
|
||||
auto address = IsV6 () ? i2p::context.GetRouterInfo ().GetSSUV6Address () : i2p::context.GetRouterInfo ().GetSSUAddress (true);
|
||||
if (!address)
|
||||
{
|
||||
|
@ -1233,9 +1233,9 @@ namespace transport
|
|||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
LogPrint (eLogWarning, "SSU: exception while sending session destoroyed: ", ex.what ());
|
||||
LogPrint (eLogWarning, "SSU: Exception while sending session destroyed: ", ex.what ());
|
||||
}
|
||||
LogPrint (eLogDebug, "SSU: session destroyed sent");
|
||||
LogPrint (eLogDebug, "SSU: Session destroyed sent");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1247,7 +1247,7 @@ namespace transport
|
|||
if (paddingSize > 0) msgSize += (16 - paddingSize);
|
||||
if (msgSize > SSU_MTU_V4)
|
||||
{
|
||||
LogPrint (eLogWarning, "SSU: payload size ", msgSize, " exceeds MTU");
|
||||
LogPrint (eLogWarning, "SSU: Payload size ", msgSize, " exceeds MTU");
|
||||
return;
|
||||
}
|
||||
memcpy (buf + sizeof (SSUHeader), payload, len);
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace transport
|
|||
m_Queue.push (pair);
|
||||
}
|
||||
else
|
||||
LogPrint(eLogError, "Transports: return null DHKeys");
|
||||
LogPrint(eLogError, "Transports: Return null DHKeys");
|
||||
}
|
||||
|
||||
Transports transports;
|
||||
|
@ -192,10 +192,10 @@ namespace transport
|
|||
i2p::context.SetStatus (eRouterStatusProxy);
|
||||
}
|
||||
else
|
||||
LogPrint(eLogError, "Transports: unsupported NTCP2 proxy URL ", ntcp2proxy);
|
||||
LogPrint(eLogError, "Transports: Unsupported NTCP2 proxy URL ", ntcp2proxy);
|
||||
}
|
||||
else
|
||||
LogPrint(eLogError, "Transports: invalid NTCP2 proxy url ", ntcp2proxy);
|
||||
LogPrint(eLogError, "Transports: invalid NTCP2 proxy URL ", ntcp2proxy);
|
||||
}
|
||||
else
|
||||
m_NTCP2Server = new NTCP2Server ();
|
||||
|
@ -335,7 +335,7 @@ namespace transport
|
|||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
LogPrint (eLogError, "Transports: runtime exception: ", ex.what ());
|
||||
LogPrint (eLogError, "Transports: Runtime exception: ", ex.what ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ namespace transport
|
|||
}
|
||||
else
|
||||
{
|
||||
LogPrint (eLogWarning, "Transports: delayed messages queue size to ",
|
||||
LogPrint (eLogWarning, "Transports: Delayed messages queue size to ",
|
||||
ident.ToBase64 (), " exceeds ", MAX_NUM_DELAYED_MESSAGES);
|
||||
std::unique_lock<std::mutex> l(m_PeersMutex);
|
||||
m_Peers.erase (it);
|
||||
|
@ -526,7 +526,7 @@ namespace transport
|
|||
}
|
||||
}
|
||||
}
|
||||
LogPrint (eLogInfo, "Transports: No compatble NTCP2 or SSU addresses available");
|
||||
LogPrint (eLogInfo, "Transports: No compatible NTCP2 or SSU addresses available");
|
||||
i2p::data::netdb.SetUnreachable (ident, true); // we are here because all connection attempts failed
|
||||
peer.Done ();
|
||||
std::unique_lock<std::mutex> l(m_PeersMutex);
|
||||
|
@ -680,7 +680,7 @@ namespace transport
|
|||
{
|
||||
if(RoutesRestricted() && ! IsRestrictedPeer(ident)) {
|
||||
// not trusted
|
||||
LogPrint(eLogWarning, "Transports: closing untrusted inbound connection from ", ident.ToBase64());
|
||||
LogPrint(eLogWarning, "Transports: Closing untrusted inbound connection from ", ident.ToBase64());
|
||||
session->Done();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace tunnel
|
|||
SHA256(fragment, TUNNEL_DATA_MSG_SIZE -(fragment - msg->GetPayload ()) + 16, hash); // payload + iv
|
||||
if (memcmp (hash, decrypted, 4))
|
||||
{
|
||||
LogPrint (eLogError, "TunnelMessage: checksum verification failed");
|
||||
LogPrint (eLogError, "TunnelMessage: Checksum verification failed");
|
||||
return;
|
||||
}
|
||||
// process fragments
|
||||
|
@ -118,7 +118,7 @@ namespace tunnel
|
|||
// check message size
|
||||
if (msg->len > msg->maxLen)
|
||||
{
|
||||
LogPrint (eLogError, "TunnelMessage: fragment is too long ", (int)size);
|
||||
LogPrint (eLogError, "TunnelMessage: Fragment is too long ", (int)size);
|
||||
m_CurrentMsgID = 0; m_CurrentMessage.data = nullptr;
|
||||
return;
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ namespace tunnel
|
|||
}
|
||||
}
|
||||
else
|
||||
LogPrint (eLogError, "TunnelMessage: zero not found");
|
||||
LogPrint (eLogError, "TunnelMessage: Zero not found");
|
||||
}
|
||||
|
||||
void TunnelEndpoint::HandleFollowOnFragment (uint32_t msgID, bool isLastFragment,
|
||||
|
@ -264,7 +264,7 @@ namespace tunnel
|
|||
std::unique_ptr<Fragment> f(new Fragment (isLastFragment, i2p::util::GetMillisecondsSinceEpoch (), size));
|
||||
memcpy (f->data.data (), fragment, size);
|
||||
if (!m_OutOfSequenceFragments.emplace ((uint64_t)msgID << 32 | fragmentNum, std::move (f)).second)
|
||||
LogPrint (eLogInfo, "TunnelMessage: duplicate out-of-sequence fragment ", fragmentNum, " of message ", msgID);
|
||||
LogPrint (eLogInfo, "TunnelMessage: Duplicate out-of-sequence fragment ", fragmentNum, " of message ", msgID);
|
||||
}
|
||||
|
||||
void TunnelEndpoint::HandleOutOfSequenceFragments (uint32_t msgID, TunnelMessageBlockEx& msg)
|
||||
|
@ -318,11 +318,11 @@ namespace tunnel
|
|||
{
|
||||
if (!m_IsInbound && msg.data->IsExpired ())
|
||||
{
|
||||
LogPrint (eLogInfo, "TunnelMessage: message expired");
|
||||
LogPrint (eLogInfo, "TunnelMessage: Message expired");
|
||||
return;
|
||||
}
|
||||
uint8_t typeID = msg.data->GetTypeID ();
|
||||
LogPrint (eLogDebug, "TunnelMessage: handle fragment of ", msg.data->GetLength (), " bytes, msg type ", (int)typeID);
|
||||
LogPrint (eLogDebug, "TunnelMessage: Handle fragment of ", msg.data->GetLength (), " bytes, msg type ", (int)typeID);
|
||||
// catch RI or reply with new list of routers
|
||||
if ((IsRouterInfoMsg (msg.data) || typeID == eI2NPDatabaseSearchReply) &&
|
||||
!m_IsInbound && msg.deliveryType != eDeliveryTypeLocal)
|
||||
|
|
|
@ -304,7 +304,7 @@ namespace tunnel
|
|||
|
||||
for (auto& it: tests)
|
||||
{
|
||||
LogPrint (eLogWarning, "Tunnels: test of tunnel ", it.first, " failed");
|
||||
LogPrint (eLogWarning, "Tunnels: Test of tunnel ", it.first, " failed");
|
||||
// if test failed again with another tunnel we consider it failed
|
||||
if (it.second.first)
|
||||
{
|
||||
|
@ -380,7 +380,7 @@ namespace tunnel
|
|||
if (m_LocalDestination)
|
||||
m_LocalDestination->ProcessGarlicMessage (msg);
|
||||
else
|
||||
LogPrint (eLogWarning, "Tunnels: local destination doesn't exist, dropped");
|
||||
LogPrint (eLogWarning, "Tunnels: Local destination doesn't exist, dropped");
|
||||
}
|
||||
|
||||
void TunnelPool::ProcessDeliveryStatus (std::shared_ptr<I2NPMessage> msg)
|
||||
|
@ -405,7 +405,7 @@ namespace tunnel
|
|||
if (found)
|
||||
{
|
||||
uint64_t dlt = i2p::util::GetMillisecondsSinceEpoch () - timestamp;
|
||||
LogPrint (eLogDebug, "Tunnels: test of ", msgID, " successful. ", dlt, " milliseconds");
|
||||
LogPrint (eLogDebug, "Tunnels: Test of ", msgID, " successful. ", dlt, " milliseconds");
|
||||
uint64_t latency = dlt / 2;
|
||||
// restore from test failed state if any
|
||||
if (test.first)
|
||||
|
@ -478,7 +478,7 @@ namespace tunnel
|
|||
auto hop = nextHop (prevHop, inbound);
|
||||
if (!hop && !i) // if no suitable peer found for first hop, try already connected
|
||||
{
|
||||
LogPrint (eLogInfo, "Tunnels: Can't select first hop for a tunnel. Trying already connected");
|
||||
LogPrint (eLogInfo, "Tunnels: No suitable peer found for first hop, trying existing connections");
|
||||
hop = i2p::transport::transports.GetRandomPeer ();
|
||||
if (hop && !hop->IsECIES ()) hop = nullptr;
|
||||
}
|
||||
|
|
|
@ -60,22 +60,22 @@ namespace api
|
|||
else
|
||||
i2p::log::Logger().SendTo (i2p::fs::DataDirPath (i2p::fs::GetAppName () + ".log"));
|
||||
i2p::log::Logger().Start ();
|
||||
LogPrint(eLogInfo, "API: starting NetDB");
|
||||
LogPrint(eLogInfo, "API: Starting NetDB");
|
||||
i2p::data::netdb.Start();
|
||||
LogPrint(eLogInfo, "API: starting Transports");
|
||||
LogPrint(eLogInfo, "API: Starting Transports");
|
||||
i2p::transport::transports.Start();
|
||||
LogPrint(eLogInfo, "API: starting Tunnels");
|
||||
LogPrint(eLogInfo, "API: Starting Tunnels");
|
||||
i2p::tunnel::tunnels.Start();
|
||||
}
|
||||
|
||||
void StopI2P ()
|
||||
{
|
||||
LogPrint(eLogInfo, "API: shutting down");
|
||||
LogPrint(eLogInfo, "API: stopping Tunnels");
|
||||
LogPrint(eLogInfo, "API: Shutting down");
|
||||
LogPrint(eLogInfo, "API: Stopping Tunnels");
|
||||
i2p::tunnel::tunnels.Stop();
|
||||
LogPrint(eLogInfo, "API: stopping Transports");
|
||||
LogPrint(eLogInfo, "API: Stopping Transports");
|
||||
i2p::transport::transports.Stop();
|
||||
LogPrint(eLogInfo, "API: stopping NetDB");
|
||||
LogPrint(eLogInfo, "API: Stopping NetDB");
|
||||
i2p::data::netdb.Stop();
|
||||
i2p::log::Logger().Stop ();
|
||||
}
|
||||
|
|
|
@ -377,7 +377,7 @@ namespace net
|
|||
const boost::asio::ip::address GetInterfaceAddress (const std::string & ifname, bool ipv6)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
LogPrint(eLogError, "NetIface: cannot get address by interface name, not implemented on WIN32");
|
||||
LogPrint(eLogError, "NetIface: Cannot get address by interface name, not implemented on WIN32");
|
||||
if(ipv6)
|
||||
return boost::asio::ip::address::from_string("::1");
|
||||
else
|
||||
|
@ -413,10 +413,10 @@ namespace net
|
|||
if(ipv6)
|
||||
{
|
||||
fallback = "::1";
|
||||
LogPrint(eLogWarning, "NetIface: cannot find ipv6 address for interface ", ifname);
|
||||
LogPrint(eLogWarning, "NetIface: Can't find ipv6 address for interface ", ifname);
|
||||
} else {
|
||||
fallback = "127.0.0.1";
|
||||
LogPrint(eLogWarning, "NetIface: cannot find ipv4 address for interface ", ifname);
|
||||
LogPrint(eLogWarning, "NetIface: Can't find ipv4 address for interface ", ifname);
|
||||
}
|
||||
return boost::asio::ip::address::from_string(fallback);
|
||||
#endif
|
||||
|
@ -479,7 +479,7 @@ namespace net
|
|||
}
|
||||
pCurrAddresses = pCurrAddresses->Next;
|
||||
}
|
||||
LogPrint(eLogWarning, "NetIface: interface with yggdrasil network address not found");
|
||||
LogPrint(eLogWarning, "NetIface: Interface with yggdrasil network address not found");
|
||||
FREE(pAddresses);
|
||||
return boost::asio::ip::address_v6 ();
|
||||
#else
|
||||
|
@ -504,7 +504,7 @@ namespace net
|
|||
cur = cur->ifa_next;
|
||||
}
|
||||
}
|
||||
LogPrint(eLogWarning, "NetIface: interface with yggdrasil network address not found");
|
||||
LogPrint(eLogWarning, "NetIface: Interface with yggdrasil network address not found");
|
||||
if(addrs) freeifaddrs(addrs);
|
||||
return boost::asio::ip::address_v6 ();
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue