This project provides a fundamental Sock5 client implementation for the NodePP framework.
#include <nodepp/nodepp.h>
#include <sock5/https.h>
#include <nodepp/url.h>
using namespace nodepp;
void onMain() {
sock5_fetch_t args; ssl_t ssl;
args.timeout = 0; // Disable Fetch timeout
args.proxy = "tcp://localhost:9050" ;
args.url = "https://www.google.com/";
args.method = "GET";
args.headers = header_t({
{ "Host", url::hostname( args.url ) },
{ "User-Agent", "Sock5" }
});
sock5::https::fetch( args, &ssl )
.then([]( https_t cli ){
cli.onData([=]( string_t data ){
console::log( ">>", data );
}); stream::pipe( cli );
})
.fail([]( except_t err ){
console::log(err);
});
}