mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-03 03:44:15 +00:00
NTCP2Mesh added
This commit is contained in:
parent
129b4a2135
commit
9e5935aea5
@ -655,7 +655,7 @@ namespace transport
|
|||||||
SendTerminationAndTerminate (eNTCP2Message3Error);
|
SendTerminationAndTerminate (eNTCP2Message3Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto addr = ri.GetNTCP2Address (false, false); // any NTCP2 address including v6
|
auto addr = ri.GetNTCP2Address (false); // any NTCP2 address
|
||||||
if (!addr)
|
if (!addr)
|
||||||
{
|
{
|
||||||
LogPrint (eLogError, "NTCP2: No NTCP2 address found in SessionConfirmed");
|
LogPrint (eLogError, "NTCP2: No NTCP2 address found in SessionConfirmed");
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include <boost/atomic.hpp>
|
#include <boost/atomic.hpp>
|
||||||
#endif
|
#endif
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
#include "util.h"
|
||||||
#include "Crypto.h"
|
#include "Crypto.h"
|
||||||
#include "Base.h"
|
#include "Base.h"
|
||||||
#include "Timestamp.h"
|
#include "Timestamp.h"
|
||||||
@ -298,8 +299,18 @@ namespace data
|
|||||||
}
|
}
|
||||||
if (address->transportStyle == eTransportNTCP)
|
if (address->transportStyle == eTransportNTCP)
|
||||||
{
|
{
|
||||||
if (isStaticKey && isHost)
|
if (isStaticKey)
|
||||||
supportedTransports |= address->host.is_v4 () ? eNTCP2V4 : eNTCP2V6;
|
{
|
||||||
|
if (isHost)
|
||||||
|
{
|
||||||
|
if (address->host.is_v6 ())
|
||||||
|
supportedTransports |= i2p::util::net::IsYggdrasilAddress (address->host) ? eNTCP2V6Mesh : eNTCP2V6;
|
||||||
|
else
|
||||||
|
supportedTransports |= eNTCP2V4;
|
||||||
|
}
|
||||||
|
else if (!address->ntcp2->isPublished)
|
||||||
|
supportedTransports |= eNTCP2V4; // most likely, since we don't have host
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (address->transportStyle == eTransportSSU)
|
else if (address->transportStyle == eTransportSSU)
|
||||||
{
|
{
|
||||||
@ -920,12 +931,12 @@ namespace data
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<const RouterInfo::Address> RouterInfo::GetNTCP2Address (bool publishedOnly, bool v4only) const
|
std::shared_ptr<const RouterInfo::Address> RouterInfo::GetNTCP2Address (bool publishedOnly) const
|
||||||
{
|
{
|
||||||
return GetAddress (
|
return GetAddress (
|
||||||
[publishedOnly, v4only](std::shared_ptr<const RouterInfo::Address> address)->bool
|
[publishedOnly](std::shared_ptr<const RouterInfo::Address> address)->bool
|
||||||
{
|
{
|
||||||
return address->IsNTCP2 () && (!publishedOnly || address->IsPublishedNTCP2 ()) && (!v4only || address->host.is_v4 ());
|
return address->IsNTCP2 () && (!publishedOnly || address->IsPublishedNTCP2 ());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,8 @@ namespace data
|
|||||||
eNTCP2V4 = 0x01,
|
eNTCP2V4 = 0x01,
|
||||||
eNTCP2V6 = 0x02,
|
eNTCP2V6 = 0x02,
|
||||||
eSSUV4 = 0x04,
|
eSSUV4 = 0x04,
|
||||||
eSSUV6 = 0x08
|
eSSUV6 = 0x08,
|
||||||
|
eNTCP2V6Mesh = 0x10
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Caps
|
enum Caps
|
||||||
@ -149,7 +150,7 @@ namespace data
|
|||||||
uint64_t GetTimestamp () const { return m_Timestamp; };
|
uint64_t GetTimestamp () const { return m_Timestamp; };
|
||||||
int GetVersion () const { return m_Version; };
|
int GetVersion () const { return m_Version; };
|
||||||
Addresses& GetAddresses () { return *m_Addresses; }; // should be called for local RI only, otherwise must return shared_ptr
|
Addresses& GetAddresses () { return *m_Addresses; }; // should be called for local RI only, otherwise must return shared_ptr
|
||||||
std::shared_ptr<const Address> GetNTCP2Address (bool publishedOnly, bool v4only = true) const;
|
std::shared_ptr<const Address> GetNTCP2Address (bool publishedOnly) const;
|
||||||
std::shared_ptr<const Address> GetPublishedNTCP2V4Address () const;
|
std::shared_ptr<const Address> GetPublishedNTCP2V4Address () const;
|
||||||
std::shared_ptr<const Address> GetPublishedNTCP2V6Address () const;
|
std::shared_ptr<const Address> GetPublishedNTCP2V6Address () const;
|
||||||
std::shared_ptr<const Address> GetSSUAddress (bool v4only = true) const;
|
std::shared_ptr<const Address> GetSSUAddress (bool v4only = true) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user