From d47e37e04fab0f81f9cdd7a075207f00633f7fcd Mon Sep 17 00:00:00 2001 From: "vladimir.kuznetsov" Date: Tue, 10 Sep 2024 21:24:42 +0400 Subject: [PATCH] limited goodbyedpi to the windows platform --- client/containers/containers_defs.cpp | 51 +++++++++---------- .../controllers/localServicesController.cpp | 18 +++---- .../ui/controllers/localServicesController.h | 10 +++- client/ui/controllers/settingsController.h | 2 - client/ui/qml/Pages2/PageSettings.qml | 2 + 5 files changed, 44 insertions(+), 39 deletions(-) diff --git a/client/containers/containers_defs.cpp b/client/containers/containers_defs.cpp index 06f8fd0c..952926a3 100644 --- a/client/containers/containers_defs.cpp +++ b/client/containers/containers_defs.cpp @@ -1,7 +1,7 @@ #include "containers_defs.h" -#include "QJsonObject" #include "QJsonDocument" +#include "QJsonObject" QDebug operator<<(QDebug debug, const amnezia::DockerContainer &c) { @@ -96,7 +96,7 @@ QMap ContainerProps::containerHumanNames() { DockerContainer::Awg, "AmneziaWG" }, { DockerContainer::Xray, "XRay" }, { DockerContainer::Ipsec, QObject::tr("IPsec") }, - { DockerContainer::SSXray, "Shadowsocks"}, + { DockerContainer::SSXray, "Shadowsocks" }, { DockerContainer::TorWebSite, QObject::tr("Website in Tor network") }, { DockerContainer::Dns, QObject::tr("AmneziaDNS") }, @@ -124,27 +124,24 @@ QMap ContainerProps::containerDescriptions() "but very resistant to blockages. " "Recommended for regions with high levels of censorship.") }, { DockerContainer::Xray, - QObject::tr("XRay with REALITY - Suitable for countries with the highest level of internet censorship. " - "Traffic masking as web traffic at the TLS level, and protection against detection by active probing methods.") }, + QObject::tr( + "XRay with REALITY - Suitable for countries with the highest level of internet censorship. " + "Traffic masking as web traffic at the TLS level, and protection against detection by active probing methods.") }, { DockerContainer::Ipsec, QObject::tr("IKEv2/IPsec - Modern stable protocol, a bit faster than others, restores connection after " "signal loss. It has native support on the latest versions of Android and iOS.") }, { DockerContainer::TorWebSite, QObject::tr("Deploy a WordPress site on the Tor network in two clicks.") }, - { DockerContainer::Dns, - QObject::tr("Replace the current DNS server with your own. This will increase your privacy level.") }, - { DockerContainer::Sftp, - QObject::tr("Create a file vault on your server to securely store and transfer files.") }, - { DockerContainer::Socks5Proxy, - QObject::tr("") } }; + { DockerContainer::Dns, QObject::tr("Replace the current DNS server with your own. This will increase your privacy level.") }, + { DockerContainer::Sftp, QObject::tr("Create a file vault on your server to securely store and transfer files.") }, + { DockerContainer::Socks5Proxy, QObject::tr("") } }; } QMap ContainerProps::containerDetailedDescriptions() { return { { DockerContainer::OpenVpn, - QObject::tr( - "OpenVPN stands as one of the most popular and time-tested VPN protocols available.\n" + QObject::tr("OpenVPN stands as one of the most popular and time-tested VPN protocols available.\n" "It employs its unique security protocol, " "leveraging the strength of SSL/TLS for encryption and key exchange. " "Furthermore, OpenVPN's support for a multitude of authentication methods makes it versatile and adaptable, " @@ -160,7 +157,8 @@ QMap ContainerProps::containerDetailedDescriptions() "* Can operate over both TCP and UDP network protocols.") }, { DockerContainer::ShadowSocks, QObject::tr("Shadowsocks, inspired by the SOCKS5 protocol, safeguards the connection using the AEAD cipher. " - "Although Shadowsocks is designed to be discreet and challenging to identify, it isn't identical to a standard HTTPS connection." + "Although Shadowsocks is designed to be discreet and challenging to identify, it isn't identical to a standard HTTPS " + "connection." "However, certain traffic analysis systems might still detect a Shadowsocks connection. " "Due to limited support in Amnezia, it's recommended to use AmneziaWG protocol.\n\n" "* Available in the AmneziaVPN only on desktop platforms\n" @@ -217,15 +215,18 @@ QMap ContainerProps::containerDetailedDescriptions() "* Works over UDP network protocol.") }, { DockerContainer::Xray, QObject::tr("The REALITY protocol, a pioneering development by the creators of XRay, " - "is specifically designed to counteract the highest levels of internet censorship through its novel approach to evasion.\n" - "It uniquely identifies censors during the TLS handshake phase, seamlessly operating as a proxy for legitimate clients while diverting censors to genuine websites like google.com, " + "is specifically designed to counteract the highest levels of internet censorship through its novel approach to " + "evasion.\n" + "It uniquely identifies censors during the TLS handshake phase, seamlessly operating as a proxy for legitimate " + "clients while diverting censors to genuine websites like google.com, " "thus presenting an authentic TLS certificate and data. \n" - "This advanced capability differentiates REALITY from similar technologies by its ability to disguise web traffic as coming from random, " + "This advanced capability differentiates REALITY from similar technologies by its ability to disguise web traffic as " + "coming from random, " "legitimate sites without the need for specific configurations. \n" "Unlike older protocols such as VMess, VLESS, and the XTLS-Vision transport, " - "REALITY's innovative \"friend or foe\" recognition at the TLS handshake enhances security and circumvents detection by sophisticated DPI systems employing active probing techniques. " - "This makes REALITY a robust solution for maintaining internet freedom in environments with stringent censorship.") - }, + "REALITY's innovative \"friend or foe\" recognition at the TLS handshake enhances security and circumvents detection " + "by sophisticated DPI systems employing active probing techniques. " + "This makes REALITY a robust solution for maintaining internet freedom in environments with stringent censorship.") }, { DockerContainer::Ipsec, QObject::tr("IKEv2, paired with the IPSec encryption layer, stands as a modern and stable VPN protocol.\n" "One of its distinguishing features is its ability to swiftly switch between networks and devices, " @@ -245,8 +246,7 @@ QMap ContainerProps::containerDetailedDescriptions() "You will be able to access it using\n FileZilla or other SFTP clients, " "as well as mount the disk on your device to access\n it directly from your device.\n\n" "For more detailed information, you can\n find it in the support section under \"Create SFTP file storage.\" ") }, - { DockerContainer::Socks5Proxy, QObject::tr("SOCKS5 proxy server") } } - + { DockerContainer::Socks5Proxy, QObject::tr("SOCKS5 proxy server") } }; } @@ -288,7 +288,8 @@ bool ContainerProps::isSupportedByCurrentPlatform(DockerContainer c) case DockerContainer::Awg: return true; case DockerContainer::Xray: return true; case DockerContainer::Cloak: return true; - case DockerContainer::SSXray: return true; + case DockerContainer::SSXray: + return true; // case DockerContainer::ShadowSocks: return true; default: return false; } @@ -384,10 +385,8 @@ bool ContainerProps::isShareable(DockerContainer container) QJsonObject ContainerProps::getProtocolConfigFromContainer(const Proto protocol, const QJsonObject &containerConfig) { - QString protocolConfigString = containerConfig.value(ProtocolProps::protoToString(protocol)) - .toObject() - .value(config_key::last_config) - .toString(); + QString protocolConfigString = + containerConfig.value(ProtocolProps::protoToString(protocol)).toObject().value(config_key::last_config).toString(); return QJsonDocument::fromJson(protocolConfigString.toUtf8()).object(); } diff --git a/client/ui/controllers/localServicesController.cpp b/client/ui/controllers/localServicesController.cpp index 36e23de3..3cd999ae 100644 --- a/client/ui/controllers/localServicesController.cpp +++ b/client/ui/controllers/localServicesController.cpp @@ -9,24 +9,21 @@ LocalServicesController::LocalServicesController(const QSharedPointer &settings, QObject *parent) : QObject(parent), m_serversModel(serversModel), m_settings(settings) { +#ifdef Q_OS_WINDOWS connect(&m_goodbyeDpiService, &GoodByeDpi::serviceStateChanged, this, &LocalServicesController::serviceStateChanged); +#endif } LocalServicesController::~LocalServicesController() { +#ifdef Q_OS_WINDOWS m_goodbyeDpiService.stop(); +#endif } void LocalServicesController::toggleGoodbyeDpi(bool enable) { if (enable) { - // auto file = getGoodbyeDpiBlackListFile(); - // auto modset = getGoodbyeDpiModset(); - // auto errorCode = ErrorCode::NoError;//m_goodbyeDpiService.start(file, modset); - // if (errorCode != ErrorCode::NoError) { - // emit errorOccurred(errorCode); - // } else { - QJsonObject server; server.insert(config_key::isGoodbyeDpi, true); server.insert(config_key::description, "GoodbyeDPI service"); @@ -36,10 +33,7 @@ void LocalServicesController::toggleGoodbyeDpi(bool enable) m_settings->toggleGoodbyeDpi(true); emit toggleGoodbyeDpiFinished(tr("GoodbyeDPI added to home page")); - // } } else { - // m_goodbyeDpiService.stop(); - for (int i = 0; i < m_serversModel->getServersCount(); i++) { if (m_serversModel->getServerConfig(i).value(config_key::isGoodbyeDpi).toBool(false)) { m_serversModel->setProcessedServerIndex(i); @@ -89,13 +83,17 @@ int LocalServicesController::getGoodbyeDpiModset() void LocalServicesController::start() { +#ifdef Q_OS_WINDOWS auto errorCode = m_goodbyeDpiService.start(getGoodbyeDpiBlackListFile(), getGoodbyeDpiModset()); if (errorCode != ErrorCode::NoError) { emit errorOccurred(errorCode); } +#endif } void LocalServicesController::stop() { +#ifdef Q_OS_WINDOWS m_goodbyeDpiService.stop(); +#endif } diff --git a/client/ui/controllers/localServicesController.h b/client/ui/controllers/localServicesController.h index 4daa517f..5d16a332 100644 --- a/client/ui/controllers/localServicesController.h +++ b/client/ui/controllers/localServicesController.h @@ -3,7 +3,9 @@ #include -#include "localServices/goodByeDpi.h" +#ifdef Q_OS_WINDOWS + #include "localServices/goodByeDpi.h" +#endif #include "protocols/vpnprotocol.h" #include "settings.h" #include "ui/models/servers_model.h" @@ -42,9 +44,15 @@ private: std::shared_ptr m_settings; QSharedPointer m_serversModel; +#ifdef Q_OS_WINDOWS GoodByeDpi m_goodbyeDpiService; +#endif bool m_isGoodbyeDpiServiceEnabled = false; +#ifdef Q_OS_WINDOWS QString m_defaultBlackListFile = QCoreApplication::applicationDirPath() + "/goodbyedpi/blacklist.txt"; +#else + QString m_defaultBlackListFile; +#endif }; #endif // LOCALSERVICESCONTROLLER_H diff --git a/client/ui/controllers/settingsController.h b/client/ui/controllers/settingsController.h index a2cb1fbf..e01cd6a5 100644 --- a/client/ui/controllers/settingsController.h +++ b/client/ui/controllers/settingsController.h @@ -113,8 +113,6 @@ private: QSharedPointer m_appSplitTunnelingModel; std::shared_ptr m_settings; - GoodByeDpi m_goodbyeDpiService; - QString m_appVersion; QDateTime m_loggingDisableDate; diff --git a/client/ui/qml/Pages2/PageSettings.qml b/client/ui/qml/Pages2/PageSettings.qml index 76cae3b5..9026fc45 100644 --- a/client/ui/qml/Pages2/PageSettings.qml +++ b/client/ui/qml/Pages2/PageSettings.qml @@ -98,6 +98,8 @@ PageType { LabelWithButtonType { Layout.fillWidth: true + visible: Qt.platform.os === "windows" + text: qsTr("Local bypass services") rightImageSource: "qrc:/images/controls/chevron-right.svg" leftImageSource: "qrc:/images/controls/app.svg"