Asio Extensions
Additional functionality built on top of (Boost.)Asio
|
SOCKS client implementation. More...
template<typename Socket , typename DynamicBuffer , typename GreetHandler > | |
void_or_deduced | asioext::socks::async_greet (Socket &socket, const auth_method *auth_methods, std::size_t num_auth_methods, DynamicBuffer &&buffer, GreetHandler &&handler) |
Asynchronously perform a SOCKS 5 greeting with the remote SOCKS server. More... | |
template<typename Socket , typename DynamicBuffer , typename LoginHandler > | |
void_or_deduced | asioext::socks::async_login (Socket &socket, const std::string &username, const std::string &password, DynamicBuffer &&buffer, LoginHandler &&handler) |
Asynchronously attempt a login on the remote SOCKS 5 server. More... | |
template<typename Socket , typename DynamicBuffer , typename ExecuteHandler > | |
void_or_deduced | asioext::socks::async_execute (Socket &socket, command cmd, const asio::ip::tcp::endpoint &remote, DynamicBuffer &&buffer, ExecuteHandler &&handler) |
Asynchronously attempt to execute the given command. More... | |
template<typename Socket , typename DynamicBuffer , typename ExecuteHandler > | |
void_or_deduced | asioext::socks::async_execute (Socket &socket, command cmd, const std::string &remote, uint16_t port, DynamicBuffer &&buffer, ExecuteHandler &&handler) |
Asynchronously attempt to execute the given command. More... | |
enum | asioext::socks::command : uint8_t { asioext::socks::command::connect = 1, asioext::socks::command::bind = 2, asioext::socks::command::bind_udp = 3 } |
SOCKS commands. More... | |
enum | asioext::socks::version : uint8_t { asioext::socks::version::v4, asioext::socks::version::v5 } |
SOCKS versions. More... | |
enum | asioext::socks::auth_method : uint8_t { asioext::socks::auth_method::none = 0, asioext::socks::auth_method::gssapi = 1, asioext::socks::auth_method::username_password = 2, asioext::socks::auth_method::no_acceptable = 0xff } |
SOCKS login authentication methods. More... | |
enum | asioext::socks::error { asioext::socks::error::none = 0, asioext::socks::error::invalid_version, asioext::socks::error::no_acceptable_auth_method, asioext::socks::error::invalid_auth_version, asioext::socks::error::login_failed, asioext::socks::error::command_not_supported } |
SOCKS-specific error codes. More... | |
const error_category & | asioext::socks::get_error_category () noexcept |
Get the error_category for error . More... | |
error_code | asioext::socks::make_error_code (error e) noexcept |
SOCKS client implementation.
This module contains functions to establish a SOCKS client session on a stream socket.
|
strong |
SOCKS login authentication methods.
This enum contains the authentication methods listed in the protocol specification.
Enumerator | |
---|---|
none | No authentication. If sent by the client, indicates that the client supports/allows anonymous access to a SOCKS server. |
gssapi | GSSAPI authentication.
|
username_password | Username + Password authentication. Indicates that the client wishes to authenticate the user with a username and password pair.
|
no_acceptable | Server response if no acceptable method was given. This special enum value is used in case the server rejects all authentication methods it was given. |
|
strong |
|
strong |
SOCKS-specific error codes.
Enumerator | |
---|---|
none | No error. |
invalid_version | SOCKS version mismatch between server and client. Used in case the client receives a packet with a different |
no_acceptable_auth_method | Server supports none of our authentication methods. Used in case the server rejects all of our proposed authentication methods
|
invalid_auth_version | Authentication type version mismatch between client and server. The version of the agreed-on authentication scheme is different on the server. |
login_failed | The server rejected our login attempt. |
command_not_supported | The SOCKS The server doesn't understand the |
|
strong |
void_or_deduced asioext::socks::async_execute | ( | Socket & | socket, |
command | cmd, | ||
const asio::ip::tcp::endpoint & | remote, | ||
DynamicBuffer && | buffer, | ||
ExecuteHandler && | handler | ||
) |
Asynchronously attempt to execute the given command.
This function asynchronously executes the given SOCKS command. The following commands are supported by a SOCKS 5 server:
connect:
Establish a connection to the given remote endpoint. Any data sent/received on the socket after successful command execution belongs to the proxied connection.socket | The connected socket. The remote endpoint needs to be a successfully greeted SOCKS 5 proxy. |
cmd | The command to execute. |
remote | The remote endpoint. |
buffer | A linear_buffer that is used to buffer sent/received messages. |
handler | The handler to be called when the execute operation completes. The function signature of the handler must be: |
void_or_deduced asioext::socks::async_execute | ( | Socket & | socket, |
command | cmd, | ||
const std::string & | remote, | ||
uint16_t | port, | ||
DynamicBuffer && | buffer, | ||
ExecuteHandler && | handler | ||
) |
Asynchronously attempt to execute the given command.
This function asynchronously executes the given SOCKS command. The following commands are supported by a SOCKS 5 server:
connect:
Establish a connection to the given remote endpoint. Any data sent/received on the socket after successful command execution belongs to the proxied connection.socket | The connected socket. The remote endpoint needs to be a successfully greeted SOCKS 5 proxy. |
cmd | The command to execute. |
remote | Hostname of the remote endpoint. |
port | Port of the remote endpoint. |
buffer | A linear_buffer that is used to buffer sent/received messages. |
handler | The handler to be called when the execute operation completes. The function signature of the handler must be: |
void_or_deduced asioext::socks::async_greet | ( | Socket & | socket, |
const auth_method * | auth_methods, | ||
std::size_t | num_auth_methods, | ||
DynamicBuffer && | buffer, | ||
GreetHandler && | handler | ||
) |
Asynchronously perform a SOCKS 5 greeting with the remote SOCKS server.
This function attempts to perform a SOCKS 5 greeting on the given socket which needs to be connected to the remote proxy server you wish to "greet".
socket | The connected socket. The remote endpoint needs to be a SOCKS 5 proxy. |
auth_methods | Array containing the allowed authentication methods. |
num_auth_methods | Number of authentication methods entries. |
buffer | A DynamicBuffer that is used to buffer sent/received messages. |
handler | The handler to be called when the greet operation completes. The function signature of the handler must be: void handler( // Result of operation. // Authentication method chosen by the remote end. auth_method chosen_method ); |
void_or_deduced asioext::socks::async_login | ( | Socket & | socket, |
const std::string & | username, | ||
const std::string & | password, | ||
DynamicBuffer && | buffer, | ||
LoginHandler && | handler | ||
) |
Asynchronously attempt a login on the remote SOCKS 5 server.
This function attempts to log in to the remote SOCKS 5 server with the given credentials. The given socket must be connected to a SOCKS 5 proxy server and the initial greeting must have resulted in the user/password authentication scheme being chosen.
socket | The connected socket. The remote endpoint needs to be a successfully greeted SOCKS 5 proxy. |
username | Username on the remote end. |
password | Password of the remote user. |
buffer | A linear_buffer that is used to buffer sent/received messages. |
handler | The handler to be called when the login operation completes. The function signature of the handler must be: |
|
noexcept |
Get the error_category
for error
.
|
inlinenoexcept |