Browse Source

show ECIESx25519 session and tag on the web console

pull/1515/head
orignal 5 years ago
parent
commit
27d69894d4
  1. 11
      daemon/HTTPServer.cpp
  2. 9
      libi2pd/ECIESX25519AEADRatchetSession.h
  3. 2
      libi2pd/Garlic.h

11
daemon/HTTPServer.cpp

@ -22,6 +22,7 @@ @@ -22,6 +22,7 @@
#include "HTTPServer.h"
#include "Daemon.h"
#include "util.h"
#include "ECIESX25519AEADRatchetSession.h"
#ifdef WIN32_APP
#include "Win32/Win32App.h"
#endif
@ -409,6 +410,16 @@ namespace http { @@ -409,6 +410,16 @@ namespace http {
<< "<div class='content'>\r\n<table><tbody><thead><th>Destination</th><th>Amount</th></thead>\r\n" << tmp_s.str () << "</tbody></table>\r\n</div>\r\n</div>\r\n";
} else
s << "Outgoing: <i>0</i><br>\r\n";
auto numECIESx25519Tags = dest->GetNumIncomingECIESx25519Tags ();
if (numECIESx25519Tags > 0)
s << "Incoming ECIESx25519: <i>" << numECIESx25519Tags << "</i><br>";
if (!dest->GetECIESx25519Sessions ().empty ())
{
s << "<br>\r\n<b>ECIESx25519Tags sessions</b><br>";
for (const auto& it: dest->GetECIESx25519Sessions ())
s << i2p::client::context.GetAddressBook ().ToAddress(it.second->GetDestination ())
<< " " << it.second->GetState () << "<br>\r\n";
}
s << "<br>\r\n";
}

9
libi2pd/ECIESX25519AEADRatchetSession.h

@ -156,6 +156,15 @@ namespace garlic @@ -156,6 +156,15 @@ namespace garlic
std::list<std::pair<uint16_t, int> > m_AckRequests; // (tagsetid, index)
bool m_SendReverseKey = false, m_SendForwardKey = false;
std::unique_ptr<DHRatchet> m_NextReceiveRatchet, m_NextSendRatchet;
public:
// for HTTP only
int GetState () const { return (int)m_State; }
i2p::data::IdentHash GetDestination () const
{
return m_Destination ? *m_Destination : i2p::data::IdentHash ();
}
};
std::shared_ptr<I2NPMessage> WrapECIESX25519AEADRatchetMessage (std::shared_ptr<const I2NPMessage> msg, const uint8_t * key, uint64_t tag);

2
libi2pd/Garlic.h

@ -276,7 +276,9 @@ namespace garlic @@ -276,7 +276,9 @@ namespace garlic
// for HTTP only
size_t GetNumIncomingTags () const { return m_Tags.size (); }
size_t GetNumIncomingECIESx25519Tags () const { return m_ECIESx25519Tags.size (); }
const decltype(m_Sessions)& GetSessions () const { return m_Sessions; };
const decltype(m_ECIESx25519Sessions)& GetECIESx25519Sessions () const { return m_ECIESx25519Sessions; }
};
void CleanUpTagsFiles ();

Loading…
Cancel
Save