Browse Source

cleanup websocks

Signed-off-by: R4SAS <r4sas@i2pmail.org>
pull/1499/head
R4SAS 5 years ago
parent
commit
dd8200e8b0
Signed by: r4sas
GPG Key ID: 66F6C87B98EBCFE2
  1. 1
      build/CMakeLists.txt
  2. 2
      filelist.mk
  3. 7
      libi2pd_client/ClientContext.cpp
  4. 72
      libi2pd_client/WebSocks.cpp
  5. 34
      libi2pd_client/WebSocks.h
  6. 2
      qt/i2pd_qt/i2pd_qt.pro

1
build/CMakeLists.txt

@ -117,7 +117,6 @@ set (CLIENT_SRC @@ -117,7 +117,6 @@ set (CLIENT_SRC
"${LIBI2PD_CLIENT_SRC_DIR}/SOCKS.cpp"
"${LIBI2PD_CLIENT_SRC_DIR}/HTTPProxy.cpp"
"${LIBI2PD_CLIENT_SRC_DIR}/I2CP.cpp"
"${LIBI2PD_CLIENT_SRC_DIR}/WebSocks.cpp"
)
add_library(libi2pdclient ${CLIENT_SRC})

2
filelist.mk

@ -11,7 +11,7 @@ LIB_SRC = $(wildcard $(LIB_SRC_DIR)/*.cpp) @@ -11,7 +11,7 @@ LIB_SRC = $(wildcard $(LIB_SRC_DIR)/*.cpp)
#LIB_CLIENT_SRC = \
# AddressBook.cpp BOB.cpp ClientContext.cpp I2PTunnel.cpp I2PService.cpp MatchedDestination.cpp \
# SAM.cpp SOCKS.cpp HTTPProxy.cpp I2CP.cpp WebSocks.cpp
# SAM.cpp SOCKS.cpp HTTPProxy.cpp I2CP.cpp
LIB_CLIENT_SRC = $(wildcard $(LIB_CLIENT_SRC_DIR)/*.cpp)

7
libi2pd_client/ClientContext.cpp

@ -9,7 +9,6 @@ @@ -9,7 +9,6 @@
#include "util.h"
#include "ClientContext.h"
#include "SOCKS.h"
#include "WebSocks.h"
#include "MatchedDestination.h"
namespace i2p
@ -598,10 +597,8 @@ namespace client @@ -598,10 +597,8 @@ namespace client
}
else if (type == I2P_TUNNELS_SECTION_TYPE_WEBSOCKS)
{
// websocks proxy
auto tun = std::make_shared<WebSocks>(address, port, localDestination);
clientTunnel = tun;
clientEndpoint = tun->GetLocalEndpoint();
LogPrint(eLogError, "Clients: I2P Client tunnel websocks is deprecated");
continue;
}
else
{

72
libi2pd_client/WebSocks.cpp

@ -1,72 +0,0 @@ @@ -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();
}
}
}

34
libi2pd_client/WebSocks.h

@ -1,34 +0,0 @@ @@ -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

2
qt/i2pd_qt/i2pd_qt.pro

@ -73,7 +73,6 @@ SOURCES += DaemonQT.cpp mainwindow.cpp \ @@ -73,7 +73,6 @@ SOURCES += DaemonQT.cpp mainwindow.cpp \
../../libi2pd_client/MatchedDestination.cpp \
../../libi2pd_client/SAM.cpp \
../../libi2pd_client/SOCKS.cpp \
../../libi2pd_client/WebSocks.cpp \
../../daemon/Daemon.cpp \
../../daemon/HTTPServer.cpp \
../../daemon/I2PControl.cpp \
@ -162,7 +161,6 @@ HEADERS += DaemonQT.h mainwindow.h \ @@ -162,7 +161,6 @@ HEADERS += DaemonQT.h mainwindow.h \
../../libi2pd_client/MatchedDestination.h \
../../libi2pd_client/SAM.h \
../../libi2pd_client/SOCKS.h \
../../libi2pd_client/WebSocks.h \
../../daemon/Daemon.h \
../../daemon/HTTPServer.h \
../../daemon/I2PControl.h \

Loading…
Cancel
Save