Asynchronously connect to the application server through a SOCKS5 server.
Defined in header <boost/socks/connect.hpp>
template< class AsyncStream, class CompletionToken> DEDUCED async_connect( AsyncStream& s, string_view app_domain, std::uint16_t app_port, auth_options const& opt, CompletionToken&& token);
This function establishes a connection to the application server through a SOCKS5 server. This composed operation includes the greeting, sub-negotiation, and connect steps of the SOCKS5 protocol. The application server is described as the domain name of the target host. According to the SOCKS5 protocol, this domain name is resolved on the SOCKS server. After this operation, the client can communicate with SOCKS5 proxy as if the talking to the application server.
The AsyncStream
should
be connected to a SOCKS5 server. The endpoint might contain IPv4 or IPv6
address.
boost::asio::connect(s, resolver.resolve(socks_host, socks_service)); socks_io::async_connect( s, "www.example.com", 80, "username", ec, [](error_code ec, endpoint ep) { if (!ec.failed()) { // write to the application host do_write(); } });
Name |
Description |
---|---|
|
SyncStream connected to a SOCKS server. |
|
Domain name of the application server |
|
Port of the application server |
|
Authentication options |
|
Asio CompletionToken. |
Convenience header <boost/socks.hpp>