mirror of https://github.com/PurpleI2P/i2pd
parent
2f56547d5f
commit
dd8200e8b0
@ -1,72 +0,0 @@
|
|||||||
#include "WebSocks.h"
|
|
||||||
#include "Log.h"
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace i2p
|
|
||||||
{
|
|
||||||
namespace client
|
|
||||||
{
|
|
||||||
class WebSocksImpl
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
WebSocksImpl(const std::string & addr, int port) : m_Addr(addr), m_Port(port)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
~WebSocksImpl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
LogPrint(eLogInfo, "[Tunnels] starting websocks tunnel at %s:%d is rejected: WebSockets is deprecated", m_Addr, m_Port);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Stop()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void InitializeDestination(WebSocks * parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebSocks::Stop()
|
|
||||||
{
|
|
||||||
m_Impl->Stop();
|
|
||||||
GetLocalDestination()->Stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
#ifndef WEBSOCKS_H_
|
|
||||||
#define WEBSOCKS_H_
|
|
||||||
#include <string>
|
|
||||||
#include <memory>
|
|
||||||
#include "I2PService.h"
|
|
||||||
#include "Destination.h"
|
|
||||||
|
|
||||||
namespace i2p
|
|
||||||
{
|
|
||||||
namespace client
|
|
||||||
{
|
|
||||||
|
|
||||||
class WebSocksImpl;
|
|
||||||
|
|
||||||
/** @brief websocket socks proxy server */
|
|
||||||
class WebSocks : public i2p::client::I2PService
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
WebSocks(const std::string & addr, int port, std::shared_ptr<ClientDestination> localDestination);
|
|
||||||
~WebSocks();
|
|
||||||
|
|
||||||
void Start();
|
|
||||||
void Stop();
|
|
||||||
|
|
||||||
boost::asio::ip::tcp::endpoint GetLocalEndpoint() const;
|
|
||||||
|
|
||||||
const char * GetName() { return "WebSOCKS Proxy"; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
WebSocksImpl * m_Impl;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue