renamed amenziawireguard to awg
This commit is contained in:
parent
16fc0617e4
commit
aa4a79934a
29 changed files with 105 additions and 108 deletions
|
@ -321,8 +321,8 @@ void AmneziaApplication::initModels()
|
||||||
m_wireGuardConfigModel.reset(new WireGuardConfigModel(this));
|
m_wireGuardConfigModel.reset(new WireGuardConfigModel(this));
|
||||||
m_engine->rootContext()->setContextProperty("WireGuardConfigModel", m_wireGuardConfigModel.get());
|
m_engine->rootContext()->setContextProperty("WireGuardConfigModel", m_wireGuardConfigModel.get());
|
||||||
|
|
||||||
m_amneziaWireGuardConfigModel.reset(new AmneziaWireGuardConfigModel(this));
|
m_awgConfigModel.reset(new AwgConfigModel(this));
|
||||||
m_engine->rootContext()->setContextProperty("AmneziaWireGuardConfigModel", m_amneziaWireGuardConfigModel.get());
|
m_engine->rootContext()->setContextProperty("AwgConfigModel", m_awgConfigModel.get());
|
||||||
|
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
m_ikev2ConfigModel.reset(new Ikev2ConfigModel(this));
|
m_ikev2ConfigModel.reset(new Ikev2ConfigModel(this));
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
#include "ui/models/protocols/ikev2ConfigModel.h"
|
#include "ui/models/protocols/ikev2ConfigModel.h"
|
||||||
#endif
|
#endif
|
||||||
#include "ui/models/protocols/amneziaWireGuardConfigModel.h"
|
#include "ui/models/protocols/awgConfigModel.h"
|
||||||
#include "ui/models/protocols/openvpnConfigModel.h"
|
#include "ui/models/protocols/openvpnConfigModel.h"
|
||||||
#include "ui/models/protocols/shadowsocksConfigModel.h"
|
#include "ui/models/protocols/shadowsocksConfigModel.h"
|
||||||
#include "ui/models/protocols/wireguardConfigModel.h"
|
#include "ui/models/protocols/wireguardConfigModel.h"
|
||||||
|
@ -99,7 +99,7 @@ private:
|
||||||
QScopedPointer<ShadowSocksConfigModel> m_shadowSocksConfigModel;
|
QScopedPointer<ShadowSocksConfigModel> m_shadowSocksConfigModel;
|
||||||
QScopedPointer<CloakConfigModel> m_cloakConfigModel;
|
QScopedPointer<CloakConfigModel> m_cloakConfigModel;
|
||||||
QScopedPointer<WireGuardConfigModel> m_wireGuardConfigModel;
|
QScopedPointer<WireGuardConfigModel> m_wireGuardConfigModel;
|
||||||
QScopedPointer<AmneziaWireGuardConfigModel> m_amneziaWireGuardConfigModel;
|
QScopedPointer<AwgConfigModel> m_awgConfigModel;
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
QScopedPointer<Ikev2ConfigModel> m_ikev2ConfigModel;
|
QScopedPointer<Ikev2ConfigModel> m_ikev2ConfigModel;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
|
|
||||||
#include "core/servercontroller.h"
|
#include "core/servercontroller.h"
|
||||||
|
|
||||||
AmneziaWireGuardConfigurator::AmneziaWireGuardConfigurator(std::shared_ptr<Settings> settings, QObject *parent)
|
AwgConfigurator::AwgConfigurator(std::shared_ptr<Settings> settings, QObject *parent)
|
||||||
: WireguardConfigurator(settings, true, parent)
|
: WireguardConfigurator(settings, true, parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AmneziaWireGuardConfigurator::genAmneziaWireGuardConfig(const ServerCredentials &credentials,
|
QString AwgConfigurator::genAwgConfig(const ServerCredentials &credentials,
|
||||||
DockerContainer container,
|
DockerContainer container,
|
||||||
const QJsonObject &containerConfig, ErrorCode *errorCode)
|
const QJsonObject &containerConfig, ErrorCode *errorCode)
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@ QString AmneziaWireGuardConfigurator::genAmneziaWireGuardConfig(const ServerCred
|
||||||
QJsonObject jsonConfig = QJsonDocument::fromJson(config.toUtf8()).object();
|
QJsonObject jsonConfig = QJsonDocument::fromJson(config.toUtf8()).object();
|
||||||
|
|
||||||
ServerController serverController(m_settings);
|
ServerController serverController(m_settings);
|
||||||
QString serverConfig = serverController.getTextFileFromContainer(container, credentials, protocols::amneziawireguard::serverConfigPath, errorCode);
|
QString serverConfig = serverController.getTextFileFromContainer(container, credentials, protocols::awg::serverConfigPath, errorCode);
|
||||||
|
|
||||||
QMap<QString, QString> serverConfigMap;
|
QMap<QString, QString> serverConfigMap;
|
||||||
auto serverConfigLines = serverConfig.split("\n");
|
auto serverConfigLines = serverConfig.split("\n");
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
#ifndef AMNEZIAWIREGUARDCONFIGURATOR_H
|
#ifndef AWGCONFIGURATOR_H
|
||||||
#define AMNEZIAWIREGUARDCONFIGURATOR_H
|
#define AWGCONFIGURATOR_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include "wireguard_configurator.h"
|
#include "wireguard_configurator.h"
|
||||||
|
|
||||||
class AmneziaWireGuardConfigurator : public WireguardConfigurator
|
class AwgConfigurator : public WireguardConfigurator
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AmneziaWireGuardConfigurator(std::shared_ptr<Settings> settings, QObject *parent = nullptr);
|
AwgConfigurator(std::shared_ptr<Settings> settings, QObject *parent = nullptr);
|
||||||
|
|
||||||
QString genAmneziaWireGuardConfig(const ServerCredentials &credentials, DockerContainer container,
|
QString genAwgConfig(const ServerCredentials &credentials, DockerContainer container,
|
||||||
const QJsonObject &containerConfig, ErrorCode *errorCode = nullptr);
|
const QJsonObject &containerConfig, ErrorCode *errorCode = nullptr);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AMNEZIAWIREGUARDCONFIGURATOR_H
|
#endif // AWGCONFIGURATOR_H
|
||||||
|
|
|
@ -24,7 +24,7 @@ VpnConfigurator::VpnConfigurator(std::shared_ptr<Settings> settings, QObject *pa
|
||||||
wireguardConfigurator = std::shared_ptr<WireguardConfigurator>(new WireguardConfigurator(settings, false, this));
|
wireguardConfigurator = std::shared_ptr<WireguardConfigurator>(new WireguardConfigurator(settings, false, this));
|
||||||
ikev2Configurator = std::shared_ptr<Ikev2Configurator>(new Ikev2Configurator(settings, this));
|
ikev2Configurator = std::shared_ptr<Ikev2Configurator>(new Ikev2Configurator(settings, this));
|
||||||
sshConfigurator = std::shared_ptr<SshConfigurator>(new SshConfigurator(settings, this));
|
sshConfigurator = std::shared_ptr<SshConfigurator>(new SshConfigurator(settings, this));
|
||||||
amneziaWireGuardConfigurator = std::shared_ptr<AmneziaWireGuardConfigurator>(new AmneziaWireGuardConfigurator(settings, this));
|
awgConfigurator = std::shared_ptr<AwgConfigurator>(new AwgConfigurator(settings, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VpnConfigurator::genVpnProtocolConfig(const ServerCredentials &credentials, DockerContainer container,
|
QString VpnConfigurator::genVpnProtocolConfig(const ServerCredentials &credentials, DockerContainer container,
|
||||||
|
@ -42,8 +42,8 @@ QString VpnConfigurator::genVpnProtocolConfig(const ServerCredentials &credentia
|
||||||
case Proto::WireGuard:
|
case Proto::WireGuard:
|
||||||
return wireguardConfigurator->genWireguardConfig(credentials, container, containerConfig, errorCode);
|
return wireguardConfigurator->genWireguardConfig(credentials, container, containerConfig, errorCode);
|
||||||
|
|
||||||
case Proto::AmneziaWireGuard:
|
case Proto::Awg:
|
||||||
return amneziaWireGuardConfigurator->genAmneziaWireGuardConfig(credentials, container, containerConfig, errorCode);
|
return awgConfigurator->genAwgConfig(credentials, container, containerConfig, errorCode);
|
||||||
|
|
||||||
case Proto::Ikev2: return ikev2Configurator->genIkev2Config(credentials, container, containerConfig, errorCode);
|
case Proto::Ikev2: return ikev2Configurator->genIkev2Config(credentials, container, containerConfig, errorCode);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class CloakConfigurator;
|
||||||
class WireguardConfigurator;
|
class WireguardConfigurator;
|
||||||
class Ikev2Configurator;
|
class Ikev2Configurator;
|
||||||
class SshConfigurator;
|
class SshConfigurator;
|
||||||
class AmneziaWireGuardConfigurator;
|
class AwgConfigurator;
|
||||||
|
|
||||||
// Retrieve connection settings from server
|
// Retrieve connection settings from server
|
||||||
class VpnConfigurator : ConfiguratorBase
|
class VpnConfigurator : ConfiguratorBase
|
||||||
|
@ -41,7 +41,7 @@ public:
|
||||||
std::shared_ptr<WireguardConfigurator> wireguardConfigurator;
|
std::shared_ptr<WireguardConfigurator> wireguardConfigurator;
|
||||||
std::shared_ptr<Ikev2Configurator> ikev2Configurator;
|
std::shared_ptr<Ikev2Configurator> ikev2Configurator;
|
||||||
std::shared_ptr<SshConfigurator> sshConfigurator;
|
std::shared_ptr<SshConfigurator> sshConfigurator;
|
||||||
std::shared_ptr<AmneziaWireGuardConfigurator> amneziaWireGuardConfigurator;
|
std::shared_ptr<AwgConfigurator> awgConfigurator;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VPN_CONFIGURATOR_H
|
#endif // VPN_CONFIGURATOR_H
|
||||||
|
|
|
@ -19,20 +19,20 @@
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
|
|
||||||
WireguardConfigurator::WireguardConfigurator(std::shared_ptr<Settings> settings, bool isAmneziaWireGuard, QObject *parent)
|
WireguardConfigurator::WireguardConfigurator(std::shared_ptr<Settings> settings, bool isAwg, QObject *parent)
|
||||||
: ConfiguratorBase(settings, parent), m_isAmneziaWireGuard(isAmneziaWireGuard)
|
: ConfiguratorBase(settings, parent), m_isAwg(isAwg)
|
||||||
{
|
{
|
||||||
m_serverConfigPath = m_isAmneziaWireGuard ? amnezia::protocols::amneziawireguard::serverConfigPath
|
m_serverConfigPath = m_isAwg ? amnezia::protocols::awg::serverConfigPath
|
||||||
: amnezia::protocols::wireguard::serverConfigPath;
|
: amnezia::protocols::wireguard::serverConfigPath;
|
||||||
m_serverPublicKeyPath = m_isAmneziaWireGuard ? amnezia::protocols::amneziawireguard::serverPublicKeyPath
|
m_serverPublicKeyPath = m_isAwg ? amnezia::protocols::awg::serverPublicKeyPath
|
||||||
: amnezia::protocols::wireguard::serverPublicKeyPath;
|
: amnezia::protocols::wireguard::serverPublicKeyPath;
|
||||||
m_serverPskKeyPath = m_isAmneziaWireGuard ? amnezia::protocols::amneziawireguard::serverPskKeyPath
|
m_serverPskKeyPath = m_isAwg ? amnezia::protocols::awg::serverPskKeyPath
|
||||||
: amnezia::protocols::wireguard::serverPskKeyPath;
|
: amnezia::protocols::wireguard::serverPskKeyPath;
|
||||||
m_configTemplate = m_isAmneziaWireGuard ? ProtocolScriptType::amnezia_wireguard_template
|
m_configTemplate = m_isAwg ? ProtocolScriptType::amnezia_wireguard_template
|
||||||
: ProtocolScriptType::wireguard_template;
|
: ProtocolScriptType::wireguard_template;
|
||||||
|
|
||||||
m_protocolName = m_isAmneziaWireGuard ? config_key::amneziaWireguard : config_key::wireguard;
|
m_protocolName = m_isAwg ? config_key::awg : config_key::wireguard;
|
||||||
m_defaultPort = m_isAmneziaWireGuard ? protocols::wireguard::defaultPort : protocols::amneziawireguard::defaultPort;
|
m_defaultPort = m_isAwg ? protocols::wireguard::defaultPort : protocols::awg::defaultPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
WireguardConfigurator::ConnectionData WireguardConfigurator::genClientKeys()
|
WireguardConfigurator::ConnectionData WireguardConfigurator::genClientKeys()
|
||||||
|
|
|
@ -12,7 +12,7 @@ class WireguardConfigurator : public ConfiguratorBase
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
WireguardConfigurator(std::shared_ptr<Settings> settings, bool isAmneziaWireGuard, QObject *parent = nullptr);
|
WireguardConfigurator(std::shared_ptr<Settings> settings, bool isAwg, QObject *parent = nullptr);
|
||||||
|
|
||||||
struct ConnectionData
|
struct ConnectionData
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@ private:
|
||||||
|
|
||||||
ConnectionData genClientKeys();
|
ConnectionData genClientKeys();
|
||||||
|
|
||||||
bool m_isAmneziaWireGuard;
|
bool m_isAwg;
|
||||||
QString m_serverConfigPath;
|
QString m_serverConfigPath;
|
||||||
QString m_serverPublicKeyPath;
|
QString m_serverPublicKeyPath;
|
||||||
QString m_serverPskKeyPath;
|
QString m_serverPskKeyPath;
|
||||||
|
|
|
@ -84,7 +84,7 @@ QMap<DockerContainer, QString> ContainerProps::containerHumanNames()
|
||||||
{ DockerContainer::ShadowSocks, "ShadowSocks" },
|
{ DockerContainer::ShadowSocks, "ShadowSocks" },
|
||||||
{ DockerContainer::Cloak, "OpenVPN over Cloak" },
|
{ DockerContainer::Cloak, "OpenVPN over Cloak" },
|
||||||
{ DockerContainer::WireGuard, "WireGuard" },
|
{ DockerContainer::WireGuard, "WireGuard" },
|
||||||
{ DockerContainer::AmneziaWireGuard, "Amnezia WireGuard" },
|
{ DockerContainer::Awg, "Amnezia WireGuard" },
|
||||||
{ DockerContainer::Ipsec, QObject::tr("IPsec") },
|
{ DockerContainer::Ipsec, QObject::tr("IPsec") },
|
||||||
|
|
||||||
{ DockerContainer::TorWebSite, QObject::tr("Website in Tor network") },
|
{ DockerContainer::TorWebSite, QObject::tr("Website in Tor network") },
|
||||||
|
@ -108,7 +108,7 @@ QMap<DockerContainer, QString> ContainerProps::containerDescriptions()
|
||||||
{ DockerContainer::WireGuard,
|
{ DockerContainer::WireGuard,
|
||||||
QObject::tr("WireGuard - New popular VPN protocol with high performance, high speed and low power "
|
QObject::tr("WireGuard - New popular VPN protocol with high performance, high speed and low power "
|
||||||
"consumption. Recommended for regions with low levels of censorship.") },
|
"consumption. Recommended for regions with low levels of censorship.") },
|
||||||
{ DockerContainer::AmneziaWireGuard,
|
{ DockerContainer::Awg,
|
||||||
QObject::tr("WireGuard - New popular VPN protocol with high performance, high speed and low power "
|
QObject::tr("WireGuard - New popular VPN protocol with high performance, high speed and low power "
|
||||||
"consumption. Recommended for regions with low levels of censorship.") },
|
"consumption. Recommended for regions with low levels of censorship.") },
|
||||||
{ DockerContainer::Ipsec,
|
{ DockerContainer::Ipsec,
|
||||||
|
@ -148,7 +148,7 @@ amnezia::ServiceType ContainerProps::containerService(DockerContainer c)
|
||||||
case DockerContainer::Cloak: return ServiceType::Vpn;
|
case DockerContainer::Cloak: return ServiceType::Vpn;
|
||||||
case DockerContainer::ShadowSocks: return ServiceType::Vpn;
|
case DockerContainer::ShadowSocks: return ServiceType::Vpn;
|
||||||
case DockerContainer::WireGuard: return ServiceType::Vpn;
|
case DockerContainer::WireGuard: return ServiceType::Vpn;
|
||||||
case DockerContainer::AmneziaWireGuard: return ServiceType::Vpn;
|
case DockerContainer::Awg: return ServiceType::Vpn;
|
||||||
case DockerContainer::Ipsec: return ServiceType::Vpn;
|
case DockerContainer::Ipsec: return ServiceType::Vpn;
|
||||||
case DockerContainer::TorWebSite: return ServiceType::Other;
|
case DockerContainer::TorWebSite: return ServiceType::Other;
|
||||||
case DockerContainer::Dns: return ServiceType::Other;
|
case DockerContainer::Dns: return ServiceType::Other;
|
||||||
|
@ -166,7 +166,7 @@ Proto ContainerProps::defaultProtocol(DockerContainer c)
|
||||||
case DockerContainer::Cloak: return Proto::Cloak;
|
case DockerContainer::Cloak: return Proto::Cloak;
|
||||||
case DockerContainer::ShadowSocks: return Proto::ShadowSocks;
|
case DockerContainer::ShadowSocks: return Proto::ShadowSocks;
|
||||||
case DockerContainer::WireGuard: return Proto::WireGuard;
|
case DockerContainer::WireGuard: return Proto::WireGuard;
|
||||||
case DockerContainer::AmneziaWireGuard: return Proto::AmneziaWireGuard;
|
case DockerContainer::Awg: return Proto::Awg;
|
||||||
case DockerContainer::Ipsec: return Proto::Ikev2;
|
case DockerContainer::Ipsec: return Proto::Ikev2;
|
||||||
|
|
||||||
case DockerContainer::TorWebSite: return Proto::TorWebSite;
|
case DockerContainer::TorWebSite: return Proto::TorWebSite;
|
||||||
|
@ -186,7 +186,7 @@ bool ContainerProps::isSupportedByCurrentPlatform(DockerContainer c)
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case DockerContainer::WireGuard: return true;
|
case DockerContainer::WireGuard: return true;
|
||||||
case DockerContainer::OpenVpn: return true;
|
case DockerContainer::OpenVpn: return true;
|
||||||
case DockerContainer::AmneziaWireGuard: return true;
|
case DockerContainer::Awg: return true;
|
||||||
case DockerContainer::Cloak:
|
case DockerContainer::Cloak:
|
||||||
return true;
|
return true;
|
||||||
// case DockerContainer::ShadowSocks: return true;
|
// case DockerContainer::ShadowSocks: return true;
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace amnezia
|
||||||
ShadowSocks,
|
ShadowSocks,
|
||||||
Cloak,
|
Cloak,
|
||||||
WireGuard,
|
WireGuard,
|
||||||
AmneziaWireGuard,
|
Awg,
|
||||||
Ipsec,
|
Ipsec,
|
||||||
|
|
||||||
// non-vpn
|
// non-vpn
|
||||||
|
|
|
@ -11,7 +11,7 @@ QString amnezia::scriptFolder(amnezia::DockerContainer container)
|
||||||
case DockerContainer::Cloak: return QLatin1String("openvpn_cloak");
|
case DockerContainer::Cloak: return QLatin1String("openvpn_cloak");
|
||||||
case DockerContainer::ShadowSocks: return QLatin1String("openvpn_shadowsocks");
|
case DockerContainer::ShadowSocks: return QLatin1String("openvpn_shadowsocks");
|
||||||
case DockerContainer::WireGuard: return QLatin1String("wireguard");
|
case DockerContainer::WireGuard: return QLatin1String("wireguard");
|
||||||
case DockerContainer::AmneziaWireGuard: return QLatin1String("amnezia_wireguard");
|
case DockerContainer::Awg: return QLatin1String("amnezia_wireguard");
|
||||||
case DockerContainer::Ipsec: return QLatin1String("ipsec");
|
case DockerContainer::Ipsec: return QLatin1String("ipsec");
|
||||||
|
|
||||||
case DockerContainer::TorWebSite: return QLatin1String("website_tor");
|
case DockerContainer::TorWebSite: return QLatin1String("website_tor");
|
||||||
|
|
|
@ -338,7 +338,7 @@ bool ServerController::isReinstallContainerRequired(DockerContainer container, c
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (container == DockerContainer::AmneziaWireGuard) {
|
if (container == DockerContainer::Awg) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,7 +491,7 @@ ServerController::Vars ServerController::genVarsForScript(const ServerCredential
|
||||||
const QJsonObject &ssConfig = config.value(ProtocolProps::protoToString(Proto::ShadowSocks)).toObject();
|
const QJsonObject &ssConfig = config.value(ProtocolProps::protoToString(Proto::ShadowSocks)).toObject();
|
||||||
const QJsonObject &wireguarConfig = config.value(ProtocolProps::protoToString(Proto::WireGuard)).toObject();
|
const QJsonObject &wireguarConfig = config.value(ProtocolProps::protoToString(Proto::WireGuard)).toObject();
|
||||||
const QJsonObject &amneziaWireguarConfig =
|
const QJsonObject &amneziaWireguarConfig =
|
||||||
config.value(ProtocolProps::protoToString(Proto::AmneziaWireGuard)).toObject();
|
config.value(ProtocolProps::protoToString(Proto::Awg)).toObject();
|
||||||
const QJsonObject &sftpConfig = config.value(ProtocolProps::protoToString(Proto::Sftp)).toObject();
|
const QJsonObject &sftpConfig = config.value(ProtocolProps::protoToString(Proto::Sftp)).toObject();
|
||||||
|
|
||||||
Vars vars;
|
Vars vars;
|
||||||
|
@ -589,35 +589,35 @@ ServerController::Vars ServerController::genVarsForScript(const ServerCredential
|
||||||
vars.append({ { "$SFTP_PASSWORD", sftpConfig.value(config_key::password).toString() } });
|
vars.append({ { "$SFTP_PASSWORD", sftpConfig.value(config_key::password).toString() } });
|
||||||
|
|
||||||
// Amnezia wireguard vars
|
// Amnezia wireguard vars
|
||||||
vars.append({ { "$AMNEZIAWIREGUARD_SERVER_PORT",
|
vars.append({ { "$AWG_SERVER_PORT",
|
||||||
amneziaWireguarConfig.value(config_key::port).toString(protocols::amneziawireguard::defaultPort) } });
|
amneziaWireguarConfig.value(config_key::port).toString(protocols::awg::defaultPort) } });
|
||||||
vars.append({ { "$JUNK_PACKET_COUNT",
|
vars.append({ { "$JUNK_PACKET_COUNT",
|
||||||
amneziaWireguarConfig.value(config_key::junkPacketCount)
|
amneziaWireguarConfig.value(config_key::junkPacketCount)
|
||||||
.toString(protocols::amneziawireguard::defaultJunkPacketCount) } });
|
.toString(protocols::awg::defaultJunkPacketCount) } });
|
||||||
vars.append({ { "$JUNK_PACKET_MIN_SIZE",
|
vars.append({ { "$JUNK_PACKET_MIN_SIZE",
|
||||||
amneziaWireguarConfig.value(config_key::junkPacketMinSize)
|
amneziaWireguarConfig.value(config_key::junkPacketMinSize)
|
||||||
.toString(protocols::amneziawireguard::defaultJunkPacketMinSize) } });
|
.toString(protocols::awg::defaultJunkPacketMinSize) } });
|
||||||
vars.append({ { "$JUNK_PACKET_MAX_SIZE",
|
vars.append({ { "$JUNK_PACKET_MAX_SIZE",
|
||||||
amneziaWireguarConfig.value(config_key::junkPacketMaxSize)
|
amneziaWireguarConfig.value(config_key::junkPacketMaxSize)
|
||||||
.toString(protocols::amneziawireguard::defaultJunkPacketMaxSize) } });
|
.toString(protocols::awg::defaultJunkPacketMaxSize) } });
|
||||||
vars.append({ { "$INIT_PACKET_JUNK_SIZE",
|
vars.append({ { "$INIT_PACKET_JUNK_SIZE",
|
||||||
amneziaWireguarConfig.value(config_key::initPacketJunkSize)
|
amneziaWireguarConfig.value(config_key::initPacketJunkSize)
|
||||||
.toString(protocols::amneziawireguard::defaultInitPacketJunkSize) } });
|
.toString(protocols::awg::defaultInitPacketJunkSize) } });
|
||||||
vars.append({ { "$RESPONSE_PACKET_JUNK_SIZE",
|
vars.append({ { "$RESPONSE_PACKET_JUNK_SIZE",
|
||||||
amneziaWireguarConfig.value(config_key::responsePacketJunkSize)
|
amneziaWireguarConfig.value(config_key::responsePacketJunkSize)
|
||||||
.toString(protocols::amneziawireguard::defaultResponsePacketJunkSize) } });
|
.toString(protocols::awg::defaultResponsePacketJunkSize) } });
|
||||||
vars.append({ { "$INIT_PACKET_MAGIC_HEADER",
|
vars.append({ { "$INIT_PACKET_MAGIC_HEADER",
|
||||||
amneziaWireguarConfig.value(config_key::initPacketMagicHeader)
|
amneziaWireguarConfig.value(config_key::initPacketMagicHeader)
|
||||||
.toString(protocols::amneziawireguard::defaultInitPacketMagicHeader) } });
|
.toString(protocols::awg::defaultInitPacketMagicHeader) } });
|
||||||
vars.append({ { "$RESPONSE_PACKET_MAGIC_HEADER",
|
vars.append({ { "$RESPONSE_PACKET_MAGIC_HEADER",
|
||||||
amneziaWireguarConfig.value(config_key::responsePacketMagicHeader)
|
amneziaWireguarConfig.value(config_key::responsePacketMagicHeader)
|
||||||
.toString(protocols::amneziawireguard::defaultResponsePacketMagicHeader) } });
|
.toString(protocols::awg::defaultResponsePacketMagicHeader) } });
|
||||||
vars.append({ { "$UNDERLOAD_PACKET_MAGIC_HEADER",
|
vars.append({ { "$UNDERLOAD_PACKET_MAGIC_HEADER",
|
||||||
amneziaWireguarConfig.value(config_key::underloadPacketMagicHeader)
|
amneziaWireguarConfig.value(config_key::underloadPacketMagicHeader)
|
||||||
.toString(protocols::amneziawireguard::defaultUnderloadPacketMagicHeader) } });
|
.toString(protocols::awg::defaultUnderloadPacketMagicHeader) } });
|
||||||
vars.append({ { "$TRANSPORT_PACKET_MAGIC_HEADER",
|
vars.append({ { "$TRANSPORT_PACKET_MAGIC_HEADER",
|
||||||
amneziaWireguarConfig.value(config_key::transportPacketMagicHeader)
|
amneziaWireguarConfig.value(config_key::transportPacketMagicHeader)
|
||||||
.toString(protocols::amneziawireguard::defaultTransportPacketMagicHeader) } });
|
.toString(protocols::awg::defaultTransportPacketMagicHeader) } });
|
||||||
|
|
||||||
QString serverIp = Utils::getIPAddress(credentials.hostName);
|
QString serverIp = Utils::getIPAddress(credentials.hostName);
|
||||||
if (!serverIp.isEmpty()) {
|
if (!serverIp.isEmpty()) {
|
||||||
|
|
|
@ -163,7 +163,7 @@ void LocalSocketController::activate(const QJsonObject &rawConfig) {
|
||||||
// }
|
// }
|
||||||
// json.insert("vpnDisabledApps", splitTunnelApps);
|
// json.insert("vpnDisabledApps", splitTunnelApps);
|
||||||
|
|
||||||
if (protocolName == amnezia::config_key::amneziaWireguard) {
|
if (protocolName == amnezia::config_key::awg) {
|
||||||
json.insert(amnezia::config_key::junkPacketCount, wgConfig.value(amnezia::config_key::junkPacketCount));
|
json.insert(amnezia::config_key::junkPacketCount, wgConfig.value(amnezia::config_key::junkPacketCount));
|
||||||
json.insert(amnezia::config_key::junkPacketMinSize, wgConfig.value(amnezia::config_key::junkPacketMinSize));
|
json.insert(amnezia::config_key::junkPacketMinSize, wgConfig.value(amnezia::config_key::junkPacketMinSize));
|
||||||
json.insert(amnezia::config_key::junkPacketMaxSize, wgConfig.value(amnezia::config_key::junkPacketMaxSize));
|
json.insert(amnezia::config_key::junkPacketMaxSize, wgConfig.value(amnezia::config_key::junkPacketMaxSize));
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#include "amneziawireguardprotocol.h"
|
#include "amneziawireguardprotocol.h"
|
||||||
|
|
||||||
AmneziaWireGuardProtocol::AmneziaWireGuardProtocol(const QJsonObject &configuration, QObject *parent)
|
Awg::Awg(const QJsonObject &configuration, QObject *parent)
|
||||||
: WireguardProtocol(configuration, parent)
|
: WireguardProtocol(configuration, parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
AmneziaWireGuardProtocol::~AmneziaWireGuardProtocol()
|
Awg::~Awg()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
#ifndef AMNEZIAWIREGUARDPROTOCOL_H
|
#ifndef AWGPROTOCOL_H
|
||||||
#define AMNEZIAWIREGUARDPROTOCOL_H
|
#define AWGPROTOCOL_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include "wireguardprotocol.h"
|
#include "wireguardprotocol.h"
|
||||||
|
|
||||||
class AmneziaWireGuardProtocol : public WireguardProtocol
|
class Awg : public WireguardProtocol
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AmneziaWireGuardProtocol(const QJsonObject &configuration, QObject *parent = nullptr);
|
explicit Awg(const QJsonObject &configuration, QObject *parent = nullptr);
|
||||||
virtual ~AmneziaWireGuardProtocol() override;
|
virtual ~Awg() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AMNEZIAWIREGUARDPROTOCOL_H
|
#endif // AWGPROTOCOL_H
|
||||||
|
|
|
@ -89,7 +89,7 @@ amnezia::ServiceType ProtocolProps::protocolService(Proto p)
|
||||||
case Proto::Cloak: return ServiceType::Vpn;
|
case Proto::Cloak: return ServiceType::Vpn;
|
||||||
case Proto::ShadowSocks: return ServiceType::Vpn;
|
case Proto::ShadowSocks: return ServiceType::Vpn;
|
||||||
case Proto::WireGuard: return ServiceType::Vpn;
|
case Proto::WireGuard: return ServiceType::Vpn;
|
||||||
case Proto::AmneziaWireGuard: return ServiceType::Vpn;
|
case Proto::Awg: return ServiceType::Vpn;
|
||||||
case Proto::TorWebSite: return ServiceType::Other;
|
case Proto::TorWebSite: return ServiceType::Other;
|
||||||
case Proto::Dns: return ServiceType::Other;
|
case Proto::Dns: return ServiceType::Other;
|
||||||
case Proto::FileShare: return ServiceType::Other;
|
case Proto::FileShare: return ServiceType::Other;
|
||||||
|
@ -105,7 +105,7 @@ int ProtocolProps::defaultPort(Proto p)
|
||||||
case Proto::Cloak: return 443;
|
case Proto::Cloak: return 443;
|
||||||
case Proto::ShadowSocks: return 6789;
|
case Proto::ShadowSocks: return 6789;
|
||||||
case Proto::WireGuard: return 51820;
|
case Proto::WireGuard: return 51820;
|
||||||
case Proto::AmneziaWireGuard: return 55424;
|
case Proto::Awg: return 55424;
|
||||||
case Proto::Ikev2: return -1;
|
case Proto::Ikev2: return -1;
|
||||||
case Proto::L2tp: return -1;
|
case Proto::L2tp: return -1;
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ bool ProtocolProps::defaultPortChangeable(Proto p)
|
||||||
case Proto::Cloak: return true;
|
case Proto::Cloak: return true;
|
||||||
case Proto::ShadowSocks: return true;
|
case Proto::ShadowSocks: return true;
|
||||||
case Proto::WireGuard: return true;
|
case Proto::WireGuard: return true;
|
||||||
case Proto::AmneziaWireGuard: return true;
|
case Proto::Awg: return true;
|
||||||
case Proto::Ikev2: return false;
|
case Proto::Ikev2: return false;
|
||||||
case Proto::L2tp: return false;
|
case Proto::L2tp: return false;
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ TransportProto ProtocolProps::defaultTransportProto(Proto p)
|
||||||
case Proto::Cloak: return TransportProto::Tcp;
|
case Proto::Cloak: return TransportProto::Tcp;
|
||||||
case Proto::ShadowSocks: return TransportProto::Tcp;
|
case Proto::ShadowSocks: return TransportProto::Tcp;
|
||||||
case Proto::WireGuard: return TransportProto::Udp;
|
case Proto::WireGuard: return TransportProto::Udp;
|
||||||
case Proto::AmneziaWireGuard: return TransportProto::Udp;
|
case Proto::Awg: return TransportProto::Udp;
|
||||||
case Proto::Ikev2: return TransportProto::Udp;
|
case Proto::Ikev2: return TransportProto::Udp;
|
||||||
case Proto::L2tp: return TransportProto::Udp;
|
case Proto::L2tp: return TransportProto::Udp;
|
||||||
// non-vpn
|
// non-vpn
|
||||||
|
@ -163,7 +163,7 @@ bool ProtocolProps::defaultTransportProtoChangeable(Proto p)
|
||||||
case Proto::Cloak: return false;
|
case Proto::Cloak: return false;
|
||||||
case Proto::ShadowSocks: return false;
|
case Proto::ShadowSocks: return false;
|
||||||
case Proto::WireGuard: return false;
|
case Proto::WireGuard: return false;
|
||||||
case Proto::AmneziaWireGuard: return false;
|
case Proto::Awg: return false;
|
||||||
case Proto::Ikev2: return false;
|
case Proto::Ikev2: return false;
|
||||||
case Proto::L2tp: return false;
|
case Proto::L2tp: return false;
|
||||||
// non-vpn
|
// non-vpn
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace amnezia
|
||||||
constexpr char shadowsocks[] = "shadowsocks";
|
constexpr char shadowsocks[] = "shadowsocks";
|
||||||
constexpr char cloak[] = "cloak";
|
constexpr char cloak[] = "cloak";
|
||||||
constexpr char sftp[] = "sftp";
|
constexpr char sftp[] = "sftp";
|
||||||
constexpr char amneziaWireguard[] = "amneziawireguard";
|
constexpr char awg[] = "awg";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,13 +151,13 @@ namespace amnezia
|
||||||
|
|
||||||
} // namespace sftp
|
} // namespace sftp
|
||||||
|
|
||||||
namespace amneziawireguard
|
namespace awg
|
||||||
{
|
{
|
||||||
constexpr char defaultPort[] = "55424";
|
constexpr char defaultPort[] = "55424";
|
||||||
|
|
||||||
constexpr char serverConfigPath[] = "/opt/amnezia/amneziawireguard/wg0.conf";
|
constexpr char serverConfigPath[] = "/opt/amnezia/awg/wg0.conf";
|
||||||
constexpr char serverPublicKeyPath[] = "/opt/amnezia/amneziawireguard/wireguard_server_public_key.key";
|
constexpr char serverPublicKeyPath[] = "/opt/amnezia/awg/wireguard_server_public_key.key";
|
||||||
constexpr char serverPskKeyPath[] = "/opt/amnezia/amneziawireguard/wireguard_psk.key";
|
constexpr char serverPskKeyPath[] = "/opt/amnezia/awg/wireguard_psk.key";
|
||||||
|
|
||||||
constexpr char defaultJunkPacketCount[] = "3";
|
constexpr char defaultJunkPacketCount[] = "3";
|
||||||
constexpr char defaultJunkPacketMinSize[] = "10";
|
constexpr char defaultJunkPacketMinSize[] = "10";
|
||||||
|
@ -188,7 +188,7 @@ namespace amnezia
|
||||||
ShadowSocks,
|
ShadowSocks,
|
||||||
Cloak,
|
Cloak,
|
||||||
WireGuard,
|
WireGuard,
|
||||||
AmneziaWireGuard,
|
Awg,
|
||||||
Ikev2,
|
Ikev2,
|
||||||
L2tp,
|
L2tp,
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ VpnProtocol *VpnProtocol::factory(DockerContainer container, const QJsonObject &
|
||||||
case DockerContainer::Cloak: return new OpenVpnOverCloakProtocol(configuration);
|
case DockerContainer::Cloak: return new OpenVpnOverCloakProtocol(configuration);
|
||||||
case DockerContainer::ShadowSocks: return new ShadowSocksVpnProtocol(configuration);
|
case DockerContainer::ShadowSocks: return new ShadowSocksVpnProtocol(configuration);
|
||||||
case DockerContainer::WireGuard: return new WireguardProtocol(configuration);
|
case DockerContainer::WireGuard: return new WireguardProtocol(configuration);
|
||||||
case DockerContainer::AmneziaWireGuard: return new WireguardProtocol(configuration);
|
case DockerContainer::Awg: return new WireguardProtocol(configuration);
|
||||||
#endif
|
#endif
|
||||||
default: return nullptr;
|
default: return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,7 +215,7 @@
|
||||||
<file>ui/qml/Controls2/ListViewWithLabelsType.qml</file>
|
<file>ui/qml/Controls2/ListViewWithLabelsType.qml</file>
|
||||||
<file>ui/qml/Pages2/PageServiceDnsSettings.qml</file>
|
<file>ui/qml/Pages2/PageServiceDnsSettings.qml</file>
|
||||||
<file>ui/qml/Controls2/TopCloseButtonType.qml</file>
|
<file>ui/qml/Controls2/TopCloseButtonType.qml</file>
|
||||||
<file>ui/qml/Pages2/PageProtocolAmneziaWireGuardSettings.qml</file>
|
<file>ui/qml/Pages2/PageProtocolAwgSettings.qml</file>
|
||||||
<file>server_scripts/amnezia_wireguard/template.conf</file>
|
<file>server_scripts/amnezia_wireguard/template.conf</file>
|
||||||
<file>server_scripts/amnezia_wireguard/start.sh</file>
|
<file>server_scripts/amnezia_wireguard/start.sh</file>
|
||||||
<file>server_scripts/amnezia_wireguard/configure_container.sh</file>
|
<file>server_scripts/amnezia_wireguard/configure_container.sh</file>
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
mkdir -p /opt/amnezia/amneziawireguard
|
mkdir -p /opt/amnezia/awg
|
||||||
cd /opt/amnezia/amneziawireguard
|
cd /opt/amnezia/awg
|
||||||
WIREGUARD_SERVER_PRIVATE_KEY=$(wg genkey)
|
WIREGUARD_SERVER_PRIVATE_KEY=$(wg genkey)
|
||||||
echo $WIREGUARD_SERVER_PRIVATE_KEY > /opt/amnezia/amneziawireguard/wireguard_server_private_key.key
|
echo $WIREGUARD_SERVER_PRIVATE_KEY > /opt/amnezia/awg/wireguard_server_private_key.key
|
||||||
|
|
||||||
WIREGUARD_SERVER_PUBLIC_KEY=$(echo $WIREGUARD_SERVER_PRIVATE_KEY | wg pubkey)
|
WIREGUARD_SERVER_PUBLIC_KEY=$(echo $WIREGUARD_SERVER_PRIVATE_KEY | wg pubkey)
|
||||||
echo $WIREGUARD_SERVER_PUBLIC_KEY > /opt/amnezia/amneziawireguard/wireguard_server_public_key.key
|
echo $WIREGUARD_SERVER_PUBLIC_KEY > /opt/amnezia/awg/wireguard_server_public_key.key
|
||||||
|
|
||||||
WIREGUARD_PSK=$(wg genpsk)
|
WIREGUARD_PSK=$(wg genpsk)
|
||||||
echo $WIREGUARD_PSK > /opt/amnezia/amneziawireguard/wireguard_psk.key
|
echo $WIREGUARD_PSK > /opt/amnezia/awg/wireguard_psk.key
|
||||||
|
|
||||||
cat > /opt/amnezia/amneziawireguard/wg0.conf <<EOF
|
cat > /opt/amnezia/awg/wg0.conf <<EOF
|
||||||
[Interface]
|
[Interface]
|
||||||
PrivateKey = $WIREGUARD_SERVER_PRIVATE_KEY
|
PrivateKey = $WIREGUARD_SERVER_PRIVATE_KEY
|
||||||
Address = 10.8.1.1/24
|
Address = $WIREGUARD_SUBNET_IP/$WIREGUARD_SUBNET_CIDR
|
||||||
ListenPort = $AMNEZIAWIREGUARD_SERVER_PORT
|
ListenPort = $AWG_SERVER_PORT
|
||||||
Jc = $JUNK_PACKET_COUNT
|
Jc = $JUNK_PACKET_COUNT
|
||||||
Jmin = $JUNK_PACKET_MIN_SIZE
|
Jmin = $JUNK_PACKET_MIN_SIZE
|
||||||
Jmax = $JUNK_PACKET_MAX_SIZE
|
Jmax = $JUNK_PACKET_MAX_SIZE
|
||||||
|
|
|
@ -5,7 +5,7 @@ sudo docker run -d \
|
||||||
--privileged \
|
--privileged \
|
||||||
--cap-add=NET_ADMIN \
|
--cap-add=NET_ADMIN \
|
||||||
--cap-add=SYS_MODULE \
|
--cap-add=SYS_MODULE \
|
||||||
-p $AMNEZIAWIREGUARD_SERVER_PORT:$AMNEZIAWIREGUARD_SERVER_PORT/udp \
|
-p $AWG_SERVER_PORT:$AWG_SERVER_PORT/udp \
|
||||||
-v /lib/modules:/lib/modules \
|
-v /lib/modules:/lib/modules \
|
||||||
--sysctl="net.ipv4.conf.all.src_valid_mark=1" \
|
--sysctl="net.ipv4.conf.all.src_valid_mark=1" \
|
||||||
--name $CONTAINER_NAME \
|
--name $CONTAINER_NAME \
|
||||||
|
|
|
@ -5,14 +5,11 @@
|
||||||
echo "Container startup"
|
echo "Container startup"
|
||||||
#ifconfig eth0:0 $SERVER_IP_ADDRESS netmask 255.255.255.255 up
|
#ifconfig eth0:0 $SERVER_IP_ADDRESS netmask 255.255.255.255 up
|
||||||
|
|
||||||
mkdir -p /dev/net
|
|
||||||
mknod /dev/net/tun c 10 200
|
|
||||||
|
|
||||||
# kill daemons in case of restart
|
# kill daemons in case of restart
|
||||||
wg-quick down /opt/amnezia/amneziawireguard/wg0.conf
|
wg-quick down /opt/amnezia/awg/wg0.conf
|
||||||
|
|
||||||
# start daemons if configured
|
# start daemons if configured
|
||||||
if [ -f /opt/amnezia/amneziawireguard/wg0.conf ]; then (wg-quick up /opt/amnezia/amneziawireguard/wg0.conf); fi
|
if [ -f /opt/amnezia/awg/wg0.conf ]; then (wg-quick up /opt/amnezia/awg/wg0.conf); fi
|
||||||
|
|
||||||
# Allow traffic on the TUN interface.
|
# Allow traffic on the TUN interface.
|
||||||
iptables -A INPUT -i wg0 -j ACCEPT
|
iptables -A INPUT -i wg0 -j ACCEPT
|
||||||
|
|
|
@ -16,5 +16,5 @@ H4 = $TRANSPORT_PACKET_MAGIC_HEADER
|
||||||
PublicKey = $WIREGUARD_SERVER_PUBLIC_KEY
|
PublicKey = $WIREGUARD_SERVER_PUBLIC_KEY
|
||||||
PresharedKey = $WIREGUARD_PSK
|
PresharedKey = $WIREGUARD_PSK
|
||||||
AllowedIPs = 0.0.0.0/0, ::/0
|
AllowedIPs = 0.0.0.0/0, ::/0
|
||||||
Endpoint = $SERVER_IP_ADDRESS:$AMNEZIAWIREGUARD_SERVER_PORT
|
Endpoint = $SERVER_IP_ADDRESS:$AWG_SERVER_PORT
|
||||||
PersistentKeepalive = 25
|
PersistentKeepalive = 25
|
||||||
|
|
|
@ -291,7 +291,7 @@ QJsonObject ImportController::extractWireGuardConfig(const QString &data)
|
||||||
lastConfig[config_key::responsePacketMagicHeader] = configMap.value(config_key::responsePacketMagicHeader);
|
lastConfig[config_key::responsePacketMagicHeader] = configMap.value(config_key::responsePacketMagicHeader);
|
||||||
lastConfig[config_key::underloadPacketMagicHeader] = configMap.value(config_key::underloadPacketMagicHeader);
|
lastConfig[config_key::underloadPacketMagicHeader] = configMap.value(config_key::underloadPacketMagicHeader);
|
||||||
lastConfig[config_key::transportPacketMagicHeader] = configMap.value(config_key::transportPacketMagicHeader);
|
lastConfig[config_key::transportPacketMagicHeader] = configMap.value(config_key::transportPacketMagicHeader);
|
||||||
protocolName = "amneziawireguard";
|
protocolName = "awg";
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject wireguardConfig;
|
QJsonObject wireguardConfig;
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace PageLoader
|
||||||
PageProtocolShadowSocksSettings,
|
PageProtocolShadowSocksSettings,
|
||||||
PageProtocolCloakSettings,
|
PageProtocolCloakSettings,
|
||||||
PageProtocolWireGuardSettings,
|
PageProtocolWireGuardSettings,
|
||||||
PageProtocolAmneziaWireGuardSettings,
|
PageProtocolAwgSettings,
|
||||||
PageProtocolIKev2Settings,
|
PageProtocolIKev2Settings,
|
||||||
PageProtocolRaw
|
PageProtocolRaw
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
#include "amneziaWireGuardConfigModel.h"
|
#include "awgConfigModel.h"
|
||||||
|
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
|
|
||||||
#include "protocols/protocols_defs.h"
|
#include "protocols/protocols_defs.h"
|
||||||
|
|
||||||
AmneziaWireGuardConfigModel::AmneziaWireGuardConfigModel(QObject *parent) : QAbstractListModel(parent)
|
AwgConfigModel::AwgConfigModel(QObject *parent) : QAbstractListModel(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int AmneziaWireGuardConfigModel::rowCount(const QModelIndex &parent) const
|
int AwgConfigModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
Q_UNUSED(parent);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AmneziaWireGuardConfigModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
bool AwgConfigModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||||
{
|
{
|
||||||
if (!index.isValid() || index.row() < 0 || index.row() >= ContainerProps::allContainers().size()) {
|
if (!index.isValid() || index.row() < 0 || index.row() >= ContainerProps::allContainers().size()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -49,7 +49,7 @@ bool AmneziaWireGuardConfigModel::setData(const QModelIndex &index, const QVaria
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant AmneziaWireGuardConfigModel::data(const QModelIndex &index, int role) const
|
QVariant AwgConfigModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (!index.isValid() || index.row() < 0 || index.row() >= rowCount()) {
|
if (!index.isValid() || index.row() < 0 || index.row() >= rowCount()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -71,7 +71,7 @@ QVariant AmneziaWireGuardConfigModel::data(const QModelIndex &index, int role) c
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmneziaWireGuardConfigModel::updateModel(const QJsonObject &config)
|
void AwgConfigModel::updateModel(const QJsonObject &config)
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
m_container = ContainerProps::containerFromString(config.value(config_key::container).toString());
|
m_container = ContainerProps::containerFromString(config.value(config_key::container).toString());
|
||||||
|
@ -112,13 +112,13 @@ void AmneziaWireGuardConfigModel::updateModel(const QJsonObject &config)
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
QJsonObject AmneziaWireGuardConfigModel::getConfig()
|
QJsonObject AwgConfigModel::getConfig()
|
||||||
{
|
{
|
||||||
m_fullConfig.insert(config_key::amneziaWireguard, m_protocolConfig);
|
m_fullConfig.insert(config_key::amneziaWireguard, m_protocolConfig);
|
||||||
return m_fullConfig;
|
return m_fullConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<int, QByteArray> AmneziaWireGuardConfigModel::roleNames() const
|
QHash<int, QByteArray> AwgConfigModel::roleNames() const
|
||||||
{
|
{
|
||||||
QHash<int, QByteArray> roles;
|
QHash<int, QByteArray> roles;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#ifndef AMNEZIAWIREGUARDCONFIGMODEL_H
|
#ifndef AWGCONFIGMODEL_H
|
||||||
#define AMNEZIAWIREGUARDCONFIGMODEL_H
|
#define AWGCONFIGMODEL_H
|
||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
|
||||||
#include "containers/containers_defs.h"
|
#include "containers/containers_defs.h"
|
||||||
|
|
||||||
class AmneziaWireGuardConfigModel : public QAbstractListModel
|
class AwgConfigModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ public:
|
||||||
TransportPacketMagicHeaderRole
|
TransportPacketMagicHeaderRole
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit AmneziaWireGuardConfigModel(QObject *parent = nullptr);
|
explicit AwgConfigModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
|
|
||||||
|
@ -44,4 +44,4 @@ private:
|
||||||
QJsonObject m_fullConfig;
|
QJsonObject m_fullConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AMNEZIAWIREGUARDCONFIGMODEL_H
|
#endif // AWGCONFIGMODEL_H
|
||||||
|
|
|
@ -64,9 +64,9 @@ ListView {
|
||||||
// goToPage(PageEnum.PageProtocolWireGuardSettings)
|
// goToPage(PageEnum.PageProtocolWireGuardSettings)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case ContainerEnum.AmneziaWireGuard: {
|
case ContainerEnum.Awg: {
|
||||||
AmneziaWireGuardConfigModel.updateModel(config)
|
AwgConfigModel.updateModel(config)
|
||||||
PageController.goToPage(PageEnum.PageProtocolAmneziaWireGuardSettings)
|
PageController.goToPage(PageEnum.PageProtocolAwgSettings)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case ContainerEnum.Ipsec: {
|
case ContainerEnum.Ipsec: {
|
||||||
|
|
|
@ -52,7 +52,7 @@ PageType {
|
||||||
clip: true
|
clip: true
|
||||||
interactive: false
|
interactive: false
|
||||||
|
|
||||||
model: AmneziaWireGuardConfigModel
|
model: AwgConfigModel
|
||||||
|
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
implicitWidth: listview.width
|
implicitWidth: listview.width
|
||||||
|
@ -313,7 +313,7 @@ PageType {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
forceActiveFocus()
|
forceActiveFocus()
|
||||||
PageController.showBusyIndicator(true)
|
PageController.showBusyIndicator(true)
|
||||||
InstallController.updateContainer(AmneziaWireGuardConfigModel.getConfig())
|
InstallController.updateContainer(AwgConfigModel.getConfig())
|
||||||
PageController.showBusyIndicator(false)
|
PageController.showBusyIndicator(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue