mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 13:27:17 +01:00
correct check of ipv4/ipv6 address
This commit is contained in:
parent
e412b17f70
commit
bce6685d0c
|
@ -484,7 +484,7 @@ namespace i2p
|
|||
addr->ssu->introducers.clear ();
|
||||
port = addr->port;
|
||||
}
|
||||
// unpiblish NTCP2 addreeses
|
||||
// unpublish NTCP2 addreeses
|
||||
bool ntcp2; i2p::config::GetOption("ntcp2.enabled", ntcp2);
|
||||
if (ntcp2)
|
||||
PublishNTCP2Address (port, false, v4, v6, false);
|
||||
|
@ -677,7 +677,7 @@ namespace i2p
|
|||
if (addr->IsPublishedNTCP2 ())
|
||||
{
|
||||
bool isYgg1 = i2p::util::net::IsYggdrasilAddress (addr->host);
|
||||
if (addr->host.is_v6 () && ((isYgg && isYgg1) || (!isYgg && !isYgg1)))
|
||||
if (addr->IsV6 () && ((isYgg && isYgg1) || (!isYgg && !isYgg1)))
|
||||
{
|
||||
if (addr->host != host)
|
||||
{
|
||||
|
|
|
@ -554,7 +554,7 @@ namespace data
|
|||
if (address.IsNTCP2 ())
|
||||
{
|
||||
WriteString ("NTCP2", s);
|
||||
if (address.IsPublishedNTCP2 () && !address.host.is_unspecified ())
|
||||
if (address.IsPublishedNTCP2 () && !address.host.is_unspecified () && address.port)
|
||||
isPublished = true;
|
||||
else
|
||||
{
|
||||
|
@ -998,9 +998,16 @@ namespace data
|
|||
for (auto it = m_Addresses->begin (); it != m_Addresses->end ();)
|
||||
{
|
||||
auto addr = *it;
|
||||
addr->caps &= ~AddressCaps::eV6;
|
||||
if (addr->host.is_v6 ())
|
||||
it = m_Addresses->erase (it);
|
||||
if (addr->IsV6 ())
|
||||
{
|
||||
if (addr->IsV4 ())
|
||||
{
|
||||
addr->caps &= ~AddressCaps::eV6;
|
||||
++it;
|
||||
}
|
||||
else
|
||||
it = m_Addresses->erase (it);
|
||||
}
|
||||
else
|
||||
++it;
|
||||
}
|
||||
|
@ -1015,9 +1022,16 @@ namespace data
|
|||
for (auto it = m_Addresses->begin (); it != m_Addresses->end ();)
|
||||
{
|
||||
auto addr = *it;
|
||||
addr->caps &= ~AddressCaps::eV4;
|
||||
if (addr->host.is_v4 ())
|
||||
it = m_Addresses->erase (it);
|
||||
if (addr->IsV4 ())
|
||||
{
|
||||
if (addr->IsV6 ())
|
||||
{
|
||||
addr->caps &= ~AddressCaps::eV4;
|
||||
++it;
|
||||
}
|
||||
else
|
||||
it = m_Addresses->erase (it);
|
||||
}
|
||||
else
|
||||
++it;
|
||||
}
|
||||
|
@ -1188,7 +1202,7 @@ namespace data
|
|||
for (auto& addr: *m_Addresses)
|
||||
{
|
||||
// TODO: implement SSU
|
||||
if (addr->transportStyle == eTransportNTCP && (!addr->IsPublishedNTCP2 () || addr->port))
|
||||
if (addr->transportStyle == eTransportNTCP && !addr->IsPublishedNTCP2 ())
|
||||
{
|
||||
addr->caps &= ~(eV4 | eV6);
|
||||
addr->caps |= transports;
|
||||
|
|
Loading…
Reference in a new issue