2020-05-22 16:18:41 +03:00
|
|
|
/*
|
2023-06-12 05:10:32 +03:00
|
|
|
* Copyright (c) 2013-2023, The PurpleI2P Project
|
2020-05-22 16:18:41 +03:00
|
|
|
*
|
|
|
|
* 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-04 00:18:05 +03:00
|
|
|
#ifndef SOCKS_H__
|
|
|
|
#define SOCKS_H__
|
2014-07-14 20:40:06 +04:00
|
|
|
|
2014-11-23 19:33:58 +03:00
|
|
|
#include <memory>
|
2015-01-05 22:14:53 +03:00
|
|
|
#include <set>
|
2015-01-03 08:42:53 +03:00
|
|
|
#include <boost/asio.hpp>
|
2015-01-05 22:14:53 +03:00
|
|
|
#include <mutex>
|
2015-01-07 21:09:59 +03:00
|
|
|
#include "I2PService.h"
|
2014-07-14 20:40:06 +04:00
|
|
|
|
|
|
|
namespace i2p
|
|
|
|
{
|
|
|
|
namespace proxy
|
|
|
|
{
|
2015-01-08 03:45:49 +03:00
|
|
|
class SOCKSServer: public i2p::client::TCPIPAcceptor
|
2015-01-03 08:42:53 +03:00
|
|
|
{
|
2015-03-17 18:44:01 +03:00
|
|
|
public:
|
2020-03-01 13:25:50 +03:00
|
|
|
|
2023-06-12 05:10:32 +03:00
|
|
|
SOCKSServer(const std::string& name, const std::string& address, uint16_t port, bool outEnable, const std::string& outAddress, uint16_t outPort,
|
2016-01-24 17:59:02 +03:00
|
|
|
std::shared_ptr<i2p::client::ClientDestination> localDestination = nullptr);
|
2015-03-17 18:44:01 +03:00
|
|
|
~SOCKSServer() {};
|
|
|
|
|
2016-02-27 01:06:11 +03:00
|
|
|
void SetUpstreamProxy(const std::string & addr, const uint16_t port);
|
2017-07-19 00:21:02 +03:00
|
|
|
|
2015-01-08 03:45:49 +03:00
|
|
|
protected:
|
2020-03-01 13:25:50 +03:00
|
|
|
|
2015-01-08 03:45:49 +03:00
|
|
|
// Implements TCPIPAcceptor
|
2015-04-06 21:41:07 +03:00
|
|
|
std::shared_ptr<i2p::client::I2PServiceHandler> CreateHandler(std::shared_ptr<boost::asio::ip::tcp::socket> socket);
|
2017-11-14 21:20:54 +03:00
|
|
|
const char* GetName() { return m_Name.c_str (); }
|
2016-02-27 01:06:11 +03:00
|
|
|
|
2017-07-19 00:21:02 +03:00
|
|
|
private:
|
2017-11-14 21:20:54 +03:00
|
|
|
|
|
|
|
std::string m_Name;
|
2017-07-19 00:21:02 +03:00
|
|
|
std::string m_UpstreamProxyAddress;
|
|
|
|
uint16_t m_UpstreamProxyPort;
|
|
|
|
bool m_UseUpstreamProxy;
|
2015-01-05 22:14:53 +03:00
|
|
|
};
|
2014-07-14 20:40:06 +04:00
|
|
|
|
2015-01-03 23:57:15 +03:00
|
|
|
typedef SOCKSServer SOCKSProxy;
|
2014-07-14 20:40:06 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|