Merge branch 'dev' of github.com:amnezia-vpn/amnezia-client into dev
This commit is contained in:
commit
dadf0cf96e
7 changed files with 73 additions and 54 deletions
|
@ -1,5 +1,7 @@
|
|||
#include "protocols_defs.h"
|
||||
|
||||
#include <QRandomGenerator>
|
||||
|
||||
using namespace amnezia;
|
||||
|
||||
QDebug operator<<(QDebug debug, const amnezia::ProtocolEnumNS::Proto &p)
|
||||
|
@ -98,15 +100,28 @@ amnezia::ServiceType ProtocolProps::protocolService(Proto p)
|
|||
}
|
||||
}
|
||||
|
||||
int ProtocolProps::getPortForInstall(Proto p)
|
||||
{
|
||||
switch (p) {
|
||||
case Awg:
|
||||
case WireGuard:
|
||||
case ShadowSocks:
|
||||
case OpenVpn:
|
||||
return QRandomGenerator::global()->bounded(30000, 50000);
|
||||
default:
|
||||
return defaultPort(p);
|
||||
}
|
||||
}
|
||||
|
||||
int ProtocolProps::defaultPort(Proto p)
|
||||
{
|
||||
switch (p) {
|
||||
case Proto::Any: return -1;
|
||||
case Proto::OpenVpn: return 1194;
|
||||
case Proto::Cloak: return 443;
|
||||
case Proto::ShadowSocks: return 6789;
|
||||
case Proto::WireGuard: return 51820;
|
||||
case Proto::Awg: return 55424;
|
||||
case Proto::OpenVpn: return QString(protocols::openvpn::defaultPort).toInt();
|
||||
case Proto::Cloak: return QString(protocols::cloak::defaultPort).toInt();
|
||||
case Proto::ShadowSocks: return QString(protocols::shadowsocks::defaultPort).toInt();
|
||||
case Proto::WireGuard: return QString(protocols::wireguard::defaultPort).toInt();
|
||||
case Proto::Awg: return QString(protocols::awg::defaultPort).toInt();
|
||||
case Proto::Ikev2: return -1;
|
||||
case Proto::L2tp: return -1;
|
||||
|
||||
|
|
|
@ -228,6 +228,8 @@ namespace amnezia
|
|||
|
||||
Q_INVOKABLE static ServiceType protocolService(Proto p);
|
||||
|
||||
Q_INVOKABLE static int getPortForInstall(Proto p);
|
||||
|
||||
Q_INVOKABLE static int defaultPort(Proto p);
|
||||
Q_INVOKABLE static bool defaultPortChangeable(Proto p);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ if ! command -v sudo > /dev/null 2>&1; then $pm update -yq; $pm install -yq sudo
|
|||
if ! command -v fuser > /dev/null 2>&1; then sudo $pm install -yq psmisc; fi;\
|
||||
if ! command -v lsof > /dev/null 2>&1; then sudo $pm install -yq lsof; fi;\
|
||||
if ! command -v docker > /dev/null 2>&1; then sudo $pm update -yq; sudo $pm install -yq $docker_pkg;\
|
||||
if [ "$dist" = "fedora" ] || [ "$dist" = "debian" ]; then sudo systemctl enable docker && sudo systemctl start docker; fi;\
|
||||
if [ "$dist" = "fedora" ] || [ "$dist" = "centos" ] || [ "$dist" = "debian" ]; then sudo systemctl enable docker && sudo systemctl start docker; fi;\
|
||||
fi;\
|
||||
if [ "$dist" = "debian" ]; then \
|
||||
docker_service=$(systemctl list-units --full --all | grep docker.service | grep -v inactive | grep -v dead | grep -v failed);\
|
||||
|
|
|
@ -143,58 +143,58 @@
|
|||
<context>
|
||||
<name>InstallController</name>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="141"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="191"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="143"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="193"/>
|
||||
<source>%1 installed successfully. </source>
|
||||
<translation>%1 успешно установлен. </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="143"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="193"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="145"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="195"/>
|
||||
<source>%1 is already installed on the server. </source>
|
||||
<translation>%1 уже установлен на сервер. </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="146"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="148"/>
|
||||
<source>
|
||||
Added containers that were already installed on the server</source>
|
||||
<translation>
|
||||
В приложение добавлены обнаруженные на сервере протоклы и сервисы</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="212"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="214"/>
|
||||
<source>
|
||||
Already installed containers were found on the server. All installed containers have been added to the application</source>
|
||||
<translation>
|
||||
На сервере обнаружены установленные протоколы и сервисы, все они добавлены в приложение</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="293"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="295"/>
|
||||
<source>Settings updated successfully</source>
|
||||
<translation>Настройки успешно обновлены</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="308"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="310"/>
|
||||
<source>Server '%1' was removed</source>
|
||||
<translation>Сервер '%1' был удален</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="318"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="320"/>
|
||||
<source>All containers from server '%1' have been removed</source>
|
||||
<translation>Все протоклы и сервисы были удалены с сервера '%1'</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="335"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="337"/>
|
||||
<source>%1 has been removed from the server '%2'</source>
|
||||
<translation>%1 был удален с сервера '%2'</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="481"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="483"/>
|
||||
<source>Please login as the user</source>
|
||||
<translation>Пожалуйста, войдите в систему от имени пользователя</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="509"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="511"/>
|
||||
<source>Server added successfully</source>
|
||||
<translation>Сервер успешно добавлен</translation>
|
||||
</message>
|
||||
|
@ -2636,7 +2636,7 @@ This means that AmneziaWG keeps the fast performance of the original while addin
|
|||
<translation>Сервис обмена файлами Sftp - безопасный FTP-сервис</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../protocols/protocols_defs.cpp" line="75"/>
|
||||
<location filename="../protocols/protocols_defs.cpp" line="77"/>
|
||||
<source>Sftp service</source>
|
||||
<translation>Сервис SFTP</translation>
|
||||
</message>
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
<message>
|
||||
<location filename="../ui/qml/Components/HomeContainersListView.qml" line="58"/>
|
||||
<source>Unable change protocol while there is an active connection</source>
|
||||
<translation>Невозможно изменить протокол при наличии активного соединения</translation>
|
||||
<translation type="unfinished">已建立连接时无法更改服务器配置</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/qml/Components/HomeContainersListView.qml" line="69"/>
|
||||
|
@ -162,47 +162,47 @@
|
|||
<translation type="obsolete"> 已安装在服务器上</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="141"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="191"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="143"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="193"/>
|
||||
<source>%1 installed successfully. </source>
|
||||
<translation>%1 安装成功。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="143"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="193"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="145"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="195"/>
|
||||
<source>%1 is already installed on the server. </source>
|
||||
<translation>服务器上已经安装 %1。</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="146"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="148"/>
|
||||
<source>
|
||||
Added containers that were already installed on the server</source>
|
||||
<translation>添加已安装在服务器上的容器</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="212"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="214"/>
|
||||
<source>
|
||||
Already installed containers were found on the server. All installed containers have been added to the application</source>
|
||||
<translation>
|
||||
在服务上发现已经安装协议并添加至应用</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="293"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="295"/>
|
||||
<source>Settings updated successfully</source>
|
||||
<translation>配置更新成功</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="308"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="310"/>
|
||||
<source>Server '%1' was removed</source>
|
||||
<translation>已移除服务器 '%1'</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="318"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="320"/>
|
||||
<source>All containers from server '%1' have been removed</source>
|
||||
<translation>服务器 '%1' 的所有容器已移除</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="335"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="337"/>
|
||||
<source>%1 has been removed from the server '%2'</source>
|
||||
<translation>%1 已从服务器 '%2' 上移除</translation>
|
||||
</message>
|
||||
|
@ -223,12 +223,12 @@ Already installed containers were found on the server. All installed containers
|
|||
<translation type="obsolete"> 协议已从</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="481"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="483"/>
|
||||
<source>Please login as the user</source>
|
||||
<translation>请以用户身份登录</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/controllers/installController.cpp" line="509"/>
|
||||
<location filename="../ui/controllers/installController.cpp" line="511"/>
|
||||
<source>Server added successfully</source>
|
||||
<translation>增加服务器成功</translation>
|
||||
</message>
|
||||
|
@ -308,7 +308,7 @@ Already installed containers were found on the server. All installed containers
|
|||
<message>
|
||||
<location filename="../ui/qml/Pages2/PageHome.qml" line="490"/>
|
||||
<source>Unable change server while there is an active connection</source>
|
||||
<translation>Невозможно изменить сервер при наличии активного соединения</translation>
|
||||
<translation>已建立连接时无法更改服务器配置</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
@ -2335,7 +2335,7 @@ and will not be shared or disclosed to the Amnezia or any third parties</source>
|
|||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../protocols/protocols_defs.cpp" line="75"/>
|
||||
<location filename="../protocols/protocols_defs.cpp" line="77"/>
|
||||
<source>Sftp service</source>
|
||||
<translation>Sftp 服务</translation>
|
||||
</message>
|
||||
|
|
|
@ -75,33 +75,35 @@ void InstallController::install(DockerContainer container, int port, TransportPr
|
|||
ProtocolProps::transportProtoToString(transportProto, protocol));
|
||||
|
||||
if (container == DockerContainer::Awg) {
|
||||
QString defaultJunkPacketCount = QString::number(QRandomGenerator::global()->bounded(3, 10));
|
||||
QString defaultJunkPacketMinSize = QString::number(50);
|
||||
QString defaultJunkPacketMaxSize = QString::number(1000);
|
||||
QString defaultInitPacketJunkSize = QString::number(QRandomGenerator::global()->bounded(15, 150));
|
||||
QString defaultResponsePacketJunkSize = QString::number(QRandomGenerator::global()->bounded(15, 150));
|
||||
QString junkPacketCount = QString::number(QRandomGenerator::global()->bounded(3, 10));
|
||||
QString junkPacketMinSize = QString::number(50);
|
||||
QString junkPacketMaxSize = QString::number(1000);
|
||||
QString initPacketJunkSize = QString::number(QRandomGenerator::global()->bounded(15, 150));
|
||||
QString responsePacketJunkSize = QString::number(QRandomGenerator::global()->bounded(15, 150));
|
||||
|
||||
QSet<QString> headersValue;
|
||||
while (headersValue.size() != 4) {
|
||||
headersValue.insert(QString::number(QRandomGenerator::global()->bounded(1, std::numeric_limits<qint32>::max())));
|
||||
|
||||
auto max = (std::numeric_limits<qint32>::max)();
|
||||
headersValue.insert(QString::number(QRandomGenerator::global()->bounded(1, max)));
|
||||
}
|
||||
|
||||
auto headersValueList = headersValue.values();
|
||||
|
||||
QString defaultInitPacketMagicHeader = headersValueList.at(0);
|
||||
QString defaultResponsePacketMagicHeader = headersValueList.at(1);
|
||||
QString defaultUnderloadPacketMagicHeader = headersValueList.at(2);
|
||||
QString defaultTransportPacketMagicHeader = headersValueList.at(3);
|
||||
QString initPacketMagicHeader = headersValueList.at(0);
|
||||
QString responsePacketMagicHeader = headersValueList.at(1);
|
||||
QString underloadPacketMagicHeader = headersValueList.at(2);
|
||||
QString transportPacketMagicHeader = headersValueList.at(3);
|
||||
|
||||
containerConfig[config_key::junkPacketCount] = defaultJunkPacketCount;
|
||||
containerConfig[config_key::junkPacketMinSize] = defaultJunkPacketMinSize;
|
||||
containerConfig[config_key::junkPacketMaxSize] = defaultJunkPacketMaxSize;
|
||||
containerConfig[config_key::initPacketJunkSize] = defaultInitPacketJunkSize;
|
||||
containerConfig[config_key::responsePacketJunkSize] = defaultResponsePacketJunkSize;
|
||||
containerConfig[config_key::initPacketMagicHeader] = defaultInitPacketMagicHeader;
|
||||
containerConfig[config_key::responsePacketMagicHeader] = defaultResponsePacketMagicHeader;
|
||||
containerConfig[config_key::underloadPacketMagicHeader] = defaultUnderloadPacketMagicHeader;
|
||||
containerConfig[config_key::transportPacketMagicHeader] = defaultTransportPacketMagicHeader;
|
||||
containerConfig[config_key::junkPacketCount] = junkPacketCount;
|
||||
containerConfig[config_key::junkPacketMinSize] = junkPacketMinSize;
|
||||
containerConfig[config_key::junkPacketMaxSize] = junkPacketMaxSize;
|
||||
containerConfig[config_key::initPacketJunkSize] = initPacketJunkSize;
|
||||
containerConfig[config_key::responsePacketJunkSize] = responsePacketJunkSize;
|
||||
containerConfig[config_key::initPacketMagicHeader] = initPacketMagicHeader;
|
||||
containerConfig[config_key::responsePacketMagicHeader] = responsePacketMagicHeader;
|
||||
containerConfig[config_key::underloadPacketMagicHeader] = underloadPacketMagicHeader;
|
||||
containerConfig[config_key::transportPacketMagicHeader] = transportPacketMagicHeader;
|
||||
}
|
||||
|
||||
if (container == DockerContainer::Sftp) {
|
||||
|
|
|
@ -224,7 +224,7 @@ PageType {
|
|||
if (ProtocolProps.defaultPort(defaultContainerProto) < 0) {
|
||||
port.visible = false
|
||||
} else {
|
||||
port.textFieldText = ProtocolProps.defaultPort(defaultContainerProto)
|
||||
port.textFieldText = ProtocolProps.getPortForInstall(defaultContainerProto)
|
||||
}
|
||||
transportProtoSelector.currentIndex = ProtocolProps.defaultTransportProto(defaultContainerProto)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue