|
|
|
@ -16,6 +16,7 @@
@@ -16,6 +16,7 @@
|
|
|
|
|
#include "HTTPServer.h" |
|
|
|
|
#include "HTTPProxy.h" |
|
|
|
|
#include "SOCKS.h" |
|
|
|
|
#include "I2PTunnel.h" |
|
|
|
|
|
|
|
|
|
namespace i2p |
|
|
|
|
{ |
|
|
|
@ -24,16 +25,19 @@ namespace i2p
@@ -24,16 +25,19 @@ namespace i2p
|
|
|
|
|
class Daemon_Singleton::Daemon_Singleton_Private |
|
|
|
|
{ |
|
|
|
|
public: |
|
|
|
|
Daemon_Singleton_Private() : httpServer(nullptr), httpProxy(nullptr), socksProxy(nullptr) { }; |
|
|
|
|
Daemon_Singleton_Private() : httpServer(nullptr), httpProxy(nullptr), |
|
|
|
|
socksProxy(nullptr), ircTunnel(nullptr) { }; |
|
|
|
|
~Daemon_Singleton_Private() { |
|
|
|
|
delete httpServer; |
|
|
|
|
delete httpProxy; |
|
|
|
|
delete socksProxy; |
|
|
|
|
delete ircTunnel; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
i2p::util::HTTPServer *httpServer; |
|
|
|
|
i2p::proxy::HTTPProxy *httpProxy; |
|
|
|
|
i2p::proxy::SOCKSProxy *socksProxy; |
|
|
|
|
i2p::stream::I2PClientTunnel * ircTunnel; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
Daemon_Singleton::Daemon_Singleton() : running(1), d(*new Daemon_Singleton_Private()) {}; |
|
|
|
@ -105,6 +109,14 @@ namespace i2p
@@ -105,6 +109,14 @@ namespace i2p
|
|
|
|
|
d.socksProxy = new i2p::proxy::SOCKSProxy(i2p::util::config::GetArg("-socksproxyport", 4447)); |
|
|
|
|
d.socksProxy->Start(); |
|
|
|
|
LogPrint("SOCKS Proxy Started"); |
|
|
|
|
std::string ircDestination = i2p::util::config::GetArg("-ircdest", ""); |
|
|
|
|
if (ircDestination.length () > 0) // ircdest is presented
|
|
|
|
|
{ |
|
|
|
|
d.ircTunnel = new i2p::stream::I2PClientTunnel (d.socksProxy->GetService (), ircDestination, |
|
|
|
|
i2p::util::config::GetArg("-ircport", 6668)); |
|
|
|
|
d.ircTunnel->Start (); |
|
|
|
|
LogPrint("IRC tunnel started"); |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -128,7 +140,15 @@ namespace i2p
@@ -128,7 +140,15 @@ namespace i2p
|
|
|
|
|
LogPrint("NetDB stoped"); |
|
|
|
|
d.httpServer->Stop(); |
|
|
|
|
LogPrint("HTTP Server stoped"); |
|
|
|
|
if (d.ircTunnel) |
|
|
|
|
{ |
|
|
|
|
d.ircTunnel->Stop (); |
|
|
|
|
delete d.ircTunnel; |
|
|
|
|
d.ircTunnel = nullptr; |
|
|
|
|
LogPrint("IRC tunnel stoped"); |
|
|
|
|
} |
|
|
|
|
StopLog (); |
|
|
|
|
|
|
|
|
|
delete d.socksProxy; d.socksProxy = nullptr; |
|
|
|
|
delete d.httpProxy; d.httpProxy = nullptr; |
|
|
|
|
delete d.httpServer; d.httpServer = nullptr; |
|
|
|
|