add socks proxy

This commit is contained in:
jeff 2014-07-14 12:40:06 -04:00
parent 9b4dd95b1c
commit e832002795
4 changed files with 395 additions and 8 deletions

View file

@ -15,6 +15,7 @@
#include "Streaming.h"
#include "HTTPServer.h"
#include "HTTPProxy.h"
#include "SOCKS.h"
namespace i2p
{
@ -23,14 +24,16 @@ namespace i2p
class Daemon_Singleton::Daemon_Singleton_Private
{
public:
Daemon_Singleton_Private() : httpServer(nullptr), httpProxy(nullptr) { };
Daemon_Singleton_Private() : httpServer(nullptr), httpProxy(nullptr), socksProxy(nullptr) { };
~Daemon_Singleton_Private() {
delete httpServer;
delete httpProxy;
delete socksProxy;
};
i2p::util::HTTPServer *httpServer;
i2p::proxy::HTTPProxy *httpProxy;
i2p::proxy::SOCKSProxy *socksProxy;
};
Daemon_Singleton::Daemon_Singleton() : running(1), d(*new Daemon_Singleton_Private()) {};
@ -83,7 +86,7 @@ namespace i2p
d.httpServer = new i2p::util::HTTPServer(i2p::util::config::GetArg("-httpport", 7070));
d.httpServer->Start();
LogPrint("HTTPServer started");
LogPrint("HTTP Server started");
i2p::data::netdb.Start();
LogPrint("NetDB started");
@ -98,8 +101,10 @@ namespace i2p
d.httpProxy = new i2p::proxy::HTTPProxy(i2p::util::config::GetArg("-httpproxyport", 4446));
d.httpProxy->Start();
LogPrint("Proxy started");
LogPrint("HTTP Proxy started");
d.socksProxy = new i2p::proxy::SOCKSProxy(i2p::util::config::GetArg("-socksproxyport", 4447));
d.socksProxy->Start();
LogPrint("SOCKS Proxy Started");
return true;
}
@ -108,7 +113,9 @@ namespace i2p
LogPrint("Shutdown started.");
d.httpProxy->Stop();
LogPrint("HTTPProxy stoped");
LogPrint("HTTP Proxy stoped");
d.socksProxy->Stop();
LogPrint("SOCKS Proxy stoped");
i2p::stream::StopStreaming();
LogPrint("Streaming stoped");
i2p::garlic::routing.Stop();
@ -120,9 +127,9 @@ namespace i2p
i2p::data::netdb.Stop();
LogPrint("NetDB stoped");
d.httpServer->Stop();
LogPrint("HTTPServer stoped");
LogPrint("HTTP Server stoped");
StopLog ();
delete d.socksProxy; d.socksProxy = nullptr;
delete d.httpProxy; d.httpProxy = nullptr;
delete d.httpServer; d.httpServer = nullptr;