|
Electroneum
|
Client support for socks connect and resolve commands. More...
#include <socks.h>

Classes | |
| struct | async_close |
| struct | completed |
| struct | read |
| struct | write |
Public Types | |
| using | stream_type = boost::asio::ip::tcp |
Public Member Functions | |
| client (stream_type::socket &&proxy, socks::version ver) | |
| client (const client &)=delete | |
| virtual | ~client () |
| client & | operator= (const client &)=delete |
| stream_type::socket | take_socket () |
| socks::version | socks_version () const noexcept |
| epee::span< const std::uint8_t > | buffer () const noexcept |
| void | clear_command () noexcept |
| bool | set_connect_command (const epee::net_utils::ipv4_network_address &address) |
Try to set address as remote connection request. More... | |
| bool | set_connect_command (boost::string_ref domain, std::uint16_t port) |
Try to set domain + port as remote connection request. More... | |
| bool | set_connect_command (const net::tor_address &address) |
Try to set address as remote Tor hidden service connection request. More... | |
| bool | set_connect_command (const net::i2p_address &address) |
Try to set address as remote i2p hidden service connection request. More... | |
| bool | set_resolve_command (boost::string_ref domain) |
Try to set domain as remote DNS A record lookup request. More... | |
Static Public Member Functions | |
| static bool | connect_and_send (std::shared_ptr< client > self, const stream_type::endpoint &proxy_address) |
| static bool | send (std::shared_ptr< client > self) |
Private Member Functions | |
| virtual void | done (boost::system::error_code error, std::shared_ptr< client > self)=0 |
Private Attributes | |
| boost::asio::ip::tcp::socket | proxy_ |
| boost::asio::io_service::strand | strand_ |
| std::uint16_t | buffer_size_ |
| std::uint8_t | buffer_ [1024] |
| socks::version | ver_ |
Client support for socks connect and resolve commands.
| using net::socks::client::stream_type = boost::asio::ip::tcp |
|
explicit |
| proxy | ownership is passed into this. Does not have to be in connected state. |
| ver | socks version for the connection. |
|
delete |
|
virtual |
|
inlinenoexcept |
|
inlinenoexcept |
buffer.empty().
|
static |
Asynchronously connect to proxy_address then issue command in buffer(). The done(...) method will be invoked upon completion with self and potential errors.
self->set_*_command calls before using this function. async_close can be invoked on self until the done callback is invoked.| self | ownership of object is given to function. |
| proxy_address | of the socks server. |
self->buffer().empty() (no command set).
|
privatepure virtual |
Only invoked after *send(...) function completes or fails. bool(error) == false indicates success; self.get() is always this and allows implementations to skip std::enable_shared_from_this<T> (ASIO callbacks need shared_ptr). The design saves space and reduces cycles (everything uses moves, so no atomic operations are ever necessary).
| error | when processing last command (if any). |
| self | shared_ptr<client> handle to this. |
Implemented in net::socks::connect_client< Handler >.
Assume existing connection to proxy server; asynchronously issue command in buffer(). The done(...) method will be invoked upon completion with self and potential errors.
self->set_*_command calls before using the function. async_close can be invoked on self until the done callback is invoked.| self | ownership of object is given to function. |
self->buffer().empty() (no command set). | bool net::socks::client::set_connect_command | ( | boost::string_ref | domain, |
| std::uint16_t | port | ||
| ) |
Try to set domain + port as remote connection request.
| bool net::socks::client::set_connect_command | ( | const epee::net_utils::ipv4_network_address & | address | ) |
Try to set address as remote connection request.
| bool net::socks::client::set_connect_command | ( | const net::i2p_address & | address | ) |
Try to set address as remote i2p hidden service connection request.
| bool net::socks::client::set_connect_command | ( | const net::tor_address & | address | ) |
Try to set address as remote Tor hidden service connection request.
| bool net::socks::client::set_resolve_command | ( | boost::string_ref | domain | ) |
Try to set domain as remote DNS A record lookup request.
|
inlinenoexcept |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |