32#include <boost/asio/io_context.hpp>
33#include <boost/asio/ip/tcp.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>
96 boost::asio::strand<boost::asio::ip::tcp::socket::executor_type>
strand_;
112 virtual void done(boost::system::error_code
error, std::shared_ptr<client> self) = 0;
136 return stream_type::socket{std::move(
proxy_)};
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{});
213 template<
typename Handler>
218 virtual void done(boost::system::error_code
error, std::shared_ptr<client>)
override
231 template<
typename Handler>
232 inline std::shared_ptr<client>
235 return std::make_shared<connect_client<Handler>>(std::move(proxy), ver, std::move(handler));
245 struct is_error_code_enum<
net::socks::error>
Definition net_utils_base.h:69
Non-owning sequence of data. Does not deep copy.
Definition span.h:55
b32 i2p address; internal format not condensed/decoded.
Definition i2p_address.h:52
boost::asio::ip::tcp::socket proxy_
Definition socks.h:95
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:228
bool set_resolve_command(boost::string_ref domain)
Try to set domain as remote DNS A record lookup request.
Definition socks.cpp:285
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:230
epee::span< const std::uint8_t > buffer() const noexcept
Definition socks.h:143
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:295
client(stream_type::socket &&proxy, socks::version ver)
Definition socks.cpp:224
std::uint8_t buffer_[1024]
Definition socks.h:98
socks::version ver_
Definition socks.h:99
client & operator=(const client &)=delete
static bool send(std::shared_ptr< client > self)
Definition socks.cpp:306
socks::version socks_version() const noexcept
Definition socks.h:140
boost::asio::strand< boost::asio::ip::tcp::socket::executor_type > strand_
Definition socks.h:96
virtual void done(boost::system::error_code error, std::shared_ptr< client >) override
Definition socks.h:218
connect_client(stream_type::socket &&proxy, socks::version ver, Handler &&handler)
Definition socks.h:224
Handler handler_
Definition socks.h:216
virtual ~connect_client() override
Definition socks.h:228
Tor onion address; internal format not condensed/decoded.
Definition tor_address.h:53
Concept for receiving events from GenericReader upon parsing. The functions return true if no error o...
static epee::net_utils::http::http_simple_client_template< dummy_client > client
Definition http-client.cpp:62
#define inline
Definition inline_c.h:34
#define const
Definition ipfrdr.c:80
uint32_t address
Definition getifaddr.c:269
Definition portable_binary_archive.hpp:29
Definition abstract_http_client.h:36
TODO: (mj-xmr) This will be reduced in an another PR.
Definition byte_slice.h:40
std::shared_ptr< client > make_connect_client(client::stream_type::socket &&proxy, socks::version ver, Handler handler)
Definition socks.h:233
const boost::system::error_category & error_category() noexcept
Definition socks.cpp:144
error
Possible errors with socks communication. Defined in https://www.openssh.com/txt/socks4....
Definition socks.h:66
@ bad_write
Definition socks.h:74
@ bad_read
Definition socks.h:73
@ identd_user
Definition socks.h:71
@ rejected
Definition socks.h:69
@ unexpected_version
Definition socks.h:75
@ identd_connection
Definition socks.h:70
version
Supported socks variants.
Definition socks.h:58
@ v4a_tor
Extensions defined in Tor codebase.
Definition socks.h:61
@ v4a
Definition socks.h:60
@ v4
Definition socks.h:59
boost::system::error_code make_error_code(error value) noexcept
Definition socks.h:87
Definition net_utils_base.h:59
const GenericPointer< typename T::ValueType > T2 value
Definition pointer.h:1225
void operator()(boost::system::error_code error=boost::system::error_code{})
Definition socks.cpp:317
std::shared_ptr< client > self_
Definition socks.h:201
Calls async_close on self at destruction. NOP if nullptr.
Definition socks.h:207
std::shared_ptr< client > self
Definition socks.h:208
~close_on_exit()
Definition socks.h:209