32 #include <boost/asio/ip/tcp.hpp>
33 #include <boost/asio/io_service.hpp>
34 #include <boost/asio/strand.hpp>
35 #include <boost/system/error_code.hpp>
36 #include <boost/type_traits/integral_constant.hpp>
37 #include <boost/utility/string_ref.hpp>
48 class ipv4_network_address;
112 virtual void done(boost::system::error_code
error, std::shared_ptr<client>
self) = 0;
180 static bool connect_and_send(std::shared_ptr<client>
self,
const stream_type::endpoint& proxy_address);
195 static bool send(std::shared_ptr<client>
self);
202 void operator()(boost::system::error_code
error = boost::system::error_code{});
206 template<
typename Handler>
211 virtual void done(boost::system::error_code
error, std::shared_ptr<client>)
override
224 template<
typename Handler>
225 inline std::shared_ptr<client>
228 return std::make_shared<connect_client<Handler>>(std::move(proxy), ver, std::move(handler));
b32 i2p address; internal format not condensed/decoded.
Definition: i2p_address.h:52
Client support for socks connect and resolve commands.
Definition: socks.h:94
boost::asio::ip::tcp::socket proxy_
Definition: socks.h:95
epee::span< const std::uint8_t > buffer() const noexcept
Definition: socks.h:143
void clear_command() noexcept
Definition: socks.h:149
boost::asio::ip::tcp stream_type
Definition: socks.h:115
client(const client &)=delete
stream_type::socket take_socket()
Definition: socks.h:134
virtual ~client()
Definition: socks.cpp:227
bool set_resolve_command(boost::string_ref domain)
Try to set domain as remote DNS A record lookup request.
Definition: socks.cpp:284
std::uint16_t buffer_size_
Definition: socks.h:97
bool set_connect_command(const epee::net_utils::ipv4_network_address &address)
Try to set address as remote connection request.
Definition: socks.cpp:229
virtual void done(boost::system::error_code error, std::shared_ptr< client > self)=0
static bool connect_and_send(std::shared_ptr< client > self, const stream_type::endpoint &proxy_address)
Definition: socks.cpp:294
client & operator=(const client &)=delete
client(stream_type::socket &&proxy, socks::version ver)
Definition: socks.cpp:223
std::uint8_t buffer_[1024]
Definition: socks.h:98
socks::version ver_
Definition: socks.h:99
boost::asio::io_service::strand strand_
Definition: socks.h:96
static bool send(std::shared_ptr< client > self)
Definition: socks.cpp:305
socks::version socks_version() const noexcept
Definition: socks.h:140
virtual void done(boost::system::error_code error, std::shared_ptr< client >) override
Definition: socks.h:211
connect_client(stream_type::socket &&proxy, socks::version ver, Handler &&handler)
Definition: socks.h:217
Handler handler_
Definition: socks.h:209
virtual ~connect_client() override
Definition: socks.h:221
Tor onion address; internal format not condensed/decoded.
Definition: tor_address.h:52
#define inline
Definition: inline_c.h:35
Definition: unordered_containers_boost_serialization.h:39
const
Definition: build_protob.py:9
Definition: cryptonote_format_utils.h:44
std::error_category const & error_category() noexcept
Definition: error.cpp:92
const boost::system::error_category & error_category() noexcept
Definition: socks.cpp:143
error
Possible errors with socks communication. Defined in https://www.openssh.com/txt/socks4....
Definition: socks.h:66
version
Supported socks variants.
Definition: socks.h:58
@ v4a_tor
Extensions defined in Tor codebase.
std::shared_ptr< client > make_connect_client(client::stream_type::socket &&proxy, socks::version ver, Handler handler)
Definition: socks.h:226
boost::system::error_code make_error_code(error value) noexcept
Definition: socks.h:87
std::unique_ptr< void, close > socket
Unique ZMQ socket handle, calls zmq_close on destruction.
Definition: zmq.h:101
char true_type
Definition: sfinae_helpers.h:39
Definition: blockchain_ancestry.cpp:73
void operator()(boost::system::error_code error=boost::system::error_code{})
Definition: socks.cpp:316
std::shared_ptr< client > self_
Definition: socks.h:201
Definition: socks.cpp:150
Definition: socks.cpp:177
Definition: socks.cpp:202