Browse Source

don't publish local destination of client I2PTunnel

pull/102/head
orignal 10 years ago
parent
commit
3cb4588904
  1. 4
      Daemon.cpp
  2. 14
      Streaming.cpp
  3. 6
      Streaming.h

4
Daemon.cpp

@ -127,7 +127,7 @@ namespace i2p
i2p::stream::StreamingDestination * localDestination = nullptr; i2p::stream::StreamingDestination * localDestination = nullptr;
std::string ircKeys = i2p::util::config::GetArg("-irckeys", ""); std::string ircKeys = i2p::util::config::GetArg("-irckeys", "");
if (ircKeys.length () > 0) if (ircKeys.length () > 0)
localDestination = i2p::stream::LoadLocalDestination (ircKeys); localDestination = i2p::stream::LoadLocalDestination (ircKeys, false);
d.ircTunnel = new i2p::stream::I2PClientTunnel (d.socksProxy->GetService (), ircDestination, d.ircTunnel = new i2p::stream::I2PClientTunnel (d.socksProxy->GetService (), ircDestination,
i2p::util::config::GetArg("-ircport", 6668), localDestination); i2p::util::config::GetArg("-ircport", 6668), localDestination);
d.ircTunnel->Start (); d.ircTunnel->Start ();
@ -136,7 +136,7 @@ namespace i2p
std::string eepKeys = i2p::util::config::GetArg("-eepkeys", ""); std::string eepKeys = i2p::util::config::GetArg("-eepkeys", "");
if (eepKeys.length () > 0) // eepkeys file is presented if (eepKeys.length () > 0) // eepkeys file is presented
{ {
auto localDestination = i2p::stream::LoadLocalDestination (eepKeys); auto localDestination = i2p::stream::LoadLocalDestination (eepKeys, true);
d.serverTunnel = new i2p::stream::I2PServerTunnel (d.socksProxy->GetService (), d.serverTunnel = new i2p::stream::I2PServerTunnel (d.socksProxy->GetService (),
i2p::util::config::GetArg("-eephost", "127.0.0.1"), i2p::util::config::GetArg("-eepport", 80), i2p::util::config::GetArg("-eephost", "127.0.0.1"), i2p::util::config::GetArg("-eepport", 80),
localDestination); localDestination);

14
Streaming.cpp

@ -519,8 +519,8 @@ namespace stream
LogPrint ("Local address ", GetIdentHash ().ToBase32 (), ".b32.i2p created"); LogPrint ("Local address ", GetIdentHash ().ToBase32 (), ".b32.i2p created");
} }
StreamingDestination::StreamingDestination (boost::asio::io_service& service, const std::string& fullPath): StreamingDestination::StreamingDestination (boost::asio::io_service& service, const std::string& fullPath, bool isPublic):
m_Service (service), m_LeaseSet (nullptr), m_IsPublic (true) m_Service (service), m_LeaseSet (nullptr), m_IsPublic (isPublic)
{ {
std::ifstream s(fullPath.c_str (), std::ifstream::binary); std::ifstream s(fullPath.c_str (), std::ifstream::binary);
if (s.is_open ()) if (s.is_open ())
@ -704,7 +704,7 @@ namespace stream
#else #else
it->path(); it->path();
#endif #endif
auto localDestination = new StreamingDestination (m_Service, fullPath); auto localDestination = new StreamingDestination (m_Service, fullPath, true);
m_Destinations[localDestination->GetIdentHash ()] = localDestination; m_Destinations[localDestination->GetIdentHash ()] = localDestination;
numDestinations++; numDestinations++;
} }
@ -713,9 +713,9 @@ namespace stream
LogPrint (numDestinations, " local destinations loaded"); LogPrint (numDestinations, " local destinations loaded");
} }
StreamingDestination * StreamingDestinations::LoadLocalDestination (const std::string& filename) StreamingDestination * StreamingDestinations::LoadLocalDestination (const std::string& filename, bool isPublic)
{ {
auto localDestination = new StreamingDestination (m_Service, i2p::util::filesystem::GetFullPath (filename)); auto localDestination = new StreamingDestination (m_Service, i2p::util::filesystem::GetFullPath (filename), isPublic);
m_Destinations[localDestination->GetIdentHash ()] = localDestination; m_Destinations[localDestination->GetIdentHash ()] = localDestination;
return localDestination; return localDestination;
} }
@ -840,9 +840,9 @@ namespace stream
return destinations.FindLocalDestination (destination); return destinations.FindLocalDestination (destination);
} }
StreamingDestination * LoadLocalDestination (const std::string& filename) StreamingDestination * LoadLocalDestination (const std::string& filename, bool isPublic)
{ {
return destinations.LoadLocalDestination (filename); return destinations.LoadLocalDestination (filename, isPublic);
} }
const StreamingDestinations& GetLocalDestinations () const StreamingDestinations& GetLocalDestinations ()

6
Streaming.h

@ -143,7 +143,7 @@ namespace stream
public: public:
StreamingDestination (boost::asio::io_service& service, bool isPublic); StreamingDestination (boost::asio::io_service& service, bool isPublic);
StreamingDestination (boost::asio::io_service& service, const std::string& fullPath); StreamingDestination (boost::asio::io_service& service, const std::string& fullPath, bool isPublic);
StreamingDestination (boost::asio::io_service& service, const i2p::data::PrivateKeys& keys, bool isPublic); StreamingDestination (boost::asio::io_service& service, const i2p::data::PrivateKeys& keys, bool isPublic);
~StreamingDestination (); ~StreamingDestination ();
@ -202,7 +202,7 @@ namespace stream
void DeleteLocalDestination (StreamingDestination * destination); void DeleteLocalDestination (StreamingDestination * destination);
StreamingDestination * GetLocalDestination (const i2p::data::PrivateKeys& keys, bool isPublic); StreamingDestination * GetLocalDestination (const i2p::data::PrivateKeys& keys, bool isPublic);
StreamingDestination * FindLocalDestination (const i2p::data::IdentHash& destination) const; StreamingDestination * FindLocalDestination (const i2p::data::IdentHash& destination) const;
StreamingDestination * LoadLocalDestination (const std::string& filename); StreamingDestination * LoadLocalDestination (const std::string& filename, bool isPublic);
private: private:
@ -234,7 +234,7 @@ namespace stream
void DeleteLocalDestination (StreamingDestination * destination); void DeleteLocalDestination (StreamingDestination * destination);
StreamingDestination * GetLocalDestination (const i2p::data::PrivateKeys& keys, bool isPublic = true); StreamingDestination * GetLocalDestination (const i2p::data::PrivateKeys& keys, bool isPublic = true);
StreamingDestination * FindLocalDestination (const i2p::data::IdentHash& destination); StreamingDestination * FindLocalDestination (const i2p::data::IdentHash& destination);
StreamingDestination * LoadLocalDestination (const std::string& filename); StreamingDestination * LoadLocalDestination (const std::string& filename, bool isPublic);
// for HTTP // for HTTP
const StreamingDestinations& GetLocalDestinations (); const StreamingDestinations& GetLocalDestinations ();

Loading…
Cancel
Save