add initial WebSOCKS implementation

This commit is contained in:
Jeff Becker 2016-12-09 15:36:38 -05:00
parent d0e9fe1e3e
commit 0d83a34cfd
6 changed files with 458 additions and 2 deletions

View file

@ -27,6 +27,7 @@
#include "Event.h"
#include "Websocket.h"
#include "WebSocks.h"
namespace i2p
{
@ -43,6 +44,7 @@ namespace i2p
std::unique_ptr<i2p::transport::UPnP> UPnP;
#ifdef WITH_EVENTS
std::unique_ptr<i2p::event::WebsocketServer> m_WebsocketServer;
std::unique_ptr<i2p::client::WebSocks> m_WebSocksServer;
#endif
};
@ -307,6 +309,14 @@ namespace i2p
d.m_WebsocketServer->Start();
i2p::event::core.SetListener(d.m_WebsocketServer->ToListener());
}
bool websocks; i2p::config::GetOption("websocks.enabled", websocks);
if (websocks) {
std::string websocksAddr; i2p::config::GetOption("websocks.address", websocksAddr);
uint16_t websocksPort; i2p::config::GetOption("websocks.port", websocksPort);
LogPrint(eLogInfo, "Daemon: starting up WebSOCKS server at ", websocksAddr, ":", websocksPort);
d.m_WebSocksServer = std::unique_ptr<i2p::client::WebSocks>(new i2p::client::WebSocks(websocksAddr, websocksPort));
d.m_WebSocksServer->Start();
}
#endif
return true;