mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-22 00:59:08 +01:00
separate transports output for IPv4 and IPv6
This commit is contained in:
parent
676c61aa99
commit
2bc5b97662
1 changed files with 61 additions and 28 deletions
|
@ -496,18 +496,42 @@ namespace http {
|
||||||
if (ntcpServer)
|
if (ntcpServer)
|
||||||
{
|
{
|
||||||
auto sessions = ntcpServer->GetNTCPSessions ();
|
auto sessions = ntcpServer->GetNTCPSessions ();
|
||||||
s << "<b>NTCP</b> ( " << (int) sessions.size() << " )<br>\r\n";
|
if (!sessions.empty ())
|
||||||
|
{
|
||||||
|
std::stringstream tmp_s, tmp_s6; uint16_t cnt = 0, cnt6 = 0;
|
||||||
for (const auto& it: sessions )
|
for (const auto& it: sessions )
|
||||||
{
|
{
|
||||||
if (it.second && it.second->IsEstablished ())
|
if (it.second && it.second->IsEstablished () && !it.second->GetSocket ().remote_endpoint ().address ().is_v6 ())
|
||||||
{
|
{
|
||||||
// incoming connection doesn't have remote RI
|
// incoming connection doesn't have remote RI
|
||||||
if (it.second->IsOutgoing ()) s << " ⇒ ";
|
if (it.second->IsOutgoing ()) tmp_s << " ⇒ ";
|
||||||
s << i2p::data::GetIdentHashAbbreviation (it.second->GetRemoteIdentity ()->GetIdentHash ()) << ": "
|
tmp_s << i2p::data::GetIdentHashAbbreviation (it.second->GetRemoteIdentity ()->GetIdentHash ()) << ": "
|
||||||
<< it.second->GetSocket ().remote_endpoint().address ().to_string ();
|
<< it.second->GetSocket ().remote_endpoint().address ().to_string ();
|
||||||
if (!it.second->IsOutgoing ()) s << " ⇒ ";
|
if (!it.second->IsOutgoing ()) tmp_s << " ⇒ ";
|
||||||
s << " [" << it.second->GetNumSentBytes () << ":" << it.second->GetNumReceivedBytes () << "]";
|
tmp_s << " [" << it.second->GetNumSentBytes () << ":" << it.second->GetNumReceivedBytes () << "]";
|
||||||
s << "<br>\r\n" << std::endl;
|
tmp_s << "<br>\r\n" << std::endl;
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
|
if (it.second && it.second->IsEstablished () && it.second->GetSocket ().remote_endpoint ().address ().is_v6 ())
|
||||||
|
{
|
||||||
|
if (it.second->IsOutgoing ()) tmp_s6 << " ⇒ ";
|
||||||
|
tmp_s6 << i2p::data::GetIdentHashAbbreviation (it.second->GetRemoteIdentity ()->GetIdentHash ()) << ": "
|
||||||
|
<< "[" << it.second->GetSocket ().remote_endpoint().address ().to_string () << "]";
|
||||||
|
if (!it.second->IsOutgoing ()) tmp_s6 << " ⇒ ";
|
||||||
|
tmp_s6 << " [" << it.second->GetNumSentBytes () << ":" << it.second->GetNumReceivedBytes () << "]";
|
||||||
|
tmp_s6 << "<br>\r\n" << std::endl;
|
||||||
|
cnt6++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!tmp_s.str ().empty ())
|
||||||
|
{
|
||||||
|
s << "<b>NTCP</b> ( " << cnt << " )<br>\r\n";
|
||||||
|
s << tmp_s.str () << "<br>\r\n";
|
||||||
|
}
|
||||||
|
if (!tmp_s6.str ().empty ())
|
||||||
|
{
|
||||||
|
s << "<b>NTCP6</b> ( " << cnt6 << " )<br>\r\n";
|
||||||
|
s << tmp_s6.str () << "<br>\r\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -515,7 +539,9 @@ namespace http {
|
||||||
if (ssuServer)
|
if (ssuServer)
|
||||||
{
|
{
|
||||||
auto sessions = ssuServer->GetSessions ();
|
auto sessions = ssuServer->GetSessions ();
|
||||||
s << "<br>\r\n<b>SSU</b> ( " << (int) sessions.size() << " )<br>\r\n";
|
if (!sessions.empty ())
|
||||||
|
{
|
||||||
|
s << "<b>SSU</b> ( " << (int) sessions.size() << " )<br>\r\n";
|
||||||
for (const auto& it: sessions)
|
for (const auto& it: sessions)
|
||||||
{
|
{
|
||||||
auto endpoint = it.second->GetRemoteEndpoint ();
|
auto endpoint = it.second->GetRemoteEndpoint ();
|
||||||
|
@ -527,18 +553,25 @@ namespace http {
|
||||||
s << " [itag:" << it.second->GetRelayTag () << "]";
|
s << " [itag:" << it.second->GetRelayTag () << "]";
|
||||||
s << "<br>\r\n" << std::endl;
|
s << "<br>\r\n" << std::endl;
|
||||||
}
|
}
|
||||||
s << "<br>\r\n<b>SSU6</b><br>\r\n";
|
}
|
||||||
for (const auto& it: ssuServer->GetSessionsV6 ())
|
auto sessions6 = ssuServer->GetSessionsV6 ();
|
||||||
|
if (!sessions6.empty ())
|
||||||
|
{
|
||||||
|
s << "<b>SSU6</b> ( " << (int) sessions6.size() << " )<br>\r\n";
|
||||||
|
for (const auto& it: sessions6)
|
||||||
{
|
{
|
||||||
auto endpoint = it.second->GetRemoteEndpoint ();
|
auto endpoint = it.second->GetRemoteEndpoint ();
|
||||||
if (it.second->IsOutgoing ()) s << " ⇒ ";
|
if (it.second->IsOutgoing ()) s << " ⇒ ";
|
||||||
s << endpoint.address ().to_string () << ":" << endpoint.port ();
|
s << "[" << endpoint.address ().to_string () << "]:" << endpoint.port ();
|
||||||
if (!it.second->IsOutgoing ()) s << " ⇒ ";
|
if (!it.second->IsOutgoing ()) s << " ⇒ ";
|
||||||
s << " [" << it.second->GetNumSentBytes () << ":" << it.second->GetNumReceivedBytes () << "]";
|
s << " [" << it.second->GetNumSentBytes () << ":" << it.second->GetNumReceivedBytes () << "]";
|
||||||
|
if (it.second->GetRelayTag ())
|
||||||
|
s << " [itag:" << it.second->GetRelayTag () << "]";
|
||||||
s << "<br>\r\n" << std::endl;
|
s << "<br>\r\n" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void ShowSAMSessions (std::stringstream& s)
|
static void ShowSAMSessions (std::stringstream& s)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue