mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
Compare commits
5 Commits
13d9c6530c
...
ff8d462b62
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff8d462b62 | ||
|
|
9432202fad | ||
|
|
bf050ac465 | ||
|
|
81dae1997d | ||
|
|
17399da399 |
13
contrib/docker/docker-compose.yml
Normal file
13
contrib/docker/docker-compose.yml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
services:
|
||||||
|
i2pd:
|
||||||
|
container_name: i2pd2
|
||||||
|
image: purplei2p/i2pd
|
||||||
|
#optional
|
||||||
|
entrypoint: ["./entrypoint.sh", "--loglevel error"]
|
||||||
|
ports:
|
||||||
|
- 127.0.0.1:7656:7656
|
||||||
|
- 127.0.0.1:7070:7070
|
||||||
|
- 127.0.0.1:4444:4444
|
||||||
|
volumes:
|
||||||
|
- /path/to/i2pd/data:/home/i2pd/data # make sure data directory and it's contents are owned by 100:65533
|
||||||
|
- /path/to/i2pd/i2pd_certificates:/i2pd_certificates # make sure i2pd_certificates is owned by root:root and 755 permissions on the directory
|
||||||
@@ -12,7 +12,6 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <charconv>
|
#include <charconv>
|
||||||
#include <boost/lexical_cast.hpp>
|
|
||||||
#include <boost/algorithm/string.hpp> // for boost::to_lower
|
#include <boost/algorithm/string.hpp> // for boost::to_lower
|
||||||
#ifndef __cpp_lib_atomic_shared_ptr
|
#ifndef __cpp_lib_atomic_shared_ptr
|
||||||
#include <boost/atomic.hpp>
|
#include <boost/atomic.hpp>
|
||||||
@@ -263,27 +262,17 @@ namespace data
|
|||||||
}
|
}
|
||||||
else if (key == "port")
|
else if (key == "port")
|
||||||
{
|
{
|
||||||
try
|
auto res = std::from_chars(value.data(), value.data() + value.size(), address->port);
|
||||||
{
|
if (res.ec != std::errc())
|
||||||
address->port = boost::lexical_cast<int>(value);
|
LogPrint (eLogWarning, "RouterInfo: 'port' conversion error: ", std::make_error_code (res.ec).message ());
|
||||||
}
|
|
||||||
catch (std::exception& ex)
|
|
||||||
{
|
|
||||||
LogPrint (eLogWarning, "RouterInfo: 'port' exception ", ex.what ());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (key == "mtu")
|
else if (key == "mtu")
|
||||||
{
|
{
|
||||||
if (address->ssu)
|
if (address->ssu)
|
||||||
{
|
{
|
||||||
try
|
auto res = std::from_chars(value.data(), value.data() + value.size(), address->ssu->mtu);
|
||||||
{
|
if (res.ec != std::errc())
|
||||||
address->ssu->mtu = boost::lexical_cast<int>(value);
|
LogPrint (eLogWarning, "RouterInfo: 'mtu' conversion error: ", std::make_error_code (res.ec).message ());
|
||||||
}
|
|
||||||
catch (std::exception& ex)
|
|
||||||
{
|
|
||||||
LogPrint (eLogWarning, "RouterInfo: 'mtu' exception ", ex.what ());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
LogPrint (eLogWarning, "RouterInfo: Unexpected field 'mtu' for NTCP2");
|
LogPrint (eLogWarning, "RouterInfo: Unexpected field 'mtu' for NTCP2");
|
||||||
@@ -349,27 +338,17 @@ namespace data
|
|||||||
auto key1 = key.substr(0, key.length () - 1);
|
auto key1 = key.substr(0, key.length () - 1);
|
||||||
if (key1 == "itag")
|
if (key1 == "itag")
|
||||||
{
|
{
|
||||||
try
|
auto res = std::from_chars(value.data(), value.data() + value.size(), introducer.iTag);
|
||||||
{
|
if (res.ec != std::errc())
|
||||||
introducer.iTag = boost::lexical_cast<uint32_t>(value);
|
LogPrint (eLogWarning, "RouterInfo: 'itag' conversion error: ", std::make_error_code (res.ec).message ());
|
||||||
}
|
|
||||||
catch (std::exception& ex)
|
|
||||||
{
|
|
||||||
LogPrint (eLogWarning, "RouterInfo: 'itag' exception ", ex.what ());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (key1 == "ih")
|
else if (key1 == "ih")
|
||||||
Base64ToByteStream (value.data (), value.length (), introducer.iH, 32);
|
Base64ToByteStream (value.data (), value.length (), introducer.iH, 32);
|
||||||
else if (key1 == "iexp")
|
else if (key1 == "iexp")
|
||||||
{
|
{
|
||||||
try
|
auto res = std::from_chars(value.data(), value.data() + value.size(), introducer.iExp);
|
||||||
{
|
if (res.ec != std::errc())
|
||||||
introducer.iExp = boost::lexical_cast<uint32_t>(value);
|
LogPrint (eLogWarning, "RouterInfo: 'iexp' conversion error: ", std::make_error_code (res.ec).message ());
|
||||||
}
|
|
||||||
catch (std::exception& ex)
|
|
||||||
{
|
|
||||||
LogPrint (eLogWarning, "RouterInfo: 'iexp' exception ", ex.what ());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1402,9 +1381,9 @@ namespace data
|
|||||||
if (!introducer.iTag) continue;
|
if (!introducer.iTag) continue;
|
||||||
if (introducer.iExp) // expiration is specified
|
if (introducer.iExp) // expiration is specified
|
||||||
{
|
{
|
||||||
WriteString ("iexp" + boost::lexical_cast<std::string>(i), properties);
|
WriteString ("iexp" + std::to_string(i), properties);
|
||||||
properties << '=';
|
properties << '=';
|
||||||
WriteString (boost::lexical_cast<std::string>(introducer.iExp), properties);
|
WriteString (std::to_string(introducer.iExp), properties);
|
||||||
properties << ';';
|
properties << ';';
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
@@ -1413,7 +1392,7 @@ namespace data
|
|||||||
for (const auto& introducer: address.ssu->introducers)
|
for (const auto& introducer: address.ssu->introducers)
|
||||||
{
|
{
|
||||||
if (!introducer.iTag) continue;
|
if (!introducer.iTag) continue;
|
||||||
WriteString ("ih" + boost::lexical_cast<std::string>(i), properties);
|
WriteString ("ih" + std::to_string(i), properties);
|
||||||
properties << '=';
|
properties << '=';
|
||||||
char value[64];
|
char value[64];
|
||||||
size_t l = ByteStreamToBase64 (introducer.iH, 32, value, 64);
|
size_t l = ByteStreamToBase64 (introducer.iH, 32, value, 64);
|
||||||
@@ -1426,9 +1405,9 @@ namespace data
|
|||||||
for (const auto& introducer: address.ssu->introducers)
|
for (const auto& introducer: address.ssu->introducers)
|
||||||
{
|
{
|
||||||
if (!introducer.iTag) continue;
|
if (!introducer.iTag) continue;
|
||||||
WriteString ("itag" + boost::lexical_cast<std::string>(i), properties);
|
WriteString ("itag" + std::to_string(i), properties);
|
||||||
properties << '=';
|
properties << '=';
|
||||||
WriteString (boost::lexical_cast<std::string>(introducer.iTag), properties);
|
WriteString (std::to_string(introducer.iTag), properties);
|
||||||
properties << ';';
|
properties << ';';
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -1442,7 +1421,7 @@ namespace data
|
|||||||
{
|
{
|
||||||
WriteString ("mtu", properties);
|
WriteString ("mtu", properties);
|
||||||
properties << '=';
|
properties << '=';
|
||||||
WriteString (boost::lexical_cast<std::string>(address.ssu->mtu), properties);
|
WriteString (std::to_string(address.ssu->mtu), properties);
|
||||||
properties << ';';
|
properties << ';';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1450,7 +1429,7 @@ namespace data
|
|||||||
{
|
{
|
||||||
WriteString ("port", properties);
|
WriteString ("port", properties);
|
||||||
properties << '=';
|
properties << '=';
|
||||||
WriteString (boost::lexical_cast<std::string>(address.port), properties);
|
WriteString (std::to_string(address.port), properties);
|
||||||
properties << ';';
|
properties << ';';
|
||||||
}
|
}
|
||||||
if (address.IsNTCP2 () || address.IsSSU2 ())
|
if (address.IsNTCP2 () || address.IsSSU2 ())
|
||||||
|
|||||||
@@ -2277,8 +2277,11 @@ namespace transport
|
|||||||
case 2: // Charlie from Bob
|
case 2: // Charlie from Bob
|
||||||
{
|
{
|
||||||
// sign with Charlie's key
|
// sign with Charlie's key
|
||||||
|
if (len < offset + 9) return;
|
||||||
uint8_t asz = buf[offset + 9];
|
uint8_t asz = buf[offset + 9];
|
||||||
std::vector<uint8_t> newSignedData (asz + 10 + i2p::context.GetIdentity ()->GetSignatureLen ());
|
size_t l = asz + 10 + i2p::context.GetIdentity ()->GetSignatureLen ();
|
||||||
|
if (len < offset + l) return;
|
||||||
|
std::vector<uint8_t> newSignedData (l);
|
||||||
memcpy (newSignedData.data (), buf + offset, asz + 10);
|
memcpy (newSignedData.data (), buf + offset, asz + 10);
|
||||||
SignedData<128> s;
|
SignedData<128> s;
|
||||||
s.Insert ((const uint8_t *)"PeerTestValidate", 16); // prologue
|
s.Insert ((const uint8_t *)"PeerTestValidate", 16); // prologue
|
||||||
@@ -2388,9 +2391,15 @@ namespace transport
|
|||||||
if (GetRouterStatus () == eRouterStatusUnknown)
|
if (GetRouterStatus () == eRouterStatusUnknown)
|
||||||
SetTestingState (true);
|
SetTestingState (true);
|
||||||
auto r = i2p::data::netdb.FindRouter (buf + 3); // find Charlie
|
auto r = i2p::data::netdb.FindRouter (buf + 3); // find Charlie
|
||||||
if (r)
|
if (r && len >= offset + 9)
|
||||||
{
|
{
|
||||||
uint8_t asz = buf[offset + 9];
|
uint8_t asz = buf[offset + 9];
|
||||||
|
if (len < offset + asz + 10 + r->GetIdentity ()->GetSignatureLen ())
|
||||||
|
{
|
||||||
|
LogPrint (eLogWarning, "Malformed PeerTest 4 len=", len);
|
||||||
|
session->Done ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
SignedData<128> s;
|
SignedData<128> s;
|
||||||
s.Insert ((const uint8_t *)"PeerTestValidate", 16); // prologue
|
s.Insert ((const uint8_t *)"PeerTestValidate", 16); // prologue
|
||||||
s.Insert (GetRemoteIdentity ()->GetIdentHash (), 32); // bhash
|
s.Insert (GetRemoteIdentity ()->GetIdentHash (), 32); // bhash
|
||||||
|
|||||||
@@ -613,10 +613,8 @@ namespace stream
|
|||||||
if (wasInitial)
|
if (wasInitial)
|
||||||
ScheduleResend ();
|
ScheduleResend ();
|
||||||
}
|
}
|
||||||
if (m_IsClientChoked && ackThrough > m_DropWindowDelaySequenceNumber)
|
if (m_IsClientChoked && ackThrough >= m_DropWindowDelaySequenceNumber)
|
||||||
{
|
|
||||||
m_IsClientChoked = false;
|
m_IsClientChoked = false;
|
||||||
}
|
|
||||||
if (m_IsWinDropped && ackThrough > m_DropWindowDelaySequenceNumber)
|
if (m_IsWinDropped && ackThrough > m_DropWindowDelaySequenceNumber)
|
||||||
{
|
{
|
||||||
m_IsFirstRttSample = true;
|
m_IsFirstRttSample = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user