Browse Source

show trafic for transit tunnels

pull/8/head
orignal 11 years ago
parent
commit
040d0f5f58
  1. 11
      HTTPServer.cpp
  2. 4
      TransitTunnel.cpp
  3. 4
      TransitTunnel.h

11
HTTPServer.cpp

@ -104,15 +104,22 @@ namespace util @@ -104,15 +104,22 @@ namespace util
s << "-->" << it.second->GetTunnelID ();
else
s << "-->" << it.second->GetTunnelID () << "-->";
s << "<BR>";
s << " " << it.second->GetNumTransmittedBytes () << "<BR>";
}
s << "<P>Transports</P>";
for (auto it: i2p::transports.GetNTCPSessions ())
{
// RouterInfo of incoming connection doesn't have address
bool outgoing = it.second->GetRemoteRouterInfo ().GetNTCPAddress ();
if (it.second->IsEstablished ())
{
if (outgoing) s << "-->";
s << it.second->GetRemoteRouterInfo ().GetIdentHashAbbreviation () << ": "
<< it.second->GetSocket ().remote_endpoint().address ().to_string () << "<BR>";
<< it.second->GetSocket ().remote_endpoint().address ().to_string ();
if (!outgoing) s << "-->";
s << "<BR>";
}
}
}

4
TransitTunnel.cpp

@ -14,7 +14,8 @@ namespace tunnel @@ -14,7 +14,8 @@ namespace tunnel
TransitTunnel::TransitTunnel (uint32_t receiveTunnelID,
const uint8_t * nextIdent, uint32_t nextTunnelID,
const uint8_t * layerKey,const uint8_t * ivKey):
m_TunnelID (receiveTunnelID), m_NextTunnelID (nextTunnelID), m_NextIdent (nextIdent)
m_TunnelID (receiveTunnelID), m_NextTunnelID (nextTunnelID),
m_NextIdent (nextIdent), m_NumTransmittedBytes (0)
{
memcpy (m_LayerKey, layerKey, 32);
memcpy (m_IVKey, ivKey, 32);
@ -43,6 +44,7 @@ namespace tunnel @@ -43,6 +44,7 @@ namespace tunnel
FillI2NPMessageHeader (tunnelMsg, eI2NPTunnelData);
i2p::transports.SendMessage (m_NextIdent, tunnelMsg);
m_NumTransmittedBytes += tunnelMsg->GetLength ();
}
void TransitTunnel::SendTunnelDataMsg (const uint8_t * gwHash, uint32_t gwTunnel, i2p::I2NPMessage * msg)

4
TransitTunnel.h

@ -23,6 +23,7 @@ namespace tunnel @@ -23,6 +23,7 @@ namespace tunnel
virtual void HandleTunnelDataMsg (i2p::I2NPMessage * tunnelMsg);
virtual void SendTunnelDataMsg (const uint8_t * gwHash, uint32_t gwTunnel, i2p::I2NPMessage * msg);
virtual size_t GetNumTransmittedBytes () const { return m_NumTransmittedBytes; };
uint32_t GetTunnelID () const { return m_TunnelID; };
@ -37,6 +38,7 @@ namespace tunnel @@ -37,6 +38,7 @@ namespace tunnel
i2p::data::IdentHash m_NextIdent;
uint8_t m_LayerKey[32];
uint8_t m_IVKey[32];
size_t m_NumTransmittedBytes;
CryptoPP::ECB_Mode<CryptoPP::AES>::Encryption m_ECBEncryption;
CryptoPP::CBC_Mode<CryptoPP::AES>::Encryption m_CBCEncryption;
@ -53,6 +55,7 @@ namespace tunnel @@ -53,6 +55,7 @@ namespace tunnel
layerKey, ivKey), m_Gateway(this) {};
void SendTunnelDataMsg (const uint8_t * gwHash, uint32_t gwTunnel, i2p::I2NPMessage * msg);
size_t GetNumTransmittedBytes () const { return m_Gateway.GetNumSentBytes (); };
private:
@ -69,6 +72,7 @@ namespace tunnel @@ -69,6 +72,7 @@ namespace tunnel
TransitTunnel (receiveTunnelID, nextIdent, nextTunnelID, layerKey, ivKey) {};
void HandleTunnelDataMsg (i2p::I2NPMessage * tunnelMsg);
size_t GetNumTransmittedBytes () const { return m_Endpoint.GetNumReceivedBytes (); }
private:

Loading…
Cancel
Save