mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 11:04:17 +00:00
select ipv6 random introducer
This commit is contained in:
parent
ad019da553
commit
060e30d283
@ -1168,12 +1168,12 @@ namespace data
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<const RouterInfo> NetDb::GetRandomIntroducer () const
|
std::shared_ptr<const RouterInfo> NetDb::GetRandomIntroducer (bool v4) const
|
||||||
{
|
{
|
||||||
return GetRandomRouter (
|
return GetRandomRouter (
|
||||||
[](std::shared_ptr<const RouterInfo> router)->bool
|
[v4](std::shared_ptr<const RouterInfo> router)->bool
|
||||||
{
|
{
|
||||||
return router->IsIntroducer (true) && !router->IsHidden () && !router->IsFloodfill (); // floodfills don't send relay tag
|
return router->IsIntroducer (v4) && !router->IsHidden () && !router->IsFloodfill (); // floodfills don't send relay tag
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ namespace data
|
|||||||
std::shared_ptr<const RouterInfo> GetHighBandwidthRandomRouter (std::shared_ptr<const RouterInfo> compatibleWith, bool reverse) const;
|
std::shared_ptr<const RouterInfo> GetHighBandwidthRandomRouter (std::shared_ptr<const RouterInfo> compatibleWith, bool reverse) const;
|
||||||
std::shared_ptr<const RouterInfo> GetRandomPeerTestRouter (bool v4, const std::set<IdentHash>& excluded) const;
|
std::shared_ptr<const RouterInfo> GetRandomPeerTestRouter (bool v4, const std::set<IdentHash>& excluded) const;
|
||||||
std::shared_ptr<const RouterInfo> GetRandomSSUV6Router () const; // TODO: change to v6 peer test later
|
std::shared_ptr<const RouterInfo> GetRandomSSUV6Router () const; // TODO: change to v6 peer test later
|
||||||
std::shared_ptr<const RouterInfo> GetRandomIntroducer () const;
|
std::shared_ptr<const RouterInfo> GetRandomIntroducer (bool v4) const;
|
||||||
std::shared_ptr<const RouterInfo> GetClosestFloodfill (const IdentHash& destination, const std::set<IdentHash>& excluded, bool closeThanUsOnly = false) const;
|
std::shared_ptr<const RouterInfo> GetClosestFloodfill (const IdentHash& destination, const std::set<IdentHash>& excluded, bool closeThanUsOnly = false) const;
|
||||||
std::vector<IdentHash> GetClosestFloodfills (const IdentHash& destination, size_t num,
|
std::vector<IdentHash> GetClosestFloodfills (const IdentHash& destination, size_t num,
|
||||||
std::set<IdentHash>& excluded, bool closeThanUsOnly = false) const;
|
std::set<IdentHash>& excluded, bool closeThanUsOnly = false) const;
|
||||||
|
@ -794,10 +794,10 @@ namespace transport
|
|||||||
std::set<std::shared_ptr<const i2p::data::RouterInfo> > requested;
|
std::set<std::shared_ptr<const i2p::data::RouterInfo> > requested;
|
||||||
for (auto i = introducers.size (); i < SSU_MAX_NUM_INTRODUCERS; i++)
|
for (auto i = introducers.size (); i < SSU_MAX_NUM_INTRODUCERS; i++)
|
||||||
{
|
{
|
||||||
auto introducer = i2p::data::netdb.GetRandomIntroducer ();
|
auto introducer = i2p::data::netdb.GetRandomIntroducer (v4);
|
||||||
if (introducer && !requested.count (introducer)) // not requested already
|
if (introducer && !requested.count (introducer)) // not requested already
|
||||||
{
|
{
|
||||||
auto address = introducer->GetSSUAddress (true); // v4
|
auto address = v4 ? introducer->GetSSUAddress (true) : introducer->GetSSUV6Address ();
|
||||||
if (address && !address->host.is_unspecified ())
|
if (address && !address->host.is_unspecified ())
|
||||||
{
|
{
|
||||||
boost::asio::ip::udp::endpoint ep (address->host, address->port);
|
boost::asio::ip::udp::endpoint ep (address->host, address->port);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user