Skip to content

Commit

Permalink
v2.10.12
Browse files Browse the repository at this point in the history
  • Loading branch information
bernerdad committed Jun 17, 2024
1 parent 90a5cc3 commit a5f9d0c
Show file tree
Hide file tree
Showing 11 changed files with 184 additions and 62 deletions.
7 changes: 7 additions & 0 deletions client/common/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2.10.12 (11/06/2024)
All:
* Improved OpenVPN and WireGuard anti-censorship. #1023
* Improved wsnet to use TLS padding when anti-censorship is enabled. #1024
* Fixed wsnet thread synchronization issue that could cause a crash. #1027


2.10.11 (03/06/2024)
All:
* Fixed wsnet bug sometimes causing the library to freeze. #1012
Expand Down
6 changes: 3 additions & 3 deletions client/common/version/windscribe_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#define WINDSCRIBE_MAJOR_VERSION 2
#define WINDSCRIBE_MINOR_VERSION 10
#define WINDSCRIBE_BUILD_VERSION 11
#define WINDSCRIBE_BUILD_VERSION 12

// only one of these should be enabled; neither -> stable
//#define WINDSCRIBE_IS_BETA
#define WINDSCRIBE_IS_GUINEA_PIG
#define WINDSCRIBE_IS_BETA
//#define WINDSCRIBE_IS_GUINEA_PIG

#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
Expand Down
4 changes: 2 additions & 2 deletions client/engine/engine/connectionmanager/connectionmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ QString ConnectionManager::udpStuffingWithNtp(const QString &ip, const quint16 p
// Send "secret" packet first
udpSocket.writeDatagram(simpleBuf, sizeof(simpleBuf), QHostAddress(ip), port);

// Send NTP packet, repeat up to 5 times. Bounded argument is exclusive.
for (int i=0; i<=QRandomGenerator::global()->bounded(5); i++) {
// Send NTP packet, repeat up to 40 times. Bounded argument is exclusive.
for (int i=0; i<=20+QRandomGenerator::global()->bounded(20); i++) {
*ntpRand = QRandomGenerator::global()->generate64();
udpSocket.writeDatagram(ntpBuf, sizeof(ntpBuf), QHostAddress(ip), port);
}
Expand Down
26 changes: 15 additions & 11 deletions libs/wsnet/src/httpnetworkmanager/curlnetworkmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,26 @@ void CurlNetworkManager::run()

curl_off_t totalTime;
curl_easy_getinfo(curlEasyHandle, CURLINFO_TOTAL_TIME_T, &totalTime);
curl_multi_remove_handle(multiHandle_, curlEasyHandle);

std::uint64_t id = *pointerId;
auto it = activeRequests_.find(id);
assert(it != activeRequests_.end());
assert(it->second->curlEasyHandle == curlEasyHandle);
CURLcode result = curlMsg->data.result;

if (curlMsg->data.result != CURLE_OK) {
spdlog::debug("Curl request error: {}", curl_easy_strerror(curlMsg->data.result));
if (result != CURLE_OK) {
spdlog::debug("Curl request error: {}", curl_easy_strerror(result));
}

finishedCallback_(id, curlMsg->data.result == CURLE_OK);

std::uint64_t id;
//remove request from activeRequests
curl_multi_remove_handle(multiHandle_, curlEasyHandle);
delete it->second;
activeRequests_.erase(id);
{
std::lock_guard locker(mutex_);
id = *pointerId;
auto it = activeRequests_.find(id);
assert(it != activeRequests_.end());
assert(it->second->curlEasyHandle == curlEasyHandle);
delete it->second;
activeRequests_.erase(id);
}
finishedCallback_(id, result == CURLE_OK);
}
} while(curlMsg);

Expand Down
7 changes: 4 additions & 3 deletions libs/wsnet/src/pingmanager/pingmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@

namespace wsnet {

PingManager::PingManager(boost::asio::io_context &io_context, WSNetHttpNetworkManager *httpNetworkManager) :
PingManager::PingManager(boost::asio::io_context &io_context, WSNetHttpNetworkManager *httpNetworkManager, WSNetAdvancedParameters *advancedParameters) :
io_context_(io_context),
httpNetworkManager_(httpNetworkManager)
httpNetworkManager_(httpNetworkManager),
advancedParameters_(advancedParameters)
{

#ifndef _WIN32
Expand Down Expand Up @@ -82,7 +83,7 @@ void PingManager::onPingMethodFinished(std::uint64_t id)
IPingMethod *PingManager::createPingMethod(std::uint64_t id, const std::string &ip, const std::string &hostname, PingType pingType, PingFinishedCallback callback)
{
if (pingType == PingType::kHttp) {
return new PingMethodHttp(httpNetworkManager_, id, ip, hostname, false, callback, std::bind(&PingManager::onPingMethodFinished, this, std::placeholders::_1));
return new PingMethodHttp(httpNetworkManager_, id, ip, hostname, false, callback, std::bind(&PingManager::onPingMethodFinished, this, std::placeholders::_1), advancedParameters_);
} else if (pingType == PingType::kIcmp) {

#ifdef _WIN32
Expand Down
4 changes: 3 additions & 1 deletion libs/wsnet/src/pingmanager/pingmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <boost/asio.hpp>
#include "WSNetPingManager.h"
#include "WSNetHttpNetworkManager.h"
#include "WSNetAdvancedParameters.h"
#include "ipingmethod.h"

#ifdef _WIN32
Expand All @@ -19,7 +20,7 @@ namespace wsnet {
class PingManager : public WSNetPingManager
{
public:
explicit PingManager(boost::asio::io_context &io_context, WSNetHttpNetworkManager *httpNetworkManager);
explicit PingManager(boost::asio::io_context &io_context, WSNetHttpNetworkManager *httpNetworkManager, WSNetAdvancedParameters *advancedParameters);
virtual ~PingManager();

std::shared_ptr<WSNetCancelableCallback> ping(const std::string &ip, const std::string &hostname,
Expand All @@ -30,6 +31,7 @@ class PingManager : public WSNetPingManager
private:
boost::asio::io_context &io_context_;
WSNetHttpNetworkManager *httpNetworkManager_;
WSNetAdvancedParameters *advancedParameters_;

#ifdef _WIN32
// Required for ICMP pings for Windows system
Expand Down
6 changes: 4 additions & 2 deletions libs/wsnet/src/pingmanager/pingmethod_http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
namespace wsnet {

PingMethodHttp::PingMethodHttp(WSNetHttpNetworkManager *httpNetworkManager, std::uint64_t id, const std::string &ip, const std::string &hostname, bool isParallelPing,
PingFinishedCallback callback, PingMethodFinishedCallback pingMethodFinishedCallback) :
PingFinishedCallback callback, PingMethodFinishedCallback pingMethodFinishedCallback, WSNetAdvancedParameters *advancedParameters) :
IPingMethod(id, ip, hostname, isParallelPing, callback, pingMethodFinishedCallback),
httpNetworkManager_(httpNetworkManager)
httpNetworkManager_(httpNetworkManager),
advancedParameters_(advancedParameters)
{
}

Expand Down Expand Up @@ -42,6 +43,7 @@ void PingMethodHttp::ping(bool isFromDisconnectedVpnState)
httpRequest->setOverrideIp(ip_);
// We add all ips to the firewall exceptions at once in the client before we ping, so there is no need to do it in HttpNetworkManager
httpRequest->setIsWhiteListIps(false);
httpRequest->setExtraTLSPadding(advancedParameters_->isAPIExtraTLSPadding());
using namespace std::placeholders;
request_ = httpNetworkManager_->executeRequest(httpRequest, 0, std::bind(&PingMethodHttp::onNetworkRequestFinished, this, _1, _2, _3, _4));
}
Expand Down
4 changes: 3 additions & 1 deletion libs/wsnet/src/pingmanager/pingmethod_http.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "ipingmethod.h"
#include "WSNetHttpNetworkManager.h"
#include "WSNetAdvancedParameters.h"

namespace wsnet {

Expand All @@ -10,7 +11,7 @@ class PingMethodHttp : public IPingMethod
{
public:
PingMethodHttp(WSNetHttpNetworkManager *httpNetworkManager, std::uint64_t id, const std::string &ip, const std::string &hostname, bool isParallelPing,
PingFinishedCallback callback, PingMethodFinishedCallback pingMethodFinishedCallback);
PingFinishedCallback callback, PingMethodFinishedCallback pingMethodFinishedCallback, WSNetAdvancedParameters *advancedParameters);

virtual ~PingMethodHttp();
void ping(bool isFromDisconnectedVpnState) override;
Expand All @@ -19,6 +20,7 @@ class PingMethodHttp : public IPingMethod
enum { PING_TIMEOUT = 2000 };
WSNetHttpNetworkManager *httpNetworkManager_;
std::shared_ptr<WSNetCancelableCallback> request_;
WSNetAdvancedParameters *advancedParameters_;

void onNetworkRequestFinished(std::uint64_t requestId, std::uint32_t elapsedMs, NetworkError errCode, const std::string &data);
int parseReplyString(const std::string &data);
Expand Down
2 changes: 1 addition & 1 deletion libs/wsnet/src/wsnet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class WSNet_impl : public WSNet
advancedParameters_ = std::make_shared<AdvancedParameters>();
serverAPI_ = std::make_shared<ServerAPI>(io_context_, httpNetworkManager_.get(), failoverContainer_.get(), serverApiSettings, advancedParameters_.get(), connectState_);
emergencyConnect_ = std::make_shared<EmergencyConnect>(io_context_, failoverContainer_.get(), dnsResolver_.get());
pingManager_ = std::make_shared<PingManager>(io_context_, httpNetworkManager_.get());
pingManager_ = std::make_shared<PingManager>(io_context_, httpNetworkManager_.get(), advancedParameters_.get());
utils_ = std::make_shared<WSNetUtils_impl>(io_context_, httpNetworkManager_.get(), failoverContainer_.get(), advancedParameters_.get());

return true;
Expand Down
Loading

0 comments on commit a5f9d0c

Please sign in to comment.