i2pd/libi2pd_client/WebSocks.cpp

74 lines
1.2 KiB
C++
Raw Normal View History

2016-12-09 20:36:38 +00:00
#include "WebSocks.h"
#include "Log.h"
2016-12-13 14:10:39 +00:00
#include <string>
2016-12-09 20:36:38 +00:00
namespace i2p
{
namespace client
{
class WebSocksImpl
{
public:
WebSocksImpl(const std::string & addr, int port) : m_Addr(addr), m_Port(port)
2016-12-13 14:10:39 +00:00
{
}
~WebSocksImpl()
{
}
2016-12-09 20:36:38 +00:00
void Start()
{
LogPrint(eLogInfo, "[Tunnels] starting websocks tunnel at %s:%d is rejected: WebSockets is deprecated", m_Addr, m_Port);
2016-12-09 20:36:38 +00:00
}
2016-12-13 14:10:39 +00:00
void Stop()
{
}
2016-12-13 14:10:39 +00:00
void InitializeDestination(WebSocks * parent)
{
2016-12-13 14:10:39 +00:00
}
boost::asio::ip::tcp::endpoint GetLocalEndpoint()
{
return boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(m_Addr), m_Port);
}
std::string m_Addr;
int m_Port;
2016-12-09 20:36:38 +00:00
};
}
}
namespace i2p
{
namespace client
{
WebSocks::WebSocks(const std::string & addr, int port, std::shared_ptr<ClientDestination> localDestination) : m_Impl(new WebSocksImpl(addr, port))
{
m_Impl->InitializeDestination(this);
}
2016-12-09 20:36:38 +00:00
WebSocks::~WebSocks() { delete m_Impl; }
void WebSocks::Start()
{
m_Impl->Start();
GetLocalDestination()->Start();
}
boost::asio::ip::tcp::endpoint WebSocks::GetLocalEndpoint() const
{
return m_Impl->GetLocalEndpoint();
2016-12-09 20:36:38 +00:00
}
void WebSocks::Stop()
{
m_Impl->Stop();
GetLocalDestination()->Stop();
2016-12-09 20:36:38 +00:00
}
}
}