i2pd/libi2pd_client/SOCKS.h

50 lines
1.1 KiB
C
Raw Normal View History

/*
* Copyright (c) 2013-2020, The PurpleI2P Project
*
* This file is part of Purple i2pd project and licensed under BSD3
*
* See full license text in LICENSE file at top of project tree
*/
2015-01-03 21:18:05 +00:00
#ifndef SOCKS_H__
#define SOCKS_H__
2014-07-14 16:40:06 +00:00
2014-11-23 16:33:58 +00:00
#include <memory>
#include <set>
#include <boost/asio.hpp>
#include <mutex>
#include "I2PService.h"
2014-07-14 16:40:06 +00:00
namespace i2p
{
namespace proxy
{
2015-01-08 00:45:49 +00:00
class SOCKSServer: public i2p::client::TCPIPAcceptor
{
public:
2017-11-14 18:20:54 +00:00
SOCKSServer(const std::string& name, const std::string& address, int port, bool outEnable, const std::string& outAddress, uint16_t outPort,
2016-01-24 14:59:02 +00:00
std::shared_ptr<i2p::client::ClientDestination> localDestination = nullptr);
~SOCKSServer() {};
void SetUpstreamProxy(const std::string & addr, const uint16_t port);
2017-07-18 21:21:02 +00:00
2015-01-08 00:45:49 +00:00
protected:
2015-01-08 00:45:49 +00:00
// Implements TCPIPAcceptor
std::shared_ptr<i2p::client::I2PServiceHandler> CreateHandler(std::shared_ptr<boost::asio::ip::tcp::socket> socket);
2017-11-14 18:20:54 +00:00
const char* GetName() { return m_Name.c_str (); }
2017-07-18 21:21:02 +00:00
private:
2017-11-14 18:20:54 +00:00
std::string m_Name;
2017-07-18 21:21:02 +00:00
std::string m_UpstreamProxyAddress;
uint16_t m_UpstreamProxyPort;
bool m_UseUpstreamProxy;
};
2014-07-14 16:40:06 +00:00
2015-01-03 20:57:15 +00:00
typedef SOCKSServer SOCKSProxy;
2014-07-14 16:40:06 +00:00
}
}
#endif