[clang-tidy fixes & reformating] Successful connection using Connect() overload for proxy
This commit is contained in:
parent
20e31808ba
commit
45dd66278b
2 changed files with 11 additions and 15 deletions
|
@ -423,10 +423,6 @@ struct ClientCreateVisitor {
|
|||
boost::asio::use_awaitable);
|
||||
}
|
||||
|
||||
auto Connect(auto& socket, boost::asio::ip::tcp::resolver::results_type resolveResults) -> boost::asio::awaitable<void> {
|
||||
co_await boost::asio::async_connect(socket, resolveResults, boost::asio::use_awaitable);
|
||||
}
|
||||
|
||||
template <typename Socket>
|
||||
auto Connect(Socket& socket) -> boost::asio::awaitable<void> {
|
||||
if(!std::holds_alternative<NoProxy>(this->options.proxy)) {
|
||||
|
|
|
@ -82,24 +82,24 @@ TEST(Socks5ProxyTest, ConnectViaProxy) {
|
|||
std::string expectedGreeting = "\x05\x01\x00";
|
||||
|
||||
std::array<std::uint8_t, kAvailableUdpBufferSpaceForSocks> expectedRequest{};
|
||||
std::size_t req_len = 0;
|
||||
std::size_t reqLen = 0;
|
||||
|
||||
expectedRequest[req_len++] = 0x05; // VER
|
||||
expectedRequest[req_len++] = 0x01; // CMD: CONNECT
|
||||
expectedRequest[req_len++] = 0x00; // RSV
|
||||
expectedRequest[req_len++] = 0x03; // ATYP: DOMAINNAME
|
||||
expectedRequest[reqLen++] = 0x05; // VER
|
||||
expectedRequest[reqLen++] = 0x01; // CMD: CONNECT
|
||||
expectedRequest[reqLen++] = 0x00; // RSV
|
||||
expectedRequest[reqLen++] = 0x03; // ATYP: DOMAINNAME
|
||||
|
||||
expectedRequest[req_len++] = static_cast<std::uint8_t>(targetHostname.size()); // domain length
|
||||
expectedRequest[reqLen++] = static_cast<std::uint8_t>(targetHostname.size()); // domain length
|
||||
|
||||
std::memcpy(&expectedRequest[req_len], targetHostname.data(), targetHostname.size());
|
||||
req_len += targetHostname.size();
|
||||
std::memcpy(&expectedRequest[reqLen], targetHostname.data(), targetHostname.size());
|
||||
reqLen += targetHostname.size();
|
||||
|
||||
std::uint16_t networkOrderPort = htons(targetPort);
|
||||
expectedRequest[req_len++] = static_cast<std::uint8_t>((networkOrderPort >> 8) & 0xFF);
|
||||
expectedRequest[req_len++] = static_cast<std::uint8_t>(networkOrderPort & 0xFF);
|
||||
expectedRequest[reqLen++] = static_cast<std::uint8_t>((networkOrderPort >> 8) & 0xFF);
|
||||
expectedRequest[reqLen++] = static_cast<std::uint8_t>(networkOrderPort & 0xFF);
|
||||
|
||||
std::string expectedData = expectedGreeting;
|
||||
auto transformed_view = expectedRequest | std::views::take(req_len) | std::views::transform([](std::uint8_t byte) {
|
||||
auto transformed_view = expectedRequest | std::views::take(reqLen) | std::views::transform([](std::uint8_t byte) {
|
||||
return static_cast<char>(byte);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue