reconfigure crypto.ratchet.inboundTags

This commit is contained in:
orignal 2025-10-13 18:02:40 -04:00
parent 12895b5744
commit 07263e77df

View file

@ -167,31 +167,28 @@ namespace client
bool LeaseSetDestination::Reconfigure(const i2p::util::Mapping& params) bool LeaseSetDestination::Reconfigure(const i2p::util::Mapping& params)
{ {
params.Get ("i2cp.dontPublishLeaseSet", m_IsPublic); params.Get (I2CP_PARAM_DONT_PUBLISH_LEASESET, m_IsPublic);
int inLen = 0, outLen = 0, inQuant = 0, outQuant = 0, numTags = 0, minLatency = 0, maxLatency = 0;
std::map<std::string_view, int&> intOpts =
{
{I2CP_PARAM_INBOUND_TUNNEL_LENGTH, inLen},
{I2CP_PARAM_OUTBOUND_TUNNEL_LENGTH, outLen},
{I2CP_PARAM_INBOUND_TUNNELS_QUANTITY, inQuant},
{I2CP_PARAM_OUTBOUND_TUNNELS_QUANTITY, outQuant},
{I2CP_PARAM_TAGS_TO_SEND, numTags},
{I2CP_PARAM_MIN_TUNNEL_LATENCY, minLatency},
{I2CP_PARAM_MAX_TUNNEL_LATENCY, maxLatency}
};
auto numTags = GetNumTags ();
params.Get (I2CP_PARAM_TAGS_TO_SEND, numTags);
auto numRatchetInboundTags = GetNumRatchetInboundTags ();
params.Get (I2CP_PARAM_RATCHET_INBOUND_TAGS, numRatchetInboundTags);
auto pool = GetTunnelPool(); auto pool = GetTunnelPool();
inLen = pool->GetNumInboundHops(); auto inLen = pool->GetNumInboundHops();
outLen = pool->GetNumOutboundHops(); params.Get (I2CP_PARAM_INBOUND_TUNNEL_LENGTH, inLen);
inQuant = pool->GetNumInboundTunnels(); auto outLen = pool->GetNumOutboundHops();
outQuant = pool->GetNumOutboundTunnels(); params.Get (I2CP_PARAM_OUTBOUND_TUNNEL_LENGTH, outLen);
minLatency = 0; auto inQuant = pool->GetNumInboundTunnels();
maxLatency = 0; params.Get (I2CP_PARAM_INBOUND_TUNNELS_QUANTITY, inQuant);
auto outQuant = pool->GetNumOutboundTunnels();
for (auto & opt : intOpts) params.Get (I2CP_PARAM_OUTBOUND_TUNNELS_QUANTITY, outQuant);
params.Get (opt.first, opt.second); int minLatency = 0;
params.Get (I2CP_PARAM_MIN_TUNNEL_LATENCY, minLatency);
int maxLatency = 0;
params.Get (I2CP_PARAM_MAX_TUNNEL_LATENCY, maxLatency);
SetNumTags (numTags);
SetNumRatchetInboundTags (numRatchetInboundTags);
pool->RequireLatency(minLatency, maxLatency); pool->RequireLatency(minLatency, maxLatency);
return pool->Reconfigure(inLen, outLen, inQuant, outQuant); return pool->Reconfigure(inLen, outLen, inQuant, outQuant);
} }