Browse Source

IRC tunnel support

pull/93/head
orignal 11 years ago
parent
commit
d8918edb51
  1. 24
      Daemon.cpp
  2. 3
      README.md
  3. 1
      SOCKS.h

24
Daemon.cpp

@ -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,8 +140,16 @@ namespace i2p @@ -128,8 +140,16 @@ 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.socksProxy; d.socksProxy = nullptr;
delete d.httpProxy; d.httpProxy = nullptr;
delete d.httpServer; d.httpServer = nullptr;

3
README.md

@ -50,5 +50,8 @@ Options @@ -50,5 +50,8 @@ Options
* --log= - Enable or disable logging to file. 1 for yes, 0 for no.
* --daemon= - Eanble or disable daemon mode. 1 for yes, 0 for no.
* --httpproxyport= - The port to listen on (HTTP Proxy)
* --socksproxyport= - The port to listen on (SOCKS Proxy)
* --ircport= - The local port of IRC tunnel to listen on. 6668 by default
* --ircdest= - I2P destination address of IRC server. For example irc.postman.i2p

1
SOCKS.h

@ -73,6 +73,7 @@ namespace proxy @@ -73,6 +73,7 @@ namespace proxy
void Start();
void Stop();
boost::asio::io_service& GetService () { return m_ios; };
private:

Loading…
Cancel
Save