mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
recognize congestion caps
This commit is contained in:
parent
d6ed9152ee
commit
d50cf0ad83
3 changed files with 55 additions and 5 deletions
|
@ -44,7 +44,11 @@ namespace data
|
|||
const char CAPS_FLAG_HIGH_BANDWIDTH3 = 'O'; /* 128-256 KBps */
|
||||
const char CAPS_FLAG_EXTRA_BANDWIDTH1 = 'P'; /* 256-2000 KBps */
|
||||
const char CAPS_FLAG_EXTRA_BANDWIDTH2 = 'X'; /* > 2000 KBps */
|
||||
|
||||
// congesion flags
|
||||
const char CAPS_FLAG_MEDIUM_COGNESTION = 'D';
|
||||
const char CAPS_FLAG_HIGH_COGNESTION = 'E';
|
||||
const char CAPS_FLAG_REJECT_ALL_COGNESTION = 'G';
|
||||
|
||||
const char CAPS_FLAG_V4 = '4';
|
||||
const char CAPS_FLAG_V6 = '6';
|
||||
const char CAPS_FLAG_SSU2_TESTING = 'B';
|
||||
|
@ -56,6 +60,8 @@ namespace data
|
|||
const uint8_t COST_SSU2_NON_PUBLISHED = 15;
|
||||
|
||||
const size_t MAX_RI_BUFFER_SIZE = 3072; // if RouterInfo exceeds 3K we consider it as malformed, might extend later
|
||||
const int HIGH_COGNESION_INTERVAL = 15*60; // in seconds, 15 minutes
|
||||
|
||||
class RouterInfo: public RoutingDestination
|
||||
{
|
||||
public:
|
||||
|
@ -93,6 +99,14 @@ namespace data
|
|||
eUnreachable = 0x20
|
||||
};
|
||||
|
||||
enum Congestion
|
||||
{
|
||||
eLowCongestion = 0,
|
||||
eMediumCongestion,
|
||||
eHighCongestion,
|
||||
eRejectAll
|
||||
};
|
||||
|
||||
enum AddressCaps
|
||||
{
|
||||
eV4 = 0x01,
|
||||
|
@ -234,10 +248,13 @@ namespace data
|
|||
bool IsEligibleFloodfill () const;
|
||||
bool IsSSU2PeerTesting (bool v4) const;
|
||||
bool IsSSU2Introducer (bool v4) const;
|
||||
bool IsHighCongestion () const;
|
||||
|
||||
uint8_t GetCaps () const { return m_Caps; };
|
||||
void SetCaps (uint8_t caps) { m_Caps = caps; };
|
||||
|
||||
Congestion GetCongestion () const { return m_Congestion; };
|
||||
|
||||
void SetUnreachable (bool unreachable) { m_IsUnreachable = unreachable; };
|
||||
bool IsUnreachable () const { return m_IsUnreachable; };
|
||||
|
||||
|
@ -302,6 +319,7 @@ namespace data
|
|||
CompatibleTransports m_SupportedTransports, m_ReachableTransports;
|
||||
uint8_t m_Caps;
|
||||
int m_Version;
|
||||
Congestion m_Congestion;
|
||||
mutable std::shared_ptr<RouterProfile> m_Profile;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue