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 @@ -127,7 +127,7 @@ namespace i2p
i2p::stream::StreamingDestination * localDestination = nullptr;
std::string ircKeys = i2p::util::config::GetArg("-irckeys", "");
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,
i2p::util::config::GetArg("-ircport", 6668), localDestination);
d.ircTunnel->Start ();
@ -136,7 +136,7 @@ namespace i2p @@ -136,7 +136,7 @@ namespace i2p
std::string eepKeys = i2p::util::config::GetArg("-eepkeys", "");
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 (),
i2p::util::config::GetArg("-eephost", "127.0.0.1"), i2p::util::config::GetArg("-eepport", 80),
localDestination);

14
Streaming.cpp

@ -519,8 +519,8 @@ namespace stream @@ -519,8 +519,8 @@ namespace stream
LogPrint ("Local address ", GetIdentHash ().ToBase32 (), ".b32.i2p created");
}
StreamingDestination::StreamingDestination (boost::asio::io_service& service, const std::string& fullPath):
m_Service (service), m_LeaseSet (nullptr), m_IsPublic (true)
StreamingDestination::StreamingDestination (boost::asio::io_service& service, const std::string& fullPath, bool isPublic):
m_Service (service), m_LeaseSet (nullptr), m_IsPublic (isPublic)
{
std::ifstream s(fullPath.c_str (), std::ifstream::binary);
if (s.is_open ())
@ -704,7 +704,7 @@ namespace stream @@ -704,7 +704,7 @@ namespace stream
#else
it->path();
#endif
auto localDestination = new StreamingDestination (m_Service, fullPath);
auto localDestination = new StreamingDestination (m_Service, fullPath, true);
m_Destinations[localDestination->GetIdentHash ()] = localDestination;
numDestinations++;
}
@ -713,9 +713,9 @@ namespace stream @@ -713,9 +713,9 @@ namespace stream
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;
return localDestination;
}
@ -840,9 +840,9 @@ namespace stream @@ -840,9 +840,9 @@ namespace stream
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 ()

6
Streaming.h

@ -143,7 +143,7 @@ namespace stream @@ -143,7 +143,7 @@ namespace stream
public:
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 ();
@ -202,7 +202,7 @@ namespace stream @@ -202,7 +202,7 @@ namespace stream
void DeleteLocalDestination (StreamingDestination * destination);
StreamingDestination * GetLocalDestination (const i2p::data::PrivateKeys& keys, bool isPublic);
StreamingDestination * FindLocalDestination (const i2p::data::IdentHash& destination) const;
StreamingDestination * LoadLocalDestination (const std::string& filename);
StreamingDestination * LoadLocalDestination (const std::string& filename, bool isPublic);
private:
@ -234,7 +234,7 @@ namespace stream @@ -234,7 +234,7 @@ namespace stream
void DeleteLocalDestination (StreamingDestination * destination);
StreamingDestination * GetLocalDestination (const i2p::data::PrivateKeys& keys, bool isPublic = true);
StreamingDestination * FindLocalDestination (const i2p::data::IdentHash& destination);
StreamingDestination * LoadLocalDestination (const std::string& filename);
StreamingDestination * LoadLocalDestination (const std::string& filename, bool isPublic);
// for HTTP
const StreamingDestinations& GetLocalDestinations ();

Loading…
Cancel
Save