From b9fb1aa685af8d71fc07e9276b87a5947973703e Mon Sep 17 00:00:00 2001 From: Mark Puha Date: Thu, 3 Jul 2025 18:02:53 +0200 Subject: [PATCH] feat: s3 s4 cont --- client/3rd-prebuilt | 2 +- client/configurators/awg_configurator.cpp | 3 + client/core/controllers/serverController.cpp | 6 + client/mozilla/localsocketcontroller.cpp | 6 + client/platforms/ios/ios_controller.mm | 24 +++- .../server_scripts/awg/configure_container.sh | 2 +- client/server_scripts/awg/template.conf | 2 +- client/translations/amneziavpn_ar_EG.ts | 90 ++++++++------- client/translations/amneziavpn_fa_IR.ts | 90 ++++++++------- client/translations/amneziavpn_hi_IN.ts | 90 ++++++++------- client/translations/amneziavpn_my_MM.ts | 90 ++++++++------- client/translations/amneziavpn_ru_RU.ts | 90 ++++++++------- client/translations/amneziavpn_uk_UA.ts | 90 ++++++++------- client/translations/amneziavpn_ur_PK.ts | 90 ++++++++------- client/translations/amneziavpn_zh_CN.ts | 90 ++++++++------- .../controllers/api/apiConfigsController.cpp | 2 + client/ui/controllers/importController.cpp | 109 +++++++++++------- client/ui/controllers/installController.cpp | 4 + client/ui/models/protocols/awgConfigModel.cpp | 16 +++ .../Pages2/PageProtocolAwgClientSettings.qml | 22 ++++ .../ui/qml/Pages2/PageProtocolAwgSettings.qml | 2 +- 21 files changed, 549 insertions(+), 371 deletions(-) diff --git a/client/3rd-prebuilt b/client/3rd-prebuilt index 50cd8464..527b52f0 160000 --- a/client/3rd-prebuilt +++ b/client/3rd-prebuilt @@ -1 +1 @@ -Subproject commit 50cd8464315808b23fb62bd027af9f653cc54da1 +Subproject commit 527b52f08cac102a6386a1fb49f365b4f861c9c2 diff --git a/client/configurators/awg_configurator.cpp b/client/configurators/awg_configurator.cpp index f5e21cf0..b7246c40 100644 --- a/client/configurators/awg_configurator.cpp +++ b/client/configurators/awg_configurator.cpp @@ -1,4 +1,5 @@ #include "awg_configurator.h" +#include "protocols/protocols_defs.h" #include #include @@ -35,6 +36,8 @@ QString AwgConfigurator::createConfig(const ServerCredentials &credentials, Dock jsonConfig[config_key::junkPacketMaxSize] = configMap.value(config_key::junkPacketMaxSize); jsonConfig[config_key::initPacketJunkSize] = configMap.value(config_key::initPacketJunkSize); jsonConfig[config_key::responsePacketJunkSize] = configMap.value(config_key::responsePacketJunkSize); + jsonConfig[config_key::cookieReplyPacketJunkSize] = configMap.value(config_key::cookieReplyPacketJunkSize); + jsonConfig[config_key::transportPacketJunkSize] = configMap.value(config_key::transportPacketJunkSize); jsonConfig[config_key::initPacketMagicHeader] = configMap.value(config_key::initPacketMagicHeader); jsonConfig[config_key::responsePacketMagicHeader] = configMap.value(config_key::responsePacketMagicHeader); jsonConfig[config_key::underloadPacketMagicHeader] = configMap.value(config_key::underloadPacketMagicHeader); diff --git a/client/core/controllers/serverController.cpp b/client/core/controllers/serverController.cpp index 1b661b6e..f2bd9500 100644 --- a/client/core/controllers/serverController.cpp +++ b/client/core/controllers/serverController.cpp @@ -360,6 +360,10 @@ bool ServerController::isReinstallContainerRequired(DockerContainer container, c != newProtoConfig.value(config_key::initPacketJunkSize).toString(protocols::awg::defaultInitPacketJunkSize)) || (oldProtoConfig.value(config_key::responsePacketJunkSize).toString(protocols::awg::defaultResponsePacketJunkSize) != newProtoConfig.value(config_key::responsePacketJunkSize).toString(protocols::awg::defaultResponsePacketJunkSize)) + || (oldProtoConfig.value(config_key::cookieReplyPacketJunkSize).toString(protocols::awg::defaultCookieReplyPacketJunkSize) + != newProtoConfig.value(config_key::cookieReplyPacketJunkSize).toString(protocols::awg::defaultCookieReplyPacketJunkSize)) + || (oldProtoConfig.value(config_key::transportPacketJunkSize).toString(protocols::awg::defaultTransportPacketJunkSize) + != newProtoConfig.value(config_key::transportPacketJunkSize).toString(protocols::awg::defaultTransportPacketJunkSize)) || (oldProtoConfig.value(config_key::initPacketMagicHeader).toString(protocols::awg::defaultInitPacketMagicHeader) != newProtoConfig.value(config_key::initPacketMagicHeader).toString(protocols::awg::defaultInitPacketMagicHeader)) || (oldProtoConfig.value(config_key::responsePacketMagicHeader).toString(protocols::awg::defaultResponsePacketMagicHeader) @@ -653,6 +657,8 @@ ServerController::Vars ServerController::genVarsForScript(const ServerCredential vars.append({ { "$JUNK_PACKET_MAX_SIZE", amneziaWireguarConfig.value(config_key::junkPacketMaxSize).toString() } }); vars.append({ { "$INIT_PACKET_JUNK_SIZE", amneziaWireguarConfig.value(config_key::initPacketJunkSize).toString() } }); vars.append({ { "$RESPONSE_PACKET_JUNK_SIZE", amneziaWireguarConfig.value(config_key::responsePacketJunkSize).toString() } }); + vars.append({ { "$COOKIE_REPLY_PACKET_JUNK_SIZE", amneziaWireguarConfig.value(config_key::cookieReplyPacketJunkSize).toString() } }); + vars.append({ { "$TRANSPORT_PACKET_JUNK_SIZE", amneziaWireguarConfig.value(config_key::transportPacketJunkSize).toString() } }); vars.append({ { "$INIT_PACKET_MAGIC_HEADER", amneziaWireguarConfig.value(config_key::initPacketMagicHeader).toString() } }); vars.append({ { "$RESPONSE_PACKET_MAGIC_HEADER", amneziaWireguarConfig.value(config_key::responsePacketMagicHeader).toString() } }); vars.append({ { "$UNDERLOAD_PACKET_MAGIC_HEADER", amneziaWireguarConfig.value(config_key::underloadPacketMagicHeader).toString() } }); diff --git a/client/mozilla/localsocketcontroller.cpp b/client/mozilla/localsocketcontroller.cpp index db7295a5..be6f4b0d 100644 --- a/client/mozilla/localsocketcontroller.cpp +++ b/client/mozilla/localsocketcontroller.cpp @@ -237,6 +237,8 @@ void LocalSocketController::activate(const QJsonObject &rawConfig) { json.insert(amnezia::config_key::junkPacketMaxSize, wgConfig.value(amnezia::config_key::junkPacketMaxSize)); json.insert(amnezia::config_key::initPacketJunkSize, wgConfig.value(amnezia::config_key::initPacketJunkSize)); json.insert(amnezia::config_key::responsePacketJunkSize, wgConfig.value(amnezia::config_key::responsePacketJunkSize)); + json.insert(amnezia::config_key::cookieReplyPacketJunkSize, wgConfig.value(amnezia::config_key::cookieReplyPacketJunkSize)); + json.insert(amnezia::config_key::transportPacketJunkSize, wgConfig.value(amnezia::config_key::transportPacketJunkSize)); json.insert(amnezia::config_key::initPacketMagicHeader, wgConfig.value(amnezia::config_key::initPacketMagicHeader)); json.insert(amnezia::config_key::responsePacketMagicHeader, wgConfig.value(amnezia::config_key::responsePacketMagicHeader)); json.insert(amnezia::config_key::underloadPacketMagicHeader, wgConfig.value(amnezia::config_key::underloadPacketMagicHeader)); @@ -255,6 +257,8 @@ void LocalSocketController::activate(const QJsonObject &rawConfig) { && !wgConfig.value(amnezia::config_key::junkPacketMaxSize).isUndefined() && !wgConfig.value(amnezia::config_key::initPacketJunkSize).isUndefined() && !wgConfig.value(amnezia::config_key::responsePacketJunkSize).isUndefined() + && !wgConfig.value(amnezia::config_key::cookieReplyPacketJunkSize).isUndefined() + && !wgConfig.value(amnezia::config_key::transportPacketJunkSize).isUndefined() && !wgConfig.value(amnezia::config_key::initPacketMagicHeader).isUndefined() && !wgConfig.value(amnezia::config_key::responsePacketMagicHeader).isUndefined() && !wgConfig.value(amnezia::config_key::underloadPacketMagicHeader).isUndefined() @@ -273,6 +277,8 @@ void LocalSocketController::activate(const QJsonObject &rawConfig) { json.insert(amnezia::config_key::junkPacketMaxSize, wgConfig.value(amnezia::config_key::junkPacketMaxSize)); json.insert(amnezia::config_key::initPacketJunkSize, wgConfig.value(amnezia::config_key::initPacketJunkSize)); json.insert(amnezia::config_key::responsePacketJunkSize, wgConfig.value(amnezia::config_key::responsePacketJunkSize)); + json.insert(amnezia::config_key::cookieReplyPacketJunkSize, wgConfig.value(amnezia::config_key::cookieReplyPacketJunkSize)); + json.insert(amnezia::config_key::transportPacketJunkSize, wgConfig.value(amnezia::config_key::transportPacketJunkSize)); json.insert(amnezia::config_key::initPacketMagicHeader, wgConfig.value(amnezia::config_key::initPacketMagicHeader)); json.insert(amnezia::config_key::responsePacketMagicHeader, wgConfig.value(amnezia::config_key::responsePacketMagicHeader)); json.insert(amnezia::config_key::underloadPacketMagicHeader, wgConfig.value(amnezia::config_key::underloadPacketMagicHeader)); diff --git a/client/platforms/ios/ios_controller.mm b/client/platforms/ios/ios_controller.mm index 85fb50b7..2f3bd2dc 100644 --- a/client/platforms/ios/ios_controller.mm +++ b/client/platforms/ios/ios_controller.mm @@ -507,6 +507,8 @@ bool IosController::setupWireGuard() wgConfig.insert(config_key::initPacketJunkSize, config[config_key::initPacketJunkSize]); wgConfig.insert(config_key::responsePacketJunkSize, config[config_key::responsePacketJunkSize]); + wgConfig.insert(config_key::cookieReplyPacketJunkSize, config[config_key::cookieReplyPacketJunkSize]); + wgConfig.insert(config_key::transportPacketJunkSize, config[config_key::transportPacketJunkSize]); wgConfig.insert(config_key::junkPacketCount, config[config_key::junkPacketCount]); wgConfig.insert(config_key::junkPacketMinSize, config[config_key::junkPacketMinSize]); @@ -610,6 +612,16 @@ bool IosController::setupAwg() wgConfig.insert(config_key::junkPacketMinSize, config[config_key::junkPacketMinSize]); wgConfig.insert(config_key::junkPacketMaxSize, config[config_key::junkPacketMaxSize]); + wgConfig.insert(config_key::specialJunk1, config[config_key::specialJunk1]); + wgConfig.insert(config_key::specialJunk2, config[config_key::specialJunk2]); + wgConfig.insert(config_key::specialJunk3, config[config_key::specialJunk3]); + wgConfig.insert(config_key::specialJunk4, config[config_key::specialJunk4]); + wgConfig.insert(config_key::specialJunk5, config[config_key::specialJunk5]); + wgConfig.insert(config_key::controlledJunk1, config[config_key::controlledJunk1]); + wgConfig.insert(config_key::controlledJunk2, config[config_key::controlledJunk2]); + wgConfig.insert(config_key::controlledJunk3, config[config_key::controlledJunk3]); + wgConfig.insert(config_key::specialHandshakeTimeout, config[config_key::specialHandshakeTimeout]); + QJsonDocument wgConfigDoc(wgConfig); QString wgConfigDocStr(wgConfigDoc.toJson(QJsonDocument::Compact)); @@ -794,9 +806,9 @@ bool IosController::shareText(const QStringList& filesToSend) { if (!qtController) return; UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:sharingItems applicationActivities:nil]; - + __block bool isAccepted = false; - + [activityController setCompletionWithItemsHandler:^(NSString *activityType, BOOL completed, NSArray *returnedItems, NSError *activityError) { isAccepted = completed; emit finished(); @@ -808,11 +820,11 @@ bool IosController::shareText(const QStringList& filesToSend) { popController.sourceView = qtController.view; popController.sourceRect = CGRectMake(100, 100, 100, 100); } - + QEventLoop wait; QObject::connect(this, &IosController::finished, &wait, &QEventLoop::quit); wait.exec(); - + return isAccepted; } @@ -826,7 +838,7 @@ QString IosController::openFile() { if (!qtController) return; [qtController presentViewController:documentPicker animated:YES completion:nil]; - + __block QString filePath; documentPickerDelegate.documentPickerClosedCallback = ^(NSString *path) { @@ -841,7 +853,7 @@ QString IosController::openFile() { QEventLoop wait; QObject::connect(this, &IosController::finished, &wait, &QEventLoop::quit); wait.exec(); - + return filePath; } diff --git a/client/server_scripts/awg/configure_container.sh b/client/server_scripts/awg/configure_container.sh index a69fd1ff..0460934f 100644 --- a/client/server_scripts/awg/configure_container.sh +++ b/client/server_scripts/awg/configure_container.sh @@ -19,7 +19,7 @@ Jmin = $JUNK_PACKET_MIN_SIZE Jmax = $JUNK_PACKET_MAX_SIZE S1 = $INIT_PACKET_JUNK_SIZE S2 = $RESPONSE_PACKET_JUNK_SIZE -S3 = $UNDERLOAD_PACKET_JUNK_SIZE +S3 = $COOKIE_REPLY_PACKET_JUNK_SIZE S4 = $TRANSPORT_PACKET_JUNK_SIZE H1 = $INIT_PACKET_MAGIC_HEADER H2 = $RESPONSE_PACKET_MAGIC_HEADER diff --git a/client/server_scripts/awg/template.conf b/client/server_scripts/awg/template.conf index 33ec9abd..c136bb9e 100644 --- a/client/server_scripts/awg/template.conf +++ b/client/server_scripts/awg/template.conf @@ -7,7 +7,7 @@ Jmin = $JUNK_PACKET_MIN_SIZE Jmax = $JUNK_PACKET_MAX_SIZE S1 = $INIT_PACKET_JUNK_SIZE S2 = $RESPONSE_PACKET_JUNK_SIZE -S3 = $UNDERLOAD_PACKET_JUNK_SIZE +S3 = $COOKIE_REPLY_PACKET_JUNK_SIZE S4 = $TRANSPORT_PACKET_JUNK_SIZE H1 = $INIT_PACKET_MAGIC_HEADER H2 = $RESPONSE_PACKET_MAGIC_HEADER diff --git a/client/translations/amneziavpn_ar_EG.ts b/client/translations/amneziavpn_ar_EG.ts index 8a5af48e..742791d3 100644 --- a/client/translations/amneziavpn_ar_EG.ts +++ b/client/translations/amneziavpn_ar_EG.ts @@ -480,17 +480,17 @@ Can't be disabled for current server ملف تكوين غير صحيح - + Scanned %1 of %2. تم فحص%1 من %2. - + This configuration contains an OpenVPN setup. OpenVPN configurations can include malicious scripts, so only add it if you fully trust the provider of this config. - + <br>In the imported configuration, potentially dangerous lines were found: @@ -527,47 +527,47 @@ Already installed containers were found on the server. All installed containers تمت إضافة جميع الحاويات المٌثبتة إلي التطبيق - + Settings updated successfully تم تحديث الاعدادات بنجاح - + Server '%1' was rebooted تمت إعادة تشغيل الخادم%1 - + Server '%1' was removed تمت إزالة الخادم '%1' - + All containers from server '%1' have been removed قد تم حذفها '%1' جميع الحاويات من الخادم - + %1 has been removed from the server '%2' %1 تم حدف '%2' اسم الخادم - + Api config removed تم حذف تكوين Api - + %1 cached profile cleared تم مسح ملف تعريف %1 المخزن مؤقتًا - + Please login as the user من فضلك قم بتسجيل الدخول كمستخدم - + Server added successfully تمت إضافة الخادم بنجاح @@ -754,87 +754,87 @@ Thank you for staying with us! - + Server settings - + Port منفذ - + I1 - First special junk packet - + I2 - Second special junk packet - + I3 - Third special junk packet - + I4 - Fourth special junk packet - + I5 - Fifth special junk packet - + J1 - First controlled junk packet - + J2 - Second controlled junk packet - + J3 - Third controlled junk packet - + Itime - Special handshake timeout - + Save احفظ - + Save settings? احفظ الإعدادات؟ - + Only the settings for this device will be changed - + Continue واصل - + Cancel إلغاء - + Unable change settings while there is an active connection لا يمكن تغيير الإعدادات أثناء وجود اتصال نشط @@ -852,12 +852,12 @@ Thank you for staying with us! منفذ - + All users with whom you shared a connection with will no longer be able to connect to it. جميع المستخدمين الذين شاركت معهم اتصال لن يكونو قادرين علي الاتصال مرة اخري. - + Save احفظ @@ -893,51 +893,61 @@ Thank you for staying with us! + S3 - Cookie reply packet junk size + + + + + S4 - Transport packet junk size + + + + H1 - Init packet magic header H1 - حزمة رأس سحرية مبدئية - + H2 - Response packet magic header H2 - رأس حزمة الاستجابة السحرية - + H4 - Transport packet magic header H4 - رأس حزمة النقل السحرية - + H3 - Underload packet magic header H3 - رأس حزمة السحر غير المحمل - + The values of the H1-H4 fields must be unique يجب أن تكون قيم الحقول H1-H4 فريدة - + The value of the field S1 + message initiation size (148) must not equal S2 + message response size (92) يجب ألا تساوي قيمة الحقل S1 + حجم بدء الرسالة (148) S2 + حجم استجابة الرسالة (92) - + Save settings? احفظ الإعدادات؟ - + Continue واصل - + Cancel إلغاء - + Unable change settings while there is an active connection لا يمكن تغيير الإعدادات أثناء وجود اتصال نشط diff --git a/client/translations/amneziavpn_fa_IR.ts b/client/translations/amneziavpn_fa_IR.ts index c0f87b55..2772b8ed 100644 --- a/client/translations/amneziavpn_fa_IR.ts +++ b/client/translations/amneziavpn_fa_IR.ts @@ -485,17 +485,17 @@ Can't be disabled for current server فایل پیکربندی نامعتبر است. - + Scanned %1 of %2. ارزیابی %1 از %2. - + This configuration contains an OpenVPN setup. OpenVPN configurations can include malicious scripts, so only add it if you fully trust the provider of this config. - + <br>In the imported configuration, potentially dangerous lines were found: @@ -531,47 +531,47 @@ Already installed containers were found on the server. All installed containers کانتینرهای نصب شده بر روی سرور شناسایی شدند. تمام کانتینترهای نصب شده به نرم افزار اضافه شدند - + Settings updated successfully تنظیمات با موفقیت به‎روز‎رسانی شدند - + Server '%1' was rebooted سرور %1 راه اندازی مجدد شد - + Server '%1' was removed سرور %1 حذف شد - + All containers from server '%1' have been removed تمام کانتینترها از سرور %1 حذف شدند - + %1 has been removed from the server '%2' %1 از سرور %2 حذف شد - + Api config removed پیکربندی API حذف شد. - + %1 cached profile cleared %1 پروفایل ذخیره شده پاک شد. - + Please login as the user لطفا به عنوان کاربر وارد شوید - + Server added successfully سرور با موفقیت اضافه شد @@ -758,87 +758,87 @@ Thank you for staying with us! - + Server settings - + Port پورت - + I1 - First special junk packet - + I2 - Second special junk packet - + I3 - Third special junk packet - + I4 - Fourth special junk packet - + I5 - Fifth special junk packet - + J1 - First controlled junk packet - + J2 - Second controlled junk packet - + J3 - Third controlled junk packet - + Itime - Special handshake timeout - + Save ذخیره - + Save settings? تنظیمات را ذخیره کن? - + Only the settings for this device will be changed - + Continue - + Cancel - + Unable change settings while there is an active connection نمی‌توان تنظیمات را تغییر داد در حالی که اتصال فعال است. @@ -864,12 +864,12 @@ Thank you for staying with us! آیا میخواهید AmneziaWG از سرور حذف شود؟ - + All users with whom you shared a connection with will no longer be able to connect to it. همه کاربرانی که با آن‌ها ارتباطی به اشتراک گذاشته‌اید دیگر قادر به اتصال به آن نخواهند بود. - + Save ذخیره @@ -905,51 +905,61 @@ Thank you for staying with us! + S3 - Cookie reply packet junk size + + + + + S4 - Transport packet junk size + + + + H1 - Init packet magic header - + H2 - Response packet magic header - + H3 - Underload packet magic header - + H4 - Transport packet magic header - + The values of the H1-H4 fields must be unique - + The value of the field S1 + message initiation size (148) must not equal S2 + message response size (92) - + Save settings? تنظیمات را ذخیره کن? - + Continue ادامه - + Cancel کنسل - + Unable change settings while there is an active connection نمی‌توان تنظیمات را تغییر داد در حالی که اتصال فعال است. diff --git a/client/translations/amneziavpn_hi_IN.ts b/client/translations/amneziavpn_hi_IN.ts index 904c15e9..098dc4ca 100644 --- a/client/translations/amneziavpn_hi_IN.ts +++ b/client/translations/amneziavpn_hi_IN.ts @@ -465,17 +465,17 @@ Can't be disabled for current server अमान्य कॉन्फ़िगरेशन फ़ाइल - + Scanned %1 of %2. %2 में से %1 स्कैन किया गया. - + This configuration contains an OpenVPN setup. OpenVPN configurations can include malicious scripts, so only add it if you fully trust the provider of this config. - + <br>In the imported configuration, potentially dangerous lines were found: @@ -507,47 +507,47 @@ Already installed containers were found on the server. All installed containers सर्वर पर पहले से स्थापित कंटेनर पाए गए। सभी स्थापित कंटेनरों को एप्लिकेशन में जोड़ दिया गया है - + Settings updated successfully सेटिंग्स सफलतापूर्वक अपडेट हो गईं - + Server '%1' was rebooted सर्वर '%1' रीबूट किया गया था - + Server '%1' was removed सर्वर '%1' रीबूट किया गया था - + All containers from server '%1' have been removed सर्वर '%1' से सभी कंटेनर हटा दिए गए हैं - + %1 has been removed from the server '%2' %1 को सर्वर '%2' से हटा दिया गया है - + Api config removed - + %1 cached profile cleared %1 कैश्ड प्रोफ़ाइल साफ़ की गई - + Please login as the user कृपया उपयोगकर्ता के रूप में लॉगिन करें - + Server added successfully सर्वर सफलतापूर्वक जोड़ा गया @@ -722,87 +722,87 @@ Thank you for staying with us! एमटीयू - + Server settings - + Port - + I1 - First special junk packet - + I2 - Second special junk packet - + I3 - Third special junk packet - + I4 - Fourth special junk packet - + I5 - Fifth special junk packet - + J1 - First controlled junk packet - + J2 - Second controlled junk packet - + J3 - Third controlled junk packet - + Itime - Special handshake timeout - + Save सहेजें - + Save settings? सेटिंग्स सेव करें? - + Only the settings for this device will be changed - + Continue जारी रखना - + Cancel रद्द करना - + Unable change settings while there is an active connection सक्रिय कनेक्शन होने पर सेटिंग बदलने में असमर्थ @@ -829,37 +829,37 @@ Thank you for staying with us! एमटीयू - + Save सहेजें - + The values of the H1-H4 fields must be unique H1-H4 फ़ील्ड का मान अद्वितीय होना चाहिए - + The value of the field S1 + message initiation size (148) must not equal S2 + message response size (92) फ़ील्ड S1 + संदेश आरंभ आकार (148) का मान S2 + संदेश प्रतिक्रिया आकार (92) के बराबर नहीं होना चाहिए - + Save settings? सेटिंग्स सेव करें? - + All users with whom you shared a connection with will no longer be able to connect to it. वे सभी उपयोगकर्ता जिनके साथ आपने कनेक्शन साझा किया था, वे अब इससे कनेक्ट नहीं हो पाएंगे. - + Unable change settings while there is an active connection सक्रिय कनेक्शन होने पर सेटिंग बदलने में असमर्थ - + Continue जारी रखना @@ -890,26 +890,36 @@ Thank you for staying with us! + S3 - Cookie reply packet junk size + + + + + S4 - Transport packet junk size + + + + H1 - Init packet magic header - + H2 - Response packet magic header - + H3 - Underload packet magic header - + H4 - Transport packet magic header - + Cancel रद्द करना diff --git a/client/translations/amneziavpn_my_MM.ts b/client/translations/amneziavpn_my_MM.ts index da4b37a6..535268ac 100644 --- a/client/translations/amneziavpn_my_MM.ts +++ b/client/translations/amneziavpn_my_MM.ts @@ -481,17 +481,17 @@ Can't be disabled for current server Configuration ဖိုင် မမှန်ကန်ပါ - + Scanned %1 of %2. %2 ၏ %1 ကို စကင်န်ဖတ်ထားသည်. - + This configuration contains an OpenVPN setup. OpenVPN configurations can include malicious scripts, so only add it if you fully trust the provider of this config. - + <br>In the imported configuration, potentially dangerous lines were found: @@ -527,47 +527,47 @@ Already installed containers were found on the server. All installed containers ထည့်သွင်းပြီးသား ကွန်တိန်နာများကို ဆာဗာပေါ်တွင် တွေ့ရှိခဲ့သည်။ ထည့်သွင်းထားသည့် ကွန်တိန်နာအားလုံးကို အပလီကေးရှင်းထဲသို့ ပေါင်းထည့်ပြီးပါပြီ။ - + Settings updated successfully ဆက်တင်များကို အောင်မြင်စွာ အပ်ဒိတ်လုပ်ပြီးပါပြီ။ - + Server '%1' was rebooted ဆာဗာ '%1' ကို ပြန်လည်စတင်ခဲ့သည်။ - + Server '%1' was removed ဆာဗာ '%1' ကို ဖယ်ရှားခဲ့သည်။ - + All containers from server '%1' have been removed ဆာဗာ '%1' မှ ကွန်တိန်နာအားလုံးကို ဖယ်ရှားလိုက်ပါပြီ။ - + %1 has been removed from the server '%2' %1 ကို ဆာဗာ '%2' မှ ဖယ်ရှားလိုက်ပါပြီ - + Api config removed Api config ကိုဖယ်ရှားလိုက်သည် - + %1 cached profile cleared ကက်ရှ်လုပ်ထားတဲ့ ပရိုဖိုင် %1 ခုကို ရှင်းပြီးပါပြီ - + Please login as the user အသုံးပြုသူအဖြစ် log in ဝင်ရောက်ပါ - + Server added successfully ဆာဗာကို အောင်မြင်စွာ ထည့်သွင်းပြီးပါပြီ @@ -754,87 +754,87 @@ Thank you for staying with us! MTU - + Server settings - + Port Port - + I1 - First special junk packet - + I2 - Second special junk packet - + I3 - Third special junk packet - + I4 - Fourth special junk packet - + I5 - Fifth special junk packet - + J1 - First controlled junk packet - + J2 - Second controlled junk packet - + J3 - Third controlled junk packet - + Itime - Special handshake timeout - + Save သိမ်းဆည်းမည် - + Save settings? ဆက်တင်များကို သိမ်းဆည်းမည်လား? - + Only the settings for this device will be changed - + Continue ဆက်လက်လုပ်ဆောင်မည် - + Cancel ပယ်ဖျက်မည် - + Unable change settings while there is an active connection လက်ရှိချိတ်ဆက်မှုတစ်ခုရှိနေချိန်တွင် ဆက်တင်များကို ပြောင်းလဲ၍မရပါ @@ -856,12 +856,12 @@ Thank you for staying with us! MTU - + All users with whom you shared a connection with will no longer be able to connect to it. သင်နှင့်အတူချိတ်ဆက်မှုတစ်ခုကို မျှဝေထားသည့် အသုံးပြုသူအားလုံး ချိတ်ဆက်နိုင်တော့မည်မဟုတ်ပါ. - + Save သိမ်းဆည်းမည် @@ -897,51 +897,61 @@ Thank you for staying with us! + S3 - Cookie reply packet junk size + + + + + S4 - Transport packet junk size + + + + H1 - Init packet magic header H1 - Init packet magic header - + H2 - Response packet magic header H2 - Response packet magic header - + H4 - Transport packet magic header H4 - Transport packet magic header - + H3 - Underload packet magic header H3 - Underload packet magic header - + The values of the H1-H4 fields must be unique H1-H4 အကွက်များ၏ တန်ဖိုးများသည် အခြားတန်ဖိုးများနှင့်မတူ တမူထူးခြားနေရပါမည် - + The value of the field S1 + message initiation size (148) must not equal S2 + message response size (92) အကွက် S1 + မက်ဆေ့ချ် စတင်ခြင်း အရွယ်အစား (148) ၏ တန်ဖိုးသည် S2 + မက်ဆေ့ချ် တုံ့ပြန်မှု အရွယ်အစား (92) နှင့် မညီမျှရပါ - + Save settings? ဆက်တင်များကို သိမ်းဆည်းမည်လား? - + Continue ဆက်လက်လုပ်ဆောင်မည် - + Cancel ပယ်ဖျက်မည် - + Unable change settings while there is an active connection လက်ရှိချိတ်ဆက်မှုတစ်ခုရှိနေချိန်တွင် ဆက်တင်များကို ပြောင်းလဲ၍မရပါ diff --git a/client/translations/amneziavpn_ru_RU.ts b/client/translations/amneziavpn_ru_RU.ts index d250be5f..ad2237fe 100644 --- a/client/translations/amneziavpn_ru_RU.ts +++ b/client/translations/amneziavpn_ru_RU.ts @@ -436,17 +436,17 @@ Can't be disabled for current server ImportController - + Scanned %1 of %2. Отсканировано %1 из %2. - + This configuration contains an OpenVPN setup. OpenVPN configurations can include malicious scripts, so only add it if you fully trust the provider of this config. Эта конфигурация содержит настройки OpenVPN. Конфигурации OpenVPN могут содержать вредоносные скрипты, поэтому добавляйте их только в том случае, если полностью доверяете источнику этого файла. - + <br>In the imported configuration, potentially dangerous lines were found: <br>В импортированной конфигурации обнаружены потенциально опасные строки: @@ -478,47 +478,47 @@ Already installed containers were found on the server. All installed containers На сервере обнаружены установленные протоколы и сервисы. Все они были добавлены в приложение - + Settings updated successfully Настройки успешно обновлены - + Server '%1' was rebooted Сервер '%1' был перезагружен - + Server '%1' was removed Сервер '%1' был удален - + All containers from server '%1' have been removed Все протоколы и сервисы были удалены с сервера '%1' - + %1 has been removed from the server '%2' %1 был удален с сервера '%2' - + Api config removed Конфигурация API удалена - + %1 cached profile cleared %1 закэшированный профиль очищен - + Please login as the user Пожалуйста, войдите в систему от имени пользователя - + Server added successfully Сервер успешно добавлен @@ -690,87 +690,87 @@ Thank you for staying with us! MTU - + Server settings Настройки сервера - + Port Порт - + I1 - First special junk packet - + I2 - Second special junk packet - + I3 - Third special junk packet - + I4 - Fourth special junk packet - + I5 - Fifth special junk packet - + J1 - First controlled junk packet - + J2 - Second controlled junk packet - + J3 - Third controlled junk packet - + Itime - Special handshake timeout - + Save Сохранить - + Save settings? Сохранить настройки? - + Only the settings for this device will be changed Будут изменены настройки только для этого устройства - + Continue Продолжить - + Cancel Отменить - + Unable change settings while there is an active connection Невозможно изменить настройки во время активного соединения @@ -788,12 +788,12 @@ Thank you for staying with us! Порт - + All users with whom you shared a connection with will no longer be able to connect to it. Все пользователи, с которыми вы поделились конфигурацией вашего VPN, больше не смогут к нему подключаться. - + Save Сохранить @@ -829,51 +829,61 @@ Thank you for staying with us! + S3 - Cookie reply packet junk size + + + + + S4 - Transport packet junk size + + + + H1 - Init packet magic header H1 - Init packet magic header - + H2 - Response packet magic header H2 - Response packet magic header - + H4 - Transport packet magic header H4 - Transport packet magic header - + H3 - Underload packet magic header H3 - Underload packet magic header - + The values of the H1-H4 fields must be unique Значения в полях H1-H4 должны быть уникальными - + The value of the field S1 + message initiation size (148) must not equal S2 + message response size (92) Значение в поле S1 + размер инициации сообщения (148) не должно равняться значению в поле S2 + размер ответа на сообщение (92) - + Save settings? Сохранить настройки? - + Continue Продолжить - + Cancel Отменить - + Unable change settings while there is an active connection Невозможно изменить настройки во время активного соединения diff --git a/client/translations/amneziavpn_uk_UA.ts b/client/translations/amneziavpn_uk_UA.ts index e96f7455..2e1307f7 100644 --- a/client/translations/amneziavpn_uk_UA.ts +++ b/client/translations/amneziavpn_uk_UA.ts @@ -512,17 +512,17 @@ Can't be disabled for current server Недійсний файл конфігурації - + Scanned %1 of %2. Відскановано %1 з %2. - + This configuration contains an OpenVPN setup. OpenVPN configurations can include malicious scripts, so only add it if you fully trust the provider of this config. - + <br>In the imported configuration, potentially dangerous lines were found: @@ -557,47 +557,47 @@ Already installed containers were found on the server. All installed containers На сервері знайдені сервіси та протоколи, всі вони додані в застосунок - + Settings updated successfully Налаштування оновлено - + Server '%1' was rebooted Сервер '%1' перезавантажено - + Server '%1' was removed Сервер '%1' був видалений - + All containers from server '%1' have been removed Всі сервіси та протоколи були видалені з сервера '%1' - + %1 has been removed from the server '%2' %1 був видалений з сервера '%2' - + Api config removed Конфігурацію API видалено - + %1 cached profile cleared Кешований профіль %1 очищено - + Please login as the user Буль-ласка, увійдіть в систему від імені користувача - + Server added successfully Сервер додано @@ -784,87 +784,87 @@ Thank you for staying with us! MTU - + Server settings - + Port Порт - + I1 - First special junk packet - + I2 - Second special junk packet - + I3 - Third special junk packet - + I4 - Fourth special junk packet - + I5 - Fifth special junk packet - + J1 - First controlled junk packet - + J2 - Second controlled junk packet - + J3 - Third controlled junk packet - + Itime - Special handshake timeout - + Save Зберегти - + Save settings? Зберегти налаштування? - + Only the settings for this device will be changed - + Continue Продовжити - + Cancel Відмінити - + Unable change settings while there is an active connection Неможливо змінити налаштування, поки є активне підключення @@ -913,51 +913,61 @@ Thank you for staying with us! + S3 - Cookie reply packet junk size + + + + + S4 - Transport packet junk size + + + + H1 - Init packet magic header - + H2 - Response packet magic header - + H3 - Underload packet magic header - + H4 - Transport packet magic header - + Save Зберегти - + The values of the H1-H4 fields must be unique Значення полів H1-H4 мають бути унікальними - + The value of the field S1 + message initiation size (148) must not equal S2 + message response size (92) Значення поля S1 + розмір повідомлення ініціалізації (148) не має бути рівним значенню S2 + розмір повідомлення відповіді (92) - + Save settings? Зберегти налаштування? - + All users with whom you shared a connection with will no longer be able to connect to it. Усі користувачі, з якими ви поділилися підключенням, більше не зможуть підключитися до нього. - + Unable change settings while there is an active connection Неможливо змінити налаштування, поки є активне підключення @@ -978,12 +988,12 @@ Thank you for staying with us! Користувачі, з якими ви поділились цим протоколм, більше не зможуть до нього підключитись. - + Continue Продовжити - + Cancel Відмінити diff --git a/client/translations/amneziavpn_ur_PK.ts b/client/translations/amneziavpn_ur_PK.ts index 2c8be9f6..290b36df 100644 --- a/client/translations/amneziavpn_ur_PK.ts +++ b/client/translations/amneziavpn_ur_PK.ts @@ -463,17 +463,17 @@ Can't be disabled for current server غلط کنفیگریشن فائل - + Scanned %1 of %2. سکین%1 کی%2. - + This configuration contains an OpenVPN setup. OpenVPN configurations can include malicious scripts, so only add it if you fully trust the provider of this config. - + <br>In the imported configuration, potentially dangerous lines were found: @@ -505,47 +505,47 @@ Already installed containers were found on the server. All installed containers سرور پر پہلے سے نصب کنٹینرز پائے گئے۔ تمام نصب کنٹینرز کو ایپلی کیشن میں شامل کر دیا گیا ہے - + Settings updated successfully ترتیب کامیابی کے ساتھ اپ ڈیٹ ہو گئی - + Server '%1' was rebooted سرور %1 دوبارہ چالو کیا گیا تھا - + Server '%1' was removed سرور %1 ہٹا دیا گیا تھا - + All containers from server '%1' have been removed سرور '%1' سے تمام کنٹینرز ہٹا دیے گئے ہیں - + %1 has been removed from the server '%2' سرور '%2' سے %1 ہٹا دیا گیا ہے - + Api config removed - + %1 cached profile cleared %1 کیش کردہ پروفائل ختم کر دی گئی - + Please login as the user براہ کرم صارف کے طور پر لاگ ان کریں - + Server added successfully سرور کامیابی سے شامل کیا گیا @@ -722,87 +722,87 @@ Thank you for staying with us! ام ٹی یو - + Server settings - + Port پورٹ - + I1 - First special junk packet - + I2 - Second special junk packet - + I3 - Third special junk packet - + I4 - Fourth special junk packet - + I5 - Fifth special junk packet - + J1 - First controlled junk packet - + J2 - Second controlled junk packet - + J3 - Third controlled junk packet - + Itime - Special handshake timeout - + Save - + Save settings? ترتیبات محفوظ کریں? - + Only the settings for this device will be changed - + Continue - + Cancel - + Unable change settings while there is an active connection جب ایک فعال کنکشن موجود ہو تو ترتیبات کو تبدیل نہیں کیا جا سکتا @@ -824,12 +824,12 @@ Thank you for staying with us! ام ٹی یو - + All users with whom you shared a connection with will no longer be able to connect to it. آپ جن لوگوں کے ساتھ آپ نے اس کنکشن کا اشتراک کیا تھا، وہ اس سے مزید جڑ نہیں سکیں گے۔ - + Save محفوظ کریں @@ -865,51 +865,61 @@ Thank you for staying with us! + S3 - Cookie reply packet junk size + + + + + S4 - Transport packet junk size + + + + H1 - Init packet magic header - + H2 - Response packet magic header - + H3 - Underload packet magic header - + H4 - Transport packet magic header - + The values of the H1-H4 fields must be unique H1 تا H4 فیلڈز کی قیمتیں مخصوص ہونی چاہیے - + The value of the field S1 + message initiation size (148) must not equal S2 + message response size (92) S1 + پیغام شروع کار (148) کے فیلڈ کی قیمت S2 + پیغام جواب (92) کے سائز کے برابر نہیں ہونی چاہئے - + Save settings? ترتیبات محفوظ کریں? - + Continue جاری رکھیں - + Cancel منسوخ کریں - + Unable change settings while there is an active connection جب ایک فعال کنکشن موجود ہو تو ترتیبات کو تبدیل نہیں کیا جا سکتا diff --git a/client/translations/amneziavpn_zh_CN.ts b/client/translations/amneziavpn_zh_CN.ts index 1e6320bf..4a202069 100644 --- a/client/translations/amneziavpn_zh_CN.ts +++ b/client/translations/amneziavpn_zh_CN.ts @@ -456,17 +456,17 @@ Can't be disabled for current server ImportController - + Scanned %1 of %2. 扫描 %1 of %2. - + This configuration contains an OpenVPN setup. OpenVPN configurations can include malicious scripts, so only add it if you fully trust the provider of this config. - + <br>In the imported configuration, potentially dangerous lines were found: @@ -505,37 +505,37 @@ Already installed containers were found on the server. All installed containers 在服务上发现已经安装协议并添加至应用 - + Settings updated successfully 配置更新成功 - + Server '%1' was rebooted 服务器 '%1' 已重新启动 - + Server '%1' was removed 已移除服务器 '%1' - + All containers from server '%1' have been removed 服务器 '%1' 的所有容器已移除 - + %1 has been removed from the server '%2' %1 已从服务器 '%2' 上移除 - + Api config removed - + %1 cached profile cleared @@ -556,12 +556,12 @@ Already installed containers were found on the server. All installed containers 协议已从 - + Please login as the user 请以用户身份登录 - + Server added successfully 增加服务器成功 @@ -736,87 +736,87 @@ Thank you for staying with us! - + Server settings - + Port 端口 - + I1 - First special junk packet - + I2 - Second special junk packet - + I3 - Third special junk packet - + I4 - Fourth special junk packet - + I5 - Fifth special junk packet - + J1 - First controlled junk packet - + J2 - Second controlled junk packet - + J3 - Third controlled junk packet - + Itime - Special handshake timeout - + Save 保存 - + Save settings? 保存设置? - + Only the settings for this device will be changed - + Continue 继续 - + Cancel 取消 - + Unable change settings while there is an active connection @@ -842,12 +842,12 @@ Thank you for staying with us! 从服务上移除AmneziaWG? - + All users with whom you shared a connection with will no longer be able to connect to it. 与您共享连接的所有用户将无法再连接到该连接。 - + Save 保存 @@ -883,51 +883,61 @@ Thank you for staying with us! + S3 - Cookie reply packet junk size + + + + + S4 - Transport packet junk size + + + + H1 - Init packet magic header - + H2 - Response packet magic header - + H3 - Underload packet magic header - + H4 - Transport packet magic header - + The values of the H1-H4 fields must be unique - + The value of the field S1 + message initiation size (148) must not equal S2 + message response size (92) - + Save settings? 保存设置? - + Continue 继续 - + Cancel 取消 - + Unable change settings while there is an active connection diff --git a/client/ui/controllers/api/apiConfigsController.cpp b/client/ui/controllers/api/apiConfigsController.cpp index a89ba5c1..d1273f57 100644 --- a/client/ui/controllers/api/apiConfigsController.cpp +++ b/client/ui/controllers/api/apiConfigsController.cpp @@ -479,6 +479,8 @@ void ApiConfigsController::fillServerConfig(const QString &protocol, const ApiPa containerConfig[config_key::junkPacketMaxSize] = protocolConfig.value(config_key::junkPacketMaxSize); containerConfig[config_key::initPacketJunkSize] = protocolConfig.value(config_key::initPacketJunkSize); containerConfig[config_key::responsePacketJunkSize] = protocolConfig.value(config_key::responsePacketJunkSize); + containerConfig[config_key::cookieReplyPacketJunkSize] = protocolConfig.value(config_key::cookieReplyPacketJunkSize); + containerConfig[config_key::transportPacketJunkSize] = protocolConfig.value(config_key::transportPacketJunkSize); containerConfig[config_key::initPacketMagicHeader] = protocolConfig.value(config_key::initPacketMagicHeader); containerConfig[config_key::responsePacketMagicHeader] = protocolConfig.value(config_key::responsePacketMagicHeader); containerConfig[config_key::underloadPacketMagicHeader] = protocolConfig.value(config_key::underloadPacketMagicHeader); diff --git a/client/ui/controllers/importController.cpp b/client/ui/controllers/importController.cpp index c414f3df..d3efe2fb 100644 --- a/client/ui/controllers/importController.cpp +++ b/client/ui/controllers/importController.cpp @@ -12,6 +12,7 @@ #include "core/errorstrings.h" #include "core/qrCodeUtils.h" #include "core/serialization/serialization.h" +#include "protocols/protocols_defs.h" #include "systemController.h" #include "utilities.h" @@ -51,7 +52,8 @@ namespace || (config.contains(amneziaConfigPatternHostName) && config.contains(amneziaConfigPatternUserName) && config.contains(amneziaConfigPatternPassword))) { return ConfigTypes::Amnezia; - } else if (config.contains(wireguardConfigPatternSectionInterface) && config.contains(wireguardConfigPatternSectionPeer)) { + } else if (config.contains(wireguardConfigPatternSectionInterface) + && config.contains(wireguardConfigPatternSectionPeer)) { return ConfigTypes::WireGuard; } else if ((config.contains(xrayConfigPatternInbound)) && (config.contains(xrayConfigPatternOutbound))) { return ConfigTypes::Xray; @@ -67,7 +69,8 @@ namespace #endif } // namespace -ImportController::ImportController(const QSharedPointer &serversModel, const QSharedPointer &containersModel, +ImportController::ImportController(const QSharedPointer &serversModel, + const QSharedPointer &containersModel, const std::shared_ptr &settings, QObject *parent) : QObject(parent), m_serversModel(serversModel), m_containersModel(containersModel), m_settings(settings) { @@ -102,40 +105,42 @@ bool ImportController::extractConfigFromData(QString data) if (config.startsWith("vless://")) { m_configType = ConfigTypes::Xray; - m_config = extractXrayConfig( - Utils::JsonToString(serialization::vless::Deserialize(config, &prefix, &errormsg), QJsonDocument::JsonFormat::Compact), - prefix); + m_config = extractXrayConfig(Utils::JsonToString(serialization::vless::Deserialize(config, &prefix, &errormsg), + QJsonDocument::JsonFormat::Compact), + prefix); return m_config.empty() ? false : true; } if (config.startsWith("vmess://") && config.contains("@")) { m_configType = ConfigTypes::Xray; - m_config = extractXrayConfig( - Utils::JsonToString(serialization::vmess_new::Deserialize(config, &prefix, &errormsg), QJsonDocument::JsonFormat::Compact), - prefix); + m_config = + extractXrayConfig(Utils::JsonToString(serialization::vmess_new::Deserialize(config, &prefix, &errormsg), + QJsonDocument::JsonFormat::Compact), + prefix); return m_config.empty() ? false : true; } if (config.startsWith("vmess://")) { m_configType = ConfigTypes::Xray; - m_config = extractXrayConfig( - Utils::JsonToString(serialization::vmess::Deserialize(config, &prefix, &errormsg), QJsonDocument::JsonFormat::Compact), - prefix); + m_config = extractXrayConfig(Utils::JsonToString(serialization::vmess::Deserialize(config, &prefix, &errormsg), + QJsonDocument::JsonFormat::Compact), + prefix); return m_config.empty() ? false : true; } if (config.startsWith("trojan://")) { m_configType = ConfigTypes::Xray; - m_config = extractXrayConfig( - Utils::JsonToString(serialization::trojan::Deserialize(config, &prefix, &errormsg), QJsonDocument::JsonFormat::Compact), - prefix); + m_config = extractXrayConfig(Utils::JsonToString(serialization::trojan::Deserialize(config, &prefix, &errormsg), + QJsonDocument::JsonFormat::Compact), + prefix); return m_config.empty() ? false : true; } if (config.startsWith("ss://") && !config.contains("plugin=")) { m_configType = ConfigTypes::ShadowSocks; - m_config = extractXrayConfig( - Utils::JsonToString(serialization::ss::Deserialize(config, &prefix, &errormsg), QJsonDocument::JsonFormat::Compact), prefix); + m_config = extractXrayConfig(Utils::JsonToString(serialization::ss::Deserialize(config, &prefix, &errormsg), + QJsonDocument::JsonFormat::Compact), + prefix); return m_config.empty() ? false : true; } @@ -153,7 +158,8 @@ bool ImportController::extractConfigFromData(QString data) m_configType = checkConfigFormat(config); if (m_configType == ConfigTypes::Invalid) { config.replace("vpn://", ""); - QByteArray ba = QByteArray::fromBase64(config.toUtf8(), QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals); + QByteArray ba = + QByteArray::fromBase64(config.toUtf8(), QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals); QByteArray baUncompressed = qUncompress(ba); if (!baUncompressed.isEmpty()) { ba = baUncompressed; @@ -270,8 +276,10 @@ void ImportController::processNativeWireGuardConfig() auto containers = m_config.value(config_key::containers).toArray(); if (!containers.isEmpty()) { auto container = containers.at(0).toObject(); - auto serverProtocolConfig = container.value(ContainerProps::containerTypeToString(DockerContainer::WireGuard)).toObject(); - auto clientProtocolConfig = QJsonDocument::fromJson(serverProtocolConfig.value(config_key::last_config).toString().toUtf8()).object(); + auto serverProtocolConfig = + container.value(ContainerProps::containerTypeToString(DockerContainer::WireGuard)).toObject(); + auto clientProtocolConfig = + QJsonDocument::fromJson(serverProtocolConfig.value(config_key::last_config).toString().toUtf8()).object(); QString junkPacketCount = QString::number(QRandomGenerator::global()->bounded(2, 5)); QString junkPacketMinSize = QString::number(10); @@ -281,6 +289,8 @@ void ImportController::processNativeWireGuardConfig() clientProtocolConfig[config_key::junkPacketMaxSize] = junkPacketMaxSize; clientProtocolConfig[config_key::initPacketJunkSize] = "0"; clientProtocolConfig[config_key::responsePacketJunkSize] = "0"; + clientProtocolConfig[config_key::cookieReplyPacketJunkSize] = "0"; + clientProtocolConfig[config_key::transportPacketJunkSize] = "0"; clientProtocolConfig[config_key::initPacketMagicHeader] = "1"; clientProtocolConfig[config_key::responsePacketMagicHeader] = "2"; clientProtocolConfig[config_key::underloadPacketMagicHeader] = "3"; @@ -417,7 +427,8 @@ QJsonObject ImportController::extractWireGuardConfig(const QString &data) lastConfig[config_key::hostName] = hostName; lastConfig[config_key::port] = port.toInt(); - if (!configMap.value("PrivateKey").isEmpty() && !configMap.value("Address").isEmpty() && !configMap.value("PublicKey").isEmpty()) { + if (!configMap.value("PrivateKey").isEmpty() && !configMap.value("Address").isEmpty() + && !configMap.value("PublicKey").isEmpty()) { lastConfig[config_key::client_priv_key] = configMap.value("PrivateKey"); lastConfig[config_key::client_ip] = configMap.value("Address"); @@ -447,18 +458,20 @@ QJsonObject ImportController::extractWireGuardConfig(const QString &data) lastConfig[config_key::allowed_ips] = allowedIpsJsonArray; QString protocolName = "wireguard"; - if (!configMap.value(config_key::junkPacketCount).isEmpty() && !configMap.value(config_key::junkPacketMinSize).isEmpty() - && !configMap.value(config_key::junkPacketMaxSize).isEmpty() && !configMap.value(config_key::initPacketJunkSize).isEmpty() - && !configMap.value(config_key::responsePacketJunkSize).isEmpty() && !configMap.value(config_key::initPacketMagicHeader).isEmpty() + if (!configMap.value(config_key::junkPacketCount).isEmpty() + && !configMap.value(config_key::junkPacketMinSize).isEmpty() + && !configMap.value(config_key::junkPacketMaxSize).isEmpty() + && !configMap.value(config_key::initPacketJunkSize).isEmpty() + && !configMap.value(config_key::responsePacketJunkSize).isEmpty() + && !configMap.value(config_key::cookieReplyPacketJunkSize).isEmpty() + && !configMap.value(config_key::transportPacketJunkSize).isEmpty() + && !configMap.value(config_key::initPacketMagicHeader).isEmpty() && !configMap.value(config_key::responsePacketMagicHeader).isEmpty() && !configMap.value(config_key::underloadPacketMagicHeader).isEmpty() && !configMap.value(config_key::transportPacketMagicHeader).isEmpty() - && !configMap.value(config_key::specialJunk1).isEmpty() - && !configMap.value(config_key::specialJunk2).isEmpty() - && !configMap.value(config_key::specialJunk3).isEmpty() - && !configMap.value(config_key::specialJunk4).isEmpty() - && !configMap.value(config_key::specialJunk5).isEmpty() - && !configMap.value(config_key::controlledJunk1).isEmpty() + && !configMap.value(config_key::specialJunk1).isEmpty() && !configMap.value(config_key::specialJunk2).isEmpty() + && !configMap.value(config_key::specialJunk3).isEmpty() && !configMap.value(config_key::specialJunk4).isEmpty() + && !configMap.value(config_key::specialJunk5).isEmpty() && !configMap.value(config_key::controlledJunk1).isEmpty() && !configMap.value(config_key::controlledJunk2).isEmpty() && !configMap.value(config_key::controlledJunk3).isEmpty() && !configMap.value(config_key::specialHandshakeTimeout).isEmpty()) { @@ -467,6 +480,8 @@ QJsonObject ImportController::extractWireGuardConfig(const QString &data) lastConfig[config_key::junkPacketMaxSize] = configMap.value(config_key::junkPacketMaxSize); lastConfig[config_key::initPacketJunkSize] = configMap.value(config_key::initPacketJunkSize); lastConfig[config_key::responsePacketJunkSize] = configMap.value(config_key::responsePacketJunkSize); + lastConfig[config_key::cookieReplyPacketJunkSize] = configMap.value(config_key::cookieReplyPacketJunkSize); + lastConfig[config_key::transportPacketJunkSize] = configMap.value(config_key::transportPacketJunkSize); lastConfig[config_key::initPacketMagicHeader] = configMap.value(config_key::initPacketMagicHeader); lastConfig[config_key::responsePacketMagicHeader] = configMap.value(config_key::responsePacketMagicHeader); lastConfig[config_key::underloadPacketMagicHeader] = configMap.value(config_key::underloadPacketMagicHeader); @@ -487,7 +502,8 @@ QJsonObject ImportController::extractWireGuardConfig(const QString &data) if (!configMap.value("MTU").isEmpty()) { lastConfig[config_key::mtu] = configMap.value("MTU"); } else { - lastConfig[config_key::mtu] = protocolName == "awg" ? protocols::awg::defaultMtu : protocols::wireguard::defaultMtu; + lastConfig[config_key::mtu] = + protocolName == "awg" ? protocols::awg::defaultMtu : protocols::wireguard::defaultMtu; } QJsonObject wireguardConfig; @@ -688,14 +704,23 @@ void ImportController::checkForMaliciousStrings(const QJsonObject &serverConfig) || (containerName == ContainerProps::containerToString(DockerContainer::Cloak)) || (containerName == ContainerProps::containerToString(DockerContainer::ShadowSocks))) { - QString protocolConfig = - containerConfig[ProtocolProps::protoToString(Proto::OpenVpn)].toObject()[config_key::last_config].toString(); - QString protocolConfigJson = QJsonDocument::fromJson(protocolConfig.toUtf8()).object()[config_key::config].toString(); + QString protocolConfig = containerConfig[ProtocolProps::protoToString(Proto::OpenVpn)] + .toObject()[config_key::last_config] + .toString(); + QString protocolConfigJson = + QJsonDocument::fromJson(protocolConfig.toUtf8()).object()[config_key::config].toString(); // https://github.com/OpenVPN/openvpn/blob/master/doc/man-sections/script-options.rst - QStringList dangerousTags { - "up", "tls-verify", "ipchange", "client-connect", "route-up", "route-pre-down", "client-disconnect", "down", "learn-address", "auth-user-pass-verify" - }; + QStringList dangerousTags { "up", + "tls-verify", + "ipchange", + "client-connect", + "route-up", + "route-pre-down", + "client-disconnect", + "down", + "learn-address", + "auth-user-pass-verify" }; QStringList maliciousStrings; QStringList lines = protocolConfigJson.split('\n', Qt::SkipEmptyParts); @@ -709,11 +734,13 @@ void ImportController::checkForMaliciousStrings(const QJsonObject &serverConfig) } } - m_maliciousWarningText = tr("This configuration contains an OpenVPN setup. OpenVPN configurations can include malicious " - "scripts, so only add it if you fully trust the provider of this config. "); + m_maliciousWarningText = + tr("This configuration contains an OpenVPN setup. OpenVPN configurations can include malicious " + "scripts, so only add it if you fully trust the provider of this config. "); if (!maliciousStrings.isEmpty()) { - m_maliciousWarningText.push_back(tr("
In the imported configuration, potentially dangerous lines were found:")); + m_maliciousWarningText.push_back( + tr("
In the imported configuration, potentially dangerous lines were found:")); for (const auto &string : maliciousStrings) { m_maliciousWarningText.push_back(QString("
%1").arg(string)); } @@ -736,8 +763,8 @@ void ImportController::processAmneziaConfig(QJsonObject &config) } QJsonObject jsonConfig = QJsonDocument::fromJson(protocolConfig.toUtf8()).object(); - jsonConfig[config_key::mtu] = - dockerContainer == DockerContainer::Awg ? protocols::awg::defaultMtu : protocols::wireguard::defaultMtu; + jsonConfig[config_key::mtu] = dockerContainer == DockerContainer::Awg ? protocols::awg::defaultMtu + : protocols::wireguard::defaultMtu; containerConfig[config_key::last_config] = QString(QJsonDocument(jsonConfig).toJson()); diff --git a/client/ui/controllers/installController.cpp b/client/ui/controllers/installController.cpp index a673af8a..ed258cd6 100755 --- a/client/ui/controllers/installController.cpp +++ b/client/ui/controllers/installController.cpp @@ -406,6 +406,10 @@ ErrorCode InstallController::getAlreadyInstalledContainers(const ServerCredentia containerConfig[config_key::junkPacketMaxSize] = serverConfigMap.value(config_key::junkPacketMaxSize); containerConfig[config_key::initPacketJunkSize] = serverConfigMap.value(config_key::initPacketJunkSize); containerConfig[config_key::responsePacketJunkSize] = serverConfigMap.value(config_key::responsePacketJunkSize); + containerConfig[config_key::cookieReplyPacketJunkSize] = + serverConfigMap.value(config_key::cookieReplyPacketJunkSize); + containerConfig[config_key::transportPacketJunkSize] = + serverConfigMap.value(config_key::transportPacketJunkSize); containerConfig[config_key::initPacketMagicHeader] = serverConfigMap.value(config_key::initPacketMagicHeader); containerConfig[config_key::responsePacketMagicHeader] = serverConfigMap.value(config_key::responsePacketMagicHeader); containerConfig[config_key::underloadPacketMagicHeader] = diff --git a/client/ui/models/protocols/awgConfigModel.cpp b/client/ui/models/protocols/awgConfigModel.cpp index 108e74e8..df1be466 100644 --- a/client/ui/models/protocols/awgConfigModel.cpp +++ b/client/ui/models/protocols/awgConfigModel.cpp @@ -77,6 +77,12 @@ bool AwgConfigModel::setData(const QModelIndex &index, const QVariant &value, in case Roles::ServerResponsePacketJunkSizeRole: m_serverProtocolConfig.insert(config_key::responsePacketJunkSize, value.toString()); break; + case Roles::ServerCookieReplyPacketJunkSizeRole: + m_serverProtocolConfig.insert(config_key::cookieReplyPacketJunkSize, value.toString()); + break; + case Roles::ServerTransportPacketJunkSizeRole: + m_serverProtocolConfig.insert(config_key::transportPacketJunkSize, value.toString()); + break; case Roles::ServerInitPacketMagicHeaderRole: m_serverProtocolConfig.insert(config_key::initPacketMagicHeader, value.toString()); break; @@ -126,6 +132,10 @@ QVariant AwgConfigModel::data(const QModelIndex &index, int role) const case Roles::ServerInitPacketJunkSizeRole: return m_serverProtocolConfig.value(config_key::initPacketJunkSize); case Roles::ServerResponsePacketJunkSizeRole: return m_serverProtocolConfig.value(config_key::responsePacketJunkSize); + case Roles::ServerCookieReplyPacketJunkSizeRole: + return m_serverProtocolConfig.value(config_key::cookieReplyPacketJunkSize); + case Roles::ServerTransportPacketJunkSizeRole: + return m_serverProtocolConfig.value(config_key::transportPacketJunkSize); case Roles::ServerInitPacketMagicHeaderRole: return m_serverProtocolConfig.value(config_key::initPacketMagicHeader); case Roles::ServerResponsePacketMagicHeaderRole: return m_serverProtocolConfig.value(config_key::responsePacketMagicHeader); @@ -167,6 +177,12 @@ void AwgConfigModel::updateModel(const QJsonObject &config) m_serverProtocolConfig[config_key::responsePacketJunkSize] = serverProtocolConfig.value(config_key::responsePacketJunkSize) .toString(protocols::awg::defaultResponsePacketJunkSize); + m_serverProtocolConfig[config_key::cookieReplyPacketJunkSize] = + serverProtocolConfig.value(config_key::cookieReplyPacketJunkSize) + .toString(protocols::awg::defaultCookieReplyPacketJunkSize); + m_serverProtocolConfig[config_key::transportPacketJunkSize] = + serverProtocolConfig.value(config_key::transportPacketJunkSize) + .toString(protocols::awg::defaultTransportPacketJunkSize); m_serverProtocolConfig[config_key::initPacketMagicHeader] = serverProtocolConfig.value(config_key::initPacketMagicHeader) .toString(protocols::awg::defaultInitPacketMagicHeader); diff --git a/client/ui/qml/Pages2/PageProtocolAwgClientSettings.qml b/client/ui/qml/Pages2/PageProtocolAwgClientSettings.qml index 24755e09..3206c4b9 100644 --- a/client/ui/qml/Pages2/PageProtocolAwgClientSettings.qml +++ b/client/ui/qml/Pages2/PageProtocolAwgClientSettings.qml @@ -349,6 +349,28 @@ PageType { textField.text: serverResponsePacketJunkSize } + TextFieldWithHeaderType { + id: cookieReplyPacketJunkSizeTextField + Layout.fillWidth: true + Layout.topMargin: 16 + + enabled: false + + headerText: "S3 - Cookie Reply packet junk size" + textField.text: serverCookieReplyPacketJunkSize + } + + TextFieldWithHeaderType { + id: transportPacketJunkSizeTextField + Layout.fillWidth: true + Layout.topMargin: 16 + + enabled: false + + headerText: "S4 - Transport packet junk size" + textField.text: serverTransportPacketJunkSize + } + TextFieldWithHeaderType { id: initPacketMagicHeaderTextField Layout.fillWidth: true diff --git a/client/ui/qml/Pages2/PageProtocolAwgSettings.qml b/client/ui/qml/Pages2/PageProtocolAwgSettings.qml index 6c3fda94..c13c4c18 100644 --- a/client/ui/qml/Pages2/PageProtocolAwgSettings.qml +++ b/client/ui/qml/Pages2/PageProtocolAwgSettings.qml @@ -378,7 +378,7 @@ PageType { initPacketMagicHeaderTextField.errorText === "" && responsePacketJunkSizeTextField.errorText === "" && cookieReplyHeaderJunkTextField.errorText === "" && - transportHeaderJunkTextField.errorText === "" && + transportHeaderJunkTextField.errorText === "" && initPacketJunkSizeTextField.errorText === "" && junkPacketMaxSizeTextField.errorText === "" && junkPacketMinSizeTextField.errorText === "" &&