diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp
index d98ae12e..d7255508 100644
--- a/daemon/HTTPServer.cpp
+++ b/daemon/HTTPServer.cpp
@@ -1188,6 +1188,20 @@ namespace http {
}
s << "\r\n
\r\n";
}
+ auto& torrentsTunnels = i2p::client::context.GetTorrentsTunnels ();
+ if (!torrentsTunnels.empty ())
+ {
+ s << "
\r\n" << tr("Torrents") << ":
\r\n
\r\n";
+ for (auto& it: torrentsTunnels)
+ {
+ auto& ident = it.second->GetLocalDestination ()->GetIdentHash();
+ s << "
\r\n"<< std::endl;
+ }
+ s << "
\r\n
\r\n";
+ }
}
HTTPConnection::HTTPConnection (std::string hostname, std::shared_ptr socket):
diff --git a/libi2pd_client/ClientContext.cpp b/libi2pd_client/ClientContext.cpp
index 139f3413..a8cece86 100644
--- a/libi2pd_client/ClientContext.cpp
+++ b/libi2pd_client/ClientContext.cpp
@@ -989,7 +989,7 @@ namespace client
else
localDestination->SetPublic (true);
}
- auto torrentsTunnel = std::make_shared (localDestination, torrentsDir, trackers);
+ auto torrentsTunnel = std::make_shared (name, localDestination, torrentsDir, trackers);
auto [iit, inserted] = m_TorrentsTunnels.emplace (localDestination->GetIdentHash (), torrentsTunnel);
if (inserted)
torrentsTunnel->Start ();
diff --git a/libi2pd_client/ClientContext.h b/libi2pd_client/ClientContext.h
index a193939a..0970dd42 100644
--- a/libi2pd_client/ClientContext.h
+++ b/libi2pd_client/ClientContext.h
@@ -179,6 +179,7 @@ namespace client
const decltype(m_ServerTunnels)& GetServerTunnels () const { return m_ServerTunnels; };
const decltype(m_ClientForwards)& GetClientForwards () const { return m_ClientForwards; }
const decltype(m_ServerForwards)& GetServerForwards () const { return m_ServerForwards; }
+ const decltype(m_TorrentsTunnels)& GetTorrentsTunnels () const { return m_TorrentsTunnels; }
std::shared_ptr GetHttpProxy () const { return m_HttpProxy; }
std::shared_ptr GetSocksProxy () const { return m_SocksProxy; }
};
diff --git a/libi2pd_client/Torrents.cpp b/libi2pd_client/Torrents.cpp
index 4c7af859..2b3ef0f5 100644
--- a/libi2pd_client/Torrents.cpp
+++ b/libi2pd_client/Torrents.cpp
@@ -903,9 +903,9 @@ namespace torrents
}
}
- TorrentsTunnel::TorrentsTunnel (std::shared_ptr localDestination,
+ TorrentsTunnel::TorrentsTunnel (std::string_view name, std::shared_ptr localDestination,
std::string_view torrentsDir, std::string_view trackers):
- i2p::client::I2PService (localDestination), m_TorrentsDir (torrentsDir),
+ i2p::client::I2PService (localDestination), m_Name (name), m_TorrentsDir (torrentsDir),
m_PeerID ("-I2PD-"), m_Rng(i2p::util::GetMonotonicMicroseconds ()%1000000LL),
m_TrackerRequestsCheckTimer (GetService ()), m_KeepAliveCheckTimer (GetService ()),
m_ReconnectCheckTimer (GetService ())
diff --git a/libi2pd_client/Torrents.h b/libi2pd_client/Torrents.h
index 0c103946..62a9380a 100644
--- a/libi2pd_client/Torrents.h
+++ b/libi2pd_client/Torrents.h
@@ -229,7 +229,7 @@ namespace torrents
public:
- TorrentsTunnel (std::shared_ptr localDestination,
+ TorrentsTunnel (std::string_view name, std::shared_ptr localDestination,
std::string_view torrentsDir, std::string_view trackers = "");
void Start () override;
@@ -241,7 +241,7 @@ namespace torrents
std::shared_ptr FindTorrent (const Torrent::InfoHash& infoHash) const;
std::list > GetTorrentConnections (std::shared_ptr torrent);
- const char* GetName() const override { return "Torrents"; }
+ const char* GetName() const override { return m_Name.c_str (); }
private:
@@ -267,7 +267,7 @@ namespace torrents
private:
- std::string m_TorrentsDir, m_PeerID; // 20 characters
+ std::string m_Name, m_TorrentsDir, m_PeerID; // 20 characters
std::vector m_Trackers;
std::map > m_Torrents;
std::mt19937 m_Rng;