mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
IRC tunnel support
This commit is contained in:
parent
a405a3a89a
commit
d8918edb51
24
Daemon.cpp
24
Daemon.cpp
@ -16,6 +16,7 @@
|
||||
#include "HTTPServer.h"
|
||||
#include "HTTPProxy.h"
|
||||
#include "SOCKS.h"
|
||||
#include "I2PTunnel.h"
|
||||
|
||||
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
|
||||
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
|
||||
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;
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user