mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 13:27:17 +01:00
show next peer and connectivity on transit tunnels page
Some checks are pending
Build Debian packages / ${{ matrix.dist }} (bookworm) (push) Waiting to run
Build Debian packages / ${{ matrix.dist }} (bullseye) (push) Waiting to run
Build Debian packages / ${{ matrix.dist }} (buster) (push) Waiting to run
Build on FreeBSD / with UPnP (push) Waiting to run
Build on OSX / With USE_UPNP=${{ matrix.with_upnp }} (no) (push) Waiting to run
Build on OSX / With USE_UPNP=${{ matrix.with_upnp }} (yes) (push) Waiting to run
Build on Windows / CMake ${{ matrix.arch }} (i686, x86, gcc, MINGW32) (push) Waiting to run
Build on Windows / CMake ${{ matrix.arch }} (ucrt-x86_64, x64-ucrt, gcc, UCRT64) (push) Waiting to run
Build on Windows / CMake ${{ matrix.arch }} (x86_64, x64, gcc, MINGW64) (push) Waiting to run
Build on Windows / ${{ matrix.arch }} (clang-x86_64, x64-clang, clang, CLANG64) (push) Waiting to run
Build on Windows / ${{ matrix.arch }} (i686, x86, gcc, MINGW32) (push) Waiting to run
Build on Windows / ${{ matrix.arch }} (ucrt-x86_64, x64-ucrt, gcc, UCRT64) (push) Waiting to run
Build on Windows / ${{ matrix.arch }} (x86_64, x64, gcc, MINGW64) (push) Waiting to run
Build on Windows / CMake ${{ matrix.arch }} (clang-x86_64, x64-clang, clang, CLANG64) (push) Waiting to run
Build on Windows / XP (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=${{ matrix.with_upnp }} (no) (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=${{ matrix.with_upnp }} (yes) (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=${{ matrix.with_upnp }} (OFF) (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=${{ matrix.with_upnp }} (ON) (push) Waiting to run
Build containers / Building container for ${{ matrix.platform }} (armv7, linux/arm/v7) (push) Waiting to run
Build containers / Building container for ${{ matrix.platform }} (i386, linux/386) (push) Waiting to run
Build containers / Building container for ${{ matrix.platform }} (amd64, linux/amd64) (push) Waiting to run
Build containers / Building container for ${{ matrix.platform }} (arm64, linux/arm64) (push) Waiting to run
Build containers / Pushing merged manifest (push) Blocked by required conditions
Some checks are pending
Build Debian packages / ${{ matrix.dist }} (bookworm) (push) Waiting to run
Build Debian packages / ${{ matrix.dist }} (bullseye) (push) Waiting to run
Build Debian packages / ${{ matrix.dist }} (buster) (push) Waiting to run
Build on FreeBSD / with UPnP (push) Waiting to run
Build on OSX / With USE_UPNP=${{ matrix.with_upnp }} (no) (push) Waiting to run
Build on OSX / With USE_UPNP=${{ matrix.with_upnp }} (yes) (push) Waiting to run
Build on Windows / CMake ${{ matrix.arch }} (i686, x86, gcc, MINGW32) (push) Waiting to run
Build on Windows / CMake ${{ matrix.arch }} (ucrt-x86_64, x64-ucrt, gcc, UCRT64) (push) Waiting to run
Build on Windows / CMake ${{ matrix.arch }} (x86_64, x64, gcc, MINGW64) (push) Waiting to run
Build on Windows / ${{ matrix.arch }} (clang-x86_64, x64-clang, clang, CLANG64) (push) Waiting to run
Build on Windows / ${{ matrix.arch }} (i686, x86, gcc, MINGW32) (push) Waiting to run
Build on Windows / ${{ matrix.arch }} (ucrt-x86_64, x64-ucrt, gcc, UCRT64) (push) Waiting to run
Build on Windows / ${{ matrix.arch }} (x86_64, x64, gcc, MINGW64) (push) Waiting to run
Build on Windows / CMake ${{ matrix.arch }} (clang-x86_64, x64-clang, clang, CLANG64) (push) Waiting to run
Build on Windows / XP (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=${{ matrix.with_upnp }} (no) (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=${{ matrix.with_upnp }} (yes) (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=${{ matrix.with_upnp }} (OFF) (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=${{ matrix.with_upnp }} (ON) (push) Waiting to run
Build containers / Building container for ${{ matrix.platform }} (armv7, linux/arm/v7) (push) Waiting to run
Build containers / Building container for ${{ matrix.platform }} (i386, linux/386) (push) Waiting to run
Build containers / Building container for ${{ matrix.platform }} (amd64, linux/amd64) (push) Waiting to run
Build containers / Building container for ${{ matrix.platform }} (arm64, linux/arm64) (push) Waiting to run
Build containers / Pushing merged manifest (push) Blocked by required conditions
This commit is contained in:
parent
833e0a936e
commit
b4bcd9914a
|
@ -826,7 +826,7 @@ namespace http {
|
|||
if (i2p::tunnel::tunnels.CountTransitTunnels())
|
||||
{
|
||||
s << "<b>" << tr("Transit Tunnels") << ":</b><br>\r\n";
|
||||
s << "<table><thead><th>⇒</th><th>ID</th><th>⇒</th><th>" << tr("Amount") << "</th></thead><tbody class=\"tableitem\">";
|
||||
s << "<table><thead><th>⇒</th><th>ID</th><th>⇒</th><th>" << tr("Amount") << "</th><th>" << tr("Next") << "</th></thead><tbody class=\"tableitem\">";
|
||||
for (const auto& it: i2p::tunnel::tunnels.GetTransitTunnels ())
|
||||
{
|
||||
if (std::dynamic_pointer_cast<i2p::tunnel::TransitTunnelGateway>(it))
|
||||
|
@ -836,7 +836,7 @@ namespace http {
|
|||
else
|
||||
s << "<tr><td>⇒</td><td>" << it->GetTunnelID () << "</td><td>⇒</td><td>";
|
||||
ShowTraffic(s, it->GetNumTransmittedBytes ());
|
||||
s << "</td></tr>\r\n";
|
||||
s << "</td><td>" << it->GetNextPeerName () << "</td></tr>\r\n";
|
||||
}
|
||||
s << "</tbody></table>\r\n";
|
||||
}
|
||||
|
|
|
@ -1435,6 +1435,12 @@ namespace transport
|
|||
boost::asio::post (m_Server.GetService (), std::bind (&NTCP2Session::SendRouterInfo, shared_from_this ()));
|
||||
}
|
||||
|
||||
i2p::data::RouterInfo::SupportedTransports NTCP2Session::GetTransportType () const
|
||||
{
|
||||
if (m_RemoteEndpoint.address ().is_v4 ()) return i2p::data::RouterInfo::eNTCP2V4;
|
||||
return i2p::util::net::IsYggdrasilAddress (m_RemoteEndpoint.address ()) ? i2p::data::RouterInfo::eNTCP2V6Mesh : i2p::data::RouterInfo::eNTCP2V6;
|
||||
}
|
||||
|
||||
NTCP2Server::NTCP2Server ():
|
||||
RunnableServiceWithWork ("NTCP2"), m_TerminationTimer (GetService ()),
|
||||
m_ProxyType(eNoProxy), m_Resolver(GetService ()),
|
||||
|
|
|
@ -147,6 +147,7 @@ namespace transport
|
|||
void SetRemoteEndpoint (const boost::asio::ip::tcp::endpoint& ep) { m_RemoteEndpoint = ep; };
|
||||
|
||||
bool IsEstablished () const override { return m_IsEstablished; };
|
||||
i2p::data::RouterInfo::SupportedTransports GetTransportType () const override;
|
||||
bool IsTerminated () const { return m_IsTerminated; };
|
||||
|
||||
void ClientLogin (); // Alice
|
||||
|
|
|
@ -1196,6 +1196,19 @@ namespace data
|
|||
}
|
||||
}
|
||||
|
||||
std::string RouterInfo::GetTransportName (SupportedTransports tr)
|
||||
{
|
||||
switch (tr)
|
||||
{
|
||||
case eNTCP2V4: return "NTCP2V4";
|
||||
case eNTCP2V6: return "NTCP2V6";
|
||||
case eSSU2V4: return "SSU2V4";
|
||||
case eSSU2V6: return "SSU2V6";
|
||||
case eNTCP2V6Mesh: return "Mesh";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
void LocalRouterInfo::CreateBuffer (const PrivateKeys& privateKeys)
|
||||
{
|
||||
RefreshTimestamp ();
|
||||
|
|
|
@ -363,6 +363,10 @@ namespace data
|
|||
int m_Version;
|
||||
Congestion m_Congestion;
|
||||
mutable std::shared_ptr<RouterProfile> m_Profile;
|
||||
|
||||
public:
|
||||
|
||||
static std::string GetTransportName (SupportedTransports tr);
|
||||
};
|
||||
|
||||
class LocalRouterInfo: public RouterInfo
|
||||
|
|
|
@ -3114,5 +3114,10 @@ namespace transport
|
|||
else if (!sent && !m_SentPackets.empty ()) // if only acks received, nothing sent and we still have something to resend
|
||||
Resend (i2p::util::GetMillisecondsSinceEpoch ()); // than right time to resend
|
||||
}
|
||||
|
||||
i2p::data::RouterInfo::SupportedTransports SSU2Session::GetTransportType () const
|
||||
{
|
||||
return m_RemoteEndpoint.address ().is_v4 () ? i2p::data::RouterInfo::eSSU2V4 : i2p::data::RouterInfo::eSSU2V6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -267,6 +267,7 @@ namespace transport
|
|||
size_t Resend (uint64_t ts); // return number of resent packets
|
||||
uint64_t GetLastResendTime () const { return m_LastResendTime; };
|
||||
bool IsEstablished () const override { return m_State == eSSU2SessionStateEstablished; };
|
||||
i2p::data::RouterInfo::SupportedTransports GetTransportType () const override;
|
||||
uint64_t GetConnID () const { return m_SourceConnID; };
|
||||
SSU2SessionState GetState () const { return m_State; };
|
||||
void SetState (SSU2SessionState state) { m_State = state; };
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include "I2PEndian.h"
|
||||
#include "Crypto.h"
|
||||
#include "Log.h"
|
||||
#include "Identity.h"
|
||||
#include "RouterInfo.h"
|
||||
#include "RouterContext.h"
|
||||
#include "I2NPProtocol.h"
|
||||
#include "Garlic.h"
|
||||
|
@ -41,6 +43,21 @@ namespace tunnel
|
|||
i2p::transport::transports.UpdateTotalTransitTransmittedBytes (TUNNEL_DATA_MSG_SIZE);
|
||||
}
|
||||
|
||||
std::string TransitTunnel::GetNextPeerName () const
|
||||
{
|
||||
return i2p::data::GetIdentHashAbbreviation (GetNextIdentHash ());
|
||||
}
|
||||
|
||||
void TransitTunnel::SendTunnelDataMsg (std::shared_ptr<i2p::I2NPMessage> msg)
|
||||
{
|
||||
LogPrint (eLogError, "TransitTunnel: We are not a gateway for ", GetTunnelID ());
|
||||
}
|
||||
|
||||
void TransitTunnel::HandleTunnelDataMsg (std::shared_ptr<i2p::I2NPMessage>&& tunnelMsg)
|
||||
{
|
||||
LogPrint (eLogError, "TransitTunnel: Incoming tunnel message is not supported ", GetTunnelID ());
|
||||
}
|
||||
|
||||
TransitTunnelParticipant::~TransitTunnelParticipant ()
|
||||
{
|
||||
}
|
||||
|
@ -67,14 +84,16 @@ namespace tunnel
|
|||
}
|
||||
}
|
||||
|
||||
void TransitTunnel::SendTunnelDataMsg (std::shared_ptr<i2p::I2NPMessage> msg)
|
||||
std::string TransitTunnelParticipant::GetNextPeerName () const
|
||||
{
|
||||
LogPrint (eLogError, "TransitTunnel: We are not a gateway for ", GetTunnelID ());
|
||||
if (m_Sender)
|
||||
{
|
||||
auto transport = m_Sender->GetCurrentTransport ();
|
||||
if (transport)
|
||||
return TransitTunnel::GetNextPeerName () + "-" +
|
||||
i2p::data::RouterInfo::GetTransportName (transport->GetTransportType ());
|
||||
}
|
||||
|
||||
void TransitTunnel::HandleTunnelDataMsg (std::shared_ptr<i2p::I2NPMessage>&& tunnelMsg)
|
||||
{
|
||||
LogPrint (eLogError, "TransitTunnel: Incoming tunnel message is not supported ", GetTunnelID ());
|
||||
return TransitTunnel::GetNextPeerName ();
|
||||
}
|
||||
|
||||
void TransitTunnelGateway::SendTunnelDataMsg (std::shared_ptr<i2p::I2NPMessage> msg)
|
||||
|
@ -92,6 +111,19 @@ namespace tunnel
|
|||
m_Gateway.SendBuffer ();
|
||||
}
|
||||
|
||||
std::string TransitTunnelGateway::GetNextPeerName () const
|
||||
{
|
||||
const auto& sender = m_Gateway.GetSender ();
|
||||
if (sender)
|
||||
{
|
||||
auto transport = sender->GetCurrentTransport ();
|
||||
if (transport)
|
||||
return TransitTunnel::GetNextPeerName () + "-" +
|
||||
i2p::data::RouterInfo::GetTransportName (transport->GetTransportType ());
|
||||
}
|
||||
return TransitTunnel::GetNextPeerName ();
|
||||
}
|
||||
|
||||
void TransitTunnelEndpoint::HandleTunnelDataMsg (std::shared_ptr<i2p::I2NPMessage>&& tunnelMsg)
|
||||
{
|
||||
auto newMsg = CreateEmptyTunnelDataMsg (true);
|
||||
|
|
|
@ -33,11 +33,13 @@ namespace tunnel
|
|||
const i2p::crypto::AESKey& layerKey, const i2p::crypto::AESKey& ivKey);
|
||||
|
||||
virtual size_t GetNumTransmittedBytes () const { return 0; };
|
||||
virtual std::string GetNextPeerName () const;
|
||||
|
||||
// implements TunnelBase
|
||||
void SendTunnelDataMsg (std::shared_ptr<i2p::I2NPMessage> msg) override;
|
||||
void HandleTunnelDataMsg (std::shared_ptr<i2p::I2NPMessage>&& tunnelMsg) override;
|
||||
void EncryptTunnelMsg (std::shared_ptr<const I2NPMessage> in, std::shared_ptr<I2NPMessage> out) override;
|
||||
|
||||
private:
|
||||
|
||||
i2p::crypto::AESKey m_LayerKey, m_IVKey;
|
||||
|
@ -56,6 +58,7 @@ namespace tunnel
|
|||
~TransitTunnelParticipant ();
|
||||
|
||||
size_t GetNumTransmittedBytes () const override { return m_NumTransmittedBytes; };
|
||||
std::string GetNextPeerName () const override;
|
||||
void HandleTunnelDataMsg (std::shared_ptr<i2p::I2NPMessage>&& tunnelMsg) override;
|
||||
void FlushTunnelDataMsgs () override;
|
||||
|
||||
|
@ -79,6 +82,7 @@ namespace tunnel
|
|||
void SendTunnelDataMsg (std::shared_ptr<i2p::I2NPMessage> msg) override;
|
||||
void FlushTunnelDataMsgs () override;
|
||||
size_t GetNumTransmittedBytes () const override { return m_Gateway.GetNumSentBytes (); };
|
||||
std::string GetNextPeerName () const override;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -100,6 +104,7 @@ namespace tunnel
|
|||
|
||||
void HandleTunnelDataMsg (std::shared_ptr<i2p::I2NPMessage>&& tunnelMsg) override;
|
||||
size_t GetNumTransmittedBytes () const override { return m_Endpoint.GetNumReceivedBytes (); }
|
||||
std::string GetNextPeerName () const override { return ""; }
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -151,6 +151,7 @@ namespace transport
|
|||
};
|
||||
virtual void SendI2NPMessages (std::list<std::shared_ptr<I2NPMessage> >& msgs) = 0;
|
||||
virtual bool IsEstablished () const = 0;
|
||||
virtual i2p::data::RouterInfo::SupportedTransports GetTransportType () const = 0;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -60,5 +60,11 @@ namespace tunnel
|
|||
msgs.swap (msgs1);
|
||||
SendMessagesTo (to, std::move (msgs1));
|
||||
}
|
||||
|
||||
void TunnelTransportSender::Reset ()
|
||||
{
|
||||
m_CurrentTransport.reset ();
|
||||
m_PendingTransport = std::future<std::shared_ptr<i2p::transport::TransportSession> >();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,9 @@ namespace tunnel
|
|||
void SendMessagesTo (const i2p::data::IdentHash& to, std::list<std::shared_ptr<I2NPMessage> >&& msgs);
|
||||
void SendMessagesTo (const i2p::data::IdentHash& to, std::list<std::shared_ptr<I2NPMessage> >& msgs); // send and clear
|
||||
|
||||
std::shared_ptr<const i2p::transport::TransportSession> GetCurrentTransport () const { return m_CurrentTransport.lock (); }
|
||||
void Reset ();
|
||||
|
||||
private:
|
||||
|
||||
std::weak_ptr<i2p::transport::TransportSession> m_CurrentTransport;
|
||||
|
|
|
@ -51,6 +51,7 @@ namespace tunnel
|
|||
void PutTunnelDataMsg (const TunnelMessageBlock& block);
|
||||
void SendBuffer ();
|
||||
size_t GetNumSentBytes () const { return m_NumSentBytes; };
|
||||
const std::unique_ptr<TunnelTransportSender>& GetSender () const { return m_Sender; };
|
||||
|
||||
private:
|
||||
|
||||
|
|
Loading…
Reference in a new issue