mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
Compare commits
5 Commits
988a94c5c7
...
dab027d5f5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dab027d5f5 | ||
|
|
eadeea76e7 | ||
|
|
da7d3c55b0 | ||
|
|
60d3e4d963 | ||
|
|
6e639f0e6a |
@@ -2,6 +2,7 @@
|
|||||||
Description=I2P Router written in C++
|
Description=I2P Router written in C++
|
||||||
Documentation=man:i2pd(1) https://i2pd.readthedocs.io/en/latest/
|
Documentation=man:i2pd(1) https://i2pd.readthedocs.io/en/latest/
|
||||||
After=network.target
|
After=network.target
|
||||||
|
Wants=yggdrasil.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=i2pd
|
User=i2pd
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ namespace config {
|
|||||||
"https://reseed.onion.im/,"
|
"https://reseed.onion.im/,"
|
||||||
"https://i2pseed.creativecowpat.net:8443/,"
|
"https://i2pseed.creativecowpat.net:8443/,"
|
||||||
"https://reseed.i2pgit.org/,"
|
"https://reseed.i2pgit.org/,"
|
||||||
"https://banana.incognet.io/,"
|
"https://coconut.incognet.io/,"
|
||||||
"https://reseed-pl.i2pd.xyz/,"
|
"https://reseed-pl.i2pd.xyz/,"
|
||||||
"https://www2.mk16.de/,"
|
"https://www2.mk16.de/,"
|
||||||
"https://i2p.ghativega.in/,"
|
"https://i2p.ghativega.in/,"
|
||||||
|
|||||||
@@ -623,7 +623,8 @@ namespace transport
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint32_t packetNum = SendData (it->second->payload, it->second->payloadSize);
|
uint32_t packetNum = SendData (it->second->payload, it->second->payloadSize,
|
||||||
|
it->second->numResends > 1 ? SSU2_FLAG_IMMEDIATE_ACK_REQUESTED : 0);
|
||||||
it->second->numResends++;
|
it->second->numResends++;
|
||||||
it->second->sendTime = ts;
|
it->second->sendTime = ts;
|
||||||
resentPackets.emplace (packetNum, it->second);
|
resentPackets.emplace (packetNum, it->second);
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ namespace tunnel
|
|||||||
}
|
}
|
||||||
|
|
||||||
TransitTunnels::TransitTunnels ():
|
TransitTunnels::TransitTunnels ():
|
||||||
m_IsRunning (false)
|
m_IsRunning (false), m_Rng(i2p::util::GetMonotonicMicroseconds ()%1000000LL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,8 +328,25 @@ namespace tunnel
|
|||||||
// check if we accept this tunnel
|
// check if we accept this tunnel
|
||||||
std::shared_ptr<i2p::tunnel::TransitTunnel> transitTunnel;
|
std::shared_ptr<i2p::tunnel::TransitTunnel> transitTunnel;
|
||||||
uint8_t retCode = 0;
|
uint8_t retCode = 0;
|
||||||
if (!i2p::context.AcceptsTunnels () || i2p::context.GetCongestionLevel (false) >= CONGESTION_LEVEL_FULL)
|
if (i2p::context.AcceptsTunnels ())
|
||||||
|
{
|
||||||
|
auto congestionLevel = i2p::context.GetCongestionLevel (false);
|
||||||
|
if (congestionLevel < CONGESTION_LEVEL_FULL)
|
||||||
|
{
|
||||||
|
if (congestionLevel >= CONGESTION_LEVEL_MEDIUM)
|
||||||
|
{
|
||||||
|
// random reject depending on congestion level
|
||||||
|
int level = m_Rng () % (CONGESTION_LEVEL_FULL - CONGESTION_LEVEL_MEDIUM) + CONGESTION_LEVEL_MEDIUM;
|
||||||
|
if (congestionLevel > level)
|
||||||
|
retCode = 30;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
retCode = 30;
|
||||||
|
}
|
||||||
|
else
|
||||||
retCode = 30;
|
retCode = 30;
|
||||||
|
|
||||||
if (!retCode)
|
if (!retCode)
|
||||||
{
|
{
|
||||||
// create new transit tunnel
|
// create new transit tunnel
|
||||||
@@ -452,7 +469,7 @@ namespace tunnel
|
|||||||
if (congestionLevel < CONGESTION_LEVEL_FULL)
|
if (congestionLevel < CONGESTION_LEVEL_FULL)
|
||||||
{
|
{
|
||||||
// random reject depending on congestion level
|
// random reject depending on congestion level
|
||||||
int level = i2p::tunnel::tunnels.GetRng ()() % (CONGESTION_LEVEL_FULL - CONGESTION_LEVEL_MEDIUM) + CONGESTION_LEVEL_MEDIUM;
|
int level = m_Rng () % (CONGESTION_LEVEL_FULL - CONGESTION_LEVEL_MEDIUM) + CONGESTION_LEVEL_MEDIUM;
|
||||||
if (congestionLevel > level)
|
if (congestionLevel > level)
|
||||||
accept = false;
|
accept = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ namespace tunnel
|
|||||||
std::unique_ptr<std::thread> m_Thread;
|
std::unique_ptr<std::thread> m_Thread;
|
||||||
std::list<std::shared_ptr<TransitTunnel> > m_TransitTunnels;
|
std::list<std::shared_ptr<TransitTunnel> > m_TransitTunnels;
|
||||||
i2p::util::Queue<std::shared_ptr<I2NPMessage> > m_TunnelBuildMsgQueue;
|
i2p::util::Queue<std::shared_ptr<I2NPMessage> > m_TunnelBuildMsgQueue;
|
||||||
|
std::mt19937 m_Rng;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2024, The PurpleI2P Project
|
* Copyright (c) 2013-2025, The PurpleI2P Project
|
||||||
*
|
*
|
||||||
* This file is part of Purple i2pd project and licensed under BSD3
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
*
|
*
|
||||||
@@ -245,8 +245,6 @@ namespace tunnel
|
|||||||
void SetMaxNumTransitTunnels (uint32_t maxNumTransitTunnels);
|
void SetMaxNumTransitTunnels (uint32_t maxNumTransitTunnels);
|
||||||
uint32_t GetMaxNumTransitTunnels () const { return m_MaxNumTransitTunnels; };
|
uint32_t GetMaxNumTransitTunnels () const { return m_MaxNumTransitTunnels; };
|
||||||
int GetCongestionLevel() const { return m_MaxNumTransitTunnels ? CONGESTION_LEVEL_FULL * m_TransitTunnels.GetNumTransitTunnels () / m_MaxNumTransitTunnels : CONGESTION_LEVEL_FULL; }
|
int GetCongestionLevel() const { return m_MaxNumTransitTunnels ? CONGESTION_LEVEL_FULL * m_TransitTunnels.GetNumTransitTunnels () / m_MaxNumTransitTunnels : CONGESTION_LEVEL_FULL; }
|
||||||
|
|
||||||
std::mt19937& GetRng () { return m_Rng; };
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user