renamed amenziawireguard to awg

This commit is contained in:
vladimir.kuznetsov 2023-10-06 17:19:44 +05:00
parent 16fc0617e4
commit aa4a79934a
29 changed files with 105 additions and 108 deletions

View file

@ -321,8 +321,8 @@ void AmneziaApplication::initModels()
m_wireGuardConfigModel.reset(new WireGuardConfigModel(this));
m_engine->rootContext()->setContextProperty("WireGuardConfigModel", m_wireGuardConfigModel.get());
m_amneziaWireGuardConfigModel.reset(new AmneziaWireGuardConfigModel(this));
m_engine->rootContext()->setContextProperty("AmneziaWireGuardConfigModel", m_amneziaWireGuardConfigModel.get());
m_awgConfigModel.reset(new AwgConfigModel(this));
m_engine->rootContext()->setContextProperty("AwgConfigModel", m_awgConfigModel.get());
#ifdef Q_OS_WINDOWS
m_ikev2ConfigModel.reset(new Ikev2ConfigModel(this));

View file

@ -31,7 +31,7 @@
#ifdef Q_OS_WINDOWS
#include "ui/models/protocols/ikev2ConfigModel.h"
#endif
#include "ui/models/protocols/amneziaWireGuardConfigModel.h"
#include "ui/models/protocols/awgConfigModel.h"
#include "ui/models/protocols/openvpnConfigModel.h"
#include "ui/models/protocols/shadowsocksConfigModel.h"
#include "ui/models/protocols/wireguardConfigModel.h"
@ -99,7 +99,7 @@ private:
QScopedPointer<ShadowSocksConfigModel> m_shadowSocksConfigModel;
QScopedPointer<CloakConfigModel> m_cloakConfigModel;
QScopedPointer<WireGuardConfigModel> m_wireGuardConfigModel;
QScopedPointer<AmneziaWireGuardConfigModel> m_amneziaWireGuardConfigModel;
QScopedPointer<AwgConfigModel> m_awgConfigModel;
#ifdef Q_OS_WINDOWS
QScopedPointer<Ikev2ConfigModel> m_ikev2ConfigModel;
#endif

View file

@ -5,12 +5,12 @@
#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)
{
}
QString AmneziaWireGuardConfigurator::genAmneziaWireGuardConfig(const ServerCredentials &credentials,
QString AwgConfigurator::genAwgConfig(const ServerCredentials &credentials,
DockerContainer container,
const QJsonObject &containerConfig, ErrorCode *errorCode)
{
@ -19,7 +19,7 @@ QString AmneziaWireGuardConfigurator::genAmneziaWireGuardConfig(const ServerCred
QJsonObject jsonConfig = QJsonDocument::fromJson(config.toUtf8()).object();
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;
auto serverConfigLines = serverConfig.split("\n");

View file

@ -1,18 +1,18 @@
#ifndef AMNEZIAWIREGUARDCONFIGURATOR_H
#define AMNEZIAWIREGUARDCONFIGURATOR_H
#ifndef AWGCONFIGURATOR_H
#define AWGCONFIGURATOR_H
#include <QObject>
#include "wireguard_configurator.h"
class AmneziaWireGuardConfigurator : public WireguardConfigurator
class AwgConfigurator : public WireguardConfigurator
{
Q_OBJECT
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);
};
#endif // AMNEZIAWIREGUARDCONFIGURATOR_H
#endif // AWGCONFIGURATOR_H

View file

@ -24,7 +24,7 @@ VpnConfigurator::VpnConfigurator(std::shared_ptr<Settings> settings, QObject *pa
wireguardConfigurator = std::shared_ptr<WireguardConfigurator>(new WireguardConfigurator(settings, false, this));
ikev2Configurator = std::shared_ptr<Ikev2Configurator>(new Ikev2Configurator(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,
@ -42,8 +42,8 @@ QString VpnConfigurator::genVpnProtocolConfig(const ServerCredentials &credentia
case Proto::WireGuard:
return wireguardConfigurator->genWireguardConfig(credentials, container, containerConfig, errorCode);
case Proto::AmneziaWireGuard:
return amneziaWireGuardConfigurator->genAmneziaWireGuardConfig(credentials, container, containerConfig, errorCode);
case Proto::Awg:
return awgConfigurator->genAwgConfig(credentials, container, containerConfig, errorCode);
case Proto::Ikev2: return ikev2Configurator->genIkev2Config(credentials, container, containerConfig, errorCode);

View file

@ -13,7 +13,7 @@ class CloakConfigurator;
class WireguardConfigurator;
class Ikev2Configurator;
class SshConfigurator;
class AmneziaWireGuardConfigurator;
class AwgConfigurator;
// Retrieve connection settings from server
class VpnConfigurator : ConfiguratorBase
@ -41,7 +41,7 @@ public:
std::shared_ptr<WireguardConfigurator> wireguardConfigurator;
std::shared_ptr<Ikev2Configurator> ikev2Configurator;
std::shared_ptr<SshConfigurator> sshConfigurator;
std::shared_ptr<AmneziaWireGuardConfigurator> amneziaWireGuardConfigurator;
std::shared_ptr<AwgConfigurator> awgConfigurator;
};
#endif // VPN_CONFIGURATOR_H

View file

@ -19,20 +19,20 @@
#include "settings.h"
#include "utilities.h"
WireguardConfigurator::WireguardConfigurator(std::shared_ptr<Settings> settings, bool isAmneziaWireGuard, QObject *parent)
: ConfiguratorBase(settings, parent), m_isAmneziaWireGuard(isAmneziaWireGuard)
WireguardConfigurator::WireguardConfigurator(std::shared_ptr<Settings> settings, bool isAwg, QObject *parent)
: 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;
m_serverPublicKeyPath = m_isAmneziaWireGuard ? amnezia::protocols::amneziawireguard::serverPublicKeyPath
m_serverPublicKeyPath = m_isAwg ? amnezia::protocols::awg::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;
m_configTemplate = m_isAmneziaWireGuard ? ProtocolScriptType::amnezia_wireguard_template
m_configTemplate = m_isAwg ? ProtocolScriptType::amnezia_wireguard_template
: ProtocolScriptType::wireguard_template;
m_protocolName = m_isAmneziaWireGuard ? config_key::amneziaWireguard : config_key::wireguard;
m_defaultPort = m_isAmneziaWireGuard ? protocols::wireguard::defaultPort : protocols::amneziawireguard::defaultPort;
m_protocolName = m_isAwg ? config_key::awg : config_key::wireguard;
m_defaultPort = m_isAwg ? protocols::wireguard::defaultPort : protocols::awg::defaultPort;
}
WireguardConfigurator::ConnectionData WireguardConfigurator::genClientKeys()

View file

@ -12,7 +12,7 @@ class WireguardConfigurator : public ConfiguratorBase
{
Q_OBJECT
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
{
@ -37,7 +37,7 @@ private:
ConnectionData genClientKeys();
bool m_isAmneziaWireGuard;
bool m_isAwg;
QString m_serverConfigPath;
QString m_serverPublicKeyPath;
QString m_serverPskKeyPath;

View file

@ -84,7 +84,7 @@ QMap<DockerContainer, QString> ContainerProps::containerHumanNames()
{ DockerContainer::ShadowSocks, "ShadowSocks" },
{ DockerContainer::Cloak, "OpenVPN over Cloak" },
{ DockerContainer::WireGuard, "WireGuard" },
{ DockerContainer::AmneziaWireGuard, "Amnezia WireGuard" },
{ DockerContainer::Awg, "Amnezia WireGuard" },
{ DockerContainer::Ipsec, QObject::tr("IPsec") },
{ DockerContainer::TorWebSite, QObject::tr("Website in Tor network") },
@ -108,7 +108,7 @@ QMap<DockerContainer, QString> ContainerProps::containerDescriptions()
{ DockerContainer::WireGuard,
QObject::tr("WireGuard - New popular VPN protocol with high performance, high speed and low power "
"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 "
"consumption. Recommended for regions with low levels of censorship.") },
{ DockerContainer::Ipsec,
@ -148,7 +148,7 @@ amnezia::ServiceType ContainerProps::containerService(DockerContainer c)
case DockerContainer::Cloak: return ServiceType::Vpn;
case DockerContainer::ShadowSocks: 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::TorWebSite: 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::ShadowSocks: return Proto::ShadowSocks;
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::TorWebSite: return Proto::TorWebSite;
@ -186,7 +186,7 @@ bool ContainerProps::isSupportedByCurrentPlatform(DockerContainer c)
switch (c) {
case DockerContainer::WireGuard: return true;
case DockerContainer::OpenVpn: return true;
case DockerContainer::AmneziaWireGuard: return true;
case DockerContainer::Awg: return true;
case DockerContainer::Cloak:
return true;
// case DockerContainer::ShadowSocks: return true;

View file

@ -20,7 +20,7 @@ namespace amnezia
ShadowSocks,
Cloak,
WireGuard,
AmneziaWireGuard,
Awg,
Ipsec,
// non-vpn

View file

@ -11,7 +11,7 @@ QString amnezia::scriptFolder(amnezia::DockerContainer container)
case DockerContainer::Cloak: return QLatin1String("openvpn_cloak");
case DockerContainer::ShadowSocks: return QLatin1String("openvpn_shadowsocks");
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::TorWebSite: return QLatin1String("website_tor");

View file

@ -338,7 +338,7 @@ bool ServerController::isReinstallContainerRequired(DockerContainer container, c
return true;
}
if (container == DockerContainer::AmneziaWireGuard) {
if (container == DockerContainer::Awg) {
return true;
}
@ -491,7 +491,7 @@ ServerController::Vars ServerController::genVarsForScript(const ServerCredential
const QJsonObject &ssConfig = config.value(ProtocolProps::protoToString(Proto::ShadowSocks)).toObject();
const QJsonObject &wireguarConfig = config.value(ProtocolProps::protoToString(Proto::WireGuard)).toObject();
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();
Vars vars;
@ -589,35 +589,35 @@ ServerController::Vars ServerController::genVarsForScript(const ServerCredential
vars.append({ { "$SFTP_PASSWORD", sftpConfig.value(config_key::password).toString() } });
// Amnezia wireguard vars
vars.append({ { "$AMNEZIAWIREGUARD_SERVER_PORT",
amneziaWireguarConfig.value(config_key::port).toString(protocols::amneziawireguard::defaultPort) } });
vars.append({ { "$AWG_SERVER_PORT",
amneziaWireguarConfig.value(config_key::port).toString(protocols::awg::defaultPort) } });
vars.append({ { "$JUNK_PACKET_COUNT",
amneziaWireguarConfig.value(config_key::junkPacketCount)
.toString(protocols::amneziawireguard::defaultJunkPacketCount) } });
.toString(protocols::awg::defaultJunkPacketCount) } });
vars.append({ { "$JUNK_PACKET_MIN_SIZE",
amneziaWireguarConfig.value(config_key::junkPacketMinSize)
.toString(protocols::amneziawireguard::defaultJunkPacketMinSize) } });
.toString(protocols::awg::defaultJunkPacketMinSize) } });
vars.append({ { "$JUNK_PACKET_MAX_SIZE",
amneziaWireguarConfig.value(config_key::junkPacketMaxSize)
.toString(protocols::amneziawireguard::defaultJunkPacketMaxSize) } });
.toString(protocols::awg::defaultJunkPacketMaxSize) } });
vars.append({ { "$INIT_PACKET_JUNK_SIZE",
amneziaWireguarConfig.value(config_key::initPacketJunkSize)
.toString(protocols::amneziawireguard::defaultInitPacketJunkSize) } });
.toString(protocols::awg::defaultInitPacketJunkSize) } });
vars.append({ { "$RESPONSE_PACKET_JUNK_SIZE",
amneziaWireguarConfig.value(config_key::responsePacketJunkSize)
.toString(protocols::amneziawireguard::defaultResponsePacketJunkSize) } });
.toString(protocols::awg::defaultResponsePacketJunkSize) } });
vars.append({ { "$INIT_PACKET_MAGIC_HEADER",
amneziaWireguarConfig.value(config_key::initPacketMagicHeader)
.toString(protocols::amneziawireguard::defaultInitPacketMagicHeader) } });
.toString(protocols::awg::defaultInitPacketMagicHeader) } });
vars.append({ { "$RESPONSE_PACKET_MAGIC_HEADER",
amneziaWireguarConfig.value(config_key::responsePacketMagicHeader)
.toString(protocols::amneziawireguard::defaultResponsePacketMagicHeader) } });
.toString(protocols::awg::defaultResponsePacketMagicHeader) } });
vars.append({ { "$UNDERLOAD_PACKET_MAGIC_HEADER",
amneziaWireguarConfig.value(config_key::underloadPacketMagicHeader)
.toString(protocols::amneziawireguard::defaultUnderloadPacketMagicHeader) } });
.toString(protocols::awg::defaultUnderloadPacketMagicHeader) } });
vars.append({ { "$TRANSPORT_PACKET_MAGIC_HEADER",
amneziaWireguarConfig.value(config_key::transportPacketMagicHeader)
.toString(protocols::amneziawireguard::defaultTransportPacketMagicHeader) } });
.toString(protocols::awg::defaultTransportPacketMagicHeader) } });
QString serverIp = Utils::getIPAddress(credentials.hostName);
if (!serverIp.isEmpty()) {

View file

@ -163,7 +163,7 @@ void LocalSocketController::activate(const QJsonObject &rawConfig) {
// }
// 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::junkPacketMinSize, wgConfig.value(amnezia::config_key::junkPacketMinSize));
json.insert(amnezia::config_key::junkPacketMaxSize, wgConfig.value(amnezia::config_key::junkPacketMaxSize));

View file

@ -1,10 +1,10 @@
#include "amneziawireguardprotocol.h"
AmneziaWireGuardProtocol::AmneziaWireGuardProtocol(const QJsonObject &configuration, QObject *parent)
Awg::Awg(const QJsonObject &configuration, QObject *parent)
: WireguardProtocol(configuration, parent)
{
}
AmneziaWireGuardProtocol::~AmneziaWireGuardProtocol()
Awg::~Awg()
{
}

View file

@ -1,17 +1,17 @@
#ifndef AMNEZIAWIREGUARDPROTOCOL_H
#define AMNEZIAWIREGUARDPROTOCOL_H
#ifndef AWGPROTOCOL_H
#define AWGPROTOCOL_H
#include <QObject>
#include "wireguardprotocol.h"
class AmneziaWireGuardProtocol : public WireguardProtocol
class Awg : public WireguardProtocol
{
Q_OBJECT
public:
explicit AmneziaWireGuardProtocol(const QJsonObject &configuration, QObject *parent = nullptr);
virtual ~AmneziaWireGuardProtocol() override;
explicit Awg(const QJsonObject &configuration, QObject *parent = nullptr);
virtual ~Awg() override;
};
#endif // AMNEZIAWIREGUARDPROTOCOL_H
#endif // AWGPROTOCOL_H

View file

@ -89,7 +89,7 @@ amnezia::ServiceType ProtocolProps::protocolService(Proto p)
case Proto::Cloak: return ServiceType::Vpn;
case Proto::ShadowSocks: 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::Dns: 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::ShadowSocks: return 6789;
case Proto::WireGuard: return 51820;
case Proto::AmneziaWireGuard: return 55424;
case Proto::Awg: return 55424;
case Proto::Ikev2: return -1;
case Proto::L2tp: return -1;
@ -125,7 +125,7 @@ bool ProtocolProps::defaultPortChangeable(Proto p)
case Proto::Cloak: return true;
case Proto::ShadowSocks: return true;
case Proto::WireGuard: return true;
case Proto::AmneziaWireGuard: return true;
case Proto::Awg: return true;
case Proto::Ikev2: return false;
case Proto::L2tp: return false;
@ -144,7 +144,7 @@ TransportProto ProtocolProps::defaultTransportProto(Proto p)
case Proto::Cloak: return TransportProto::Tcp;
case Proto::ShadowSocks: return TransportProto::Tcp;
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::L2tp: return TransportProto::Udp;
// non-vpn
@ -163,7 +163,7 @@ bool ProtocolProps::defaultTransportProtoChangeable(Proto p)
case Proto::Cloak: return false;
case Proto::ShadowSocks: return false;
case Proto::WireGuard: return false;
case Proto::AmneziaWireGuard: return false;
case Proto::Awg: return false;
case Proto::Ikev2: return false;
case Proto::L2tp: return false;
// non-vpn

View file

@ -76,7 +76,7 @@ namespace amnezia
constexpr char shadowsocks[] = "shadowsocks";
constexpr char cloak[] = "cloak";
constexpr char sftp[] = "sftp";
constexpr char amneziaWireguard[] = "amneziawireguard";
constexpr char awg[] = "awg";
}
@ -151,13 +151,13 @@ namespace amnezia
} // namespace sftp
namespace amneziawireguard
namespace awg
{
constexpr char defaultPort[] = "55424";
constexpr char serverConfigPath[] = "/opt/amnezia/amneziawireguard/wg0.conf";
constexpr char serverPublicKeyPath[] = "/opt/amnezia/amneziawireguard/wireguard_server_public_key.key";
constexpr char serverPskKeyPath[] = "/opt/amnezia/amneziawireguard/wireguard_psk.key";
constexpr char serverConfigPath[] = "/opt/amnezia/awg/wg0.conf";
constexpr char serverPublicKeyPath[] = "/opt/amnezia/awg/wireguard_server_public_key.key";
constexpr char serverPskKeyPath[] = "/opt/amnezia/awg/wireguard_psk.key";
constexpr char defaultJunkPacketCount[] = "3";
constexpr char defaultJunkPacketMinSize[] = "10";
@ -188,7 +188,7 @@ namespace amnezia
ShadowSocks,
Cloak,
WireGuard,
AmneziaWireGuard,
Awg,
Ikev2,
L2tp,

View file

@ -113,7 +113,7 @@ VpnProtocol *VpnProtocol::factory(DockerContainer container, const QJsonObject &
case DockerContainer::Cloak: return new OpenVpnOverCloakProtocol(configuration);
case DockerContainer::ShadowSocks: return new ShadowSocksVpnProtocol(configuration);
case DockerContainer::WireGuard: return new WireguardProtocol(configuration);
case DockerContainer::AmneziaWireGuard: return new WireguardProtocol(configuration);
case DockerContainer::Awg: return new WireguardProtocol(configuration);
#endif
default: return nullptr;
}

View file

@ -215,7 +215,7 @@
<file>ui/qml/Controls2/ListViewWithLabelsType.qml</file>
<file>ui/qml/Pages2/PageServiceDnsSettings.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/start.sh</file>
<file>server_scripts/amnezia_wireguard/configure_container.sh</file>

View file

@ -1,19 +1,19 @@
mkdir -p /opt/amnezia/amneziawireguard
cd /opt/amnezia/amneziawireguard
mkdir -p /opt/amnezia/awg
cd /opt/amnezia/awg
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)
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)
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]
PrivateKey = $WIREGUARD_SERVER_PRIVATE_KEY
Address = 10.8.1.1/24
ListenPort = $AMNEZIAWIREGUARD_SERVER_PORT
Address = $WIREGUARD_SUBNET_IP/$WIREGUARD_SUBNET_CIDR
ListenPort = $AWG_SERVER_PORT
Jc = $JUNK_PACKET_COUNT
Jmin = $JUNK_PACKET_MIN_SIZE
Jmax = $JUNK_PACKET_MAX_SIZE

View file

@ -5,7 +5,7 @@ sudo docker run -d \
--privileged \
--cap-add=NET_ADMIN \
--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 \
--sysctl="net.ipv4.conf.all.src_valid_mark=1" \
--name $CONTAINER_NAME \

View file

@ -5,14 +5,11 @@
echo "Container startup"
#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
wg-quick down /opt/amnezia/amneziawireguard/wg0.conf
wg-quick down /opt/amnezia/awg/wg0.conf
# 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.
iptables -A INPUT -i wg0 -j ACCEPT

View file

@ -16,5 +16,5 @@ H4 = $TRANSPORT_PACKET_MAGIC_HEADER
PublicKey = $WIREGUARD_SERVER_PUBLIC_KEY
PresharedKey = $WIREGUARD_PSK
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = $SERVER_IP_ADDRESS:$AMNEZIAWIREGUARD_SERVER_PORT
Endpoint = $SERVER_IP_ADDRESS:$AWG_SERVER_PORT
PersistentKeepalive = 25

View file

@ -291,7 +291,7 @@ QJsonObject ImportController::extractWireGuardConfig(const QString &data)
lastConfig[config_key::responsePacketMagicHeader] = configMap.value(config_key::responsePacketMagicHeader);
lastConfig[config_key::underloadPacketMagicHeader] = configMap.value(config_key::underloadPacketMagicHeader);
lastConfig[config_key::transportPacketMagicHeader] = configMap.value(config_key::transportPacketMagicHeader);
protocolName = "amneziawireguard";
protocolName = "awg";
}
QJsonObject wireguardConfig;

View file

@ -49,7 +49,7 @@ namespace PageLoader
PageProtocolShadowSocksSettings,
PageProtocolCloakSettings,
PageProtocolWireGuardSettings,
PageProtocolAmneziaWireGuardSettings,
PageProtocolAwgSettings,
PageProtocolIKev2Settings,
PageProtocolRaw
};

View file

@ -1,20 +1,20 @@
#include "amneziaWireGuardConfigModel.h"
#include "awgConfigModel.h"
#include <QJsonDocument>
#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);
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()) {
return false;
@ -49,7 +49,7 @@ bool AmneziaWireGuardConfigModel::setData(const QModelIndex &index, const QVaria
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()) {
return false;
@ -71,7 +71,7 @@ QVariant AmneziaWireGuardConfigModel::data(const QModelIndex &index, int role) c
return QVariant();
}
void AmneziaWireGuardConfigModel::updateModel(const QJsonObject &config)
void AwgConfigModel::updateModel(const QJsonObject &config)
{
beginResetModel();
m_container = ContainerProps::containerFromString(config.value(config_key::container).toString());
@ -112,13 +112,13 @@ void AmneziaWireGuardConfigModel::updateModel(const QJsonObject &config)
endResetModel();
}
QJsonObject AmneziaWireGuardConfigModel::getConfig()
QJsonObject AwgConfigModel::getConfig()
{
m_fullConfig.insert(config_key::amneziaWireguard, m_protocolConfig);
return m_fullConfig;
}
QHash<int, QByteArray> AmneziaWireGuardConfigModel::roleNames() const
QHash<int, QByteArray> AwgConfigModel::roleNames() const
{
QHash<int, QByteArray> roles;

View file

@ -1,12 +1,12 @@
#ifndef AMNEZIAWIREGUARDCONFIGMODEL_H
#define AMNEZIAWIREGUARDCONFIGMODEL_H
#ifndef AWGCONFIGMODEL_H
#define AWGCONFIGMODEL_H
#include <QAbstractListModel>
#include <QJsonObject>
#include "containers/containers_defs.h"
class AmneziaWireGuardConfigModel : public QAbstractListModel
class AwgConfigModel : public QAbstractListModel
{
Q_OBJECT
@ -24,7 +24,7 @@ public:
TransportPacketMagicHeaderRole
};
explicit AmneziaWireGuardConfigModel(QObject *parent = nullptr);
explicit AwgConfigModel(QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
@ -44,4 +44,4 @@ private:
QJsonObject m_fullConfig;
};
#endif // AMNEZIAWIREGUARDCONFIGMODEL_H
#endif // AWGCONFIGMODEL_H

View file

@ -64,9 +64,9 @@ ListView {
// goToPage(PageEnum.PageProtocolWireGuardSettings)
break
}
case ContainerEnum.AmneziaWireGuard: {
AmneziaWireGuardConfigModel.updateModel(config)
PageController.goToPage(PageEnum.PageProtocolAmneziaWireGuardSettings)
case ContainerEnum.Awg: {
AwgConfigModel.updateModel(config)
PageController.goToPage(PageEnum.PageProtocolAwgSettings)
break
}
case ContainerEnum.Ipsec: {

View file

@ -52,7 +52,7 @@ PageType {
clip: true
interactive: false
model: AmneziaWireGuardConfigModel
model: AwgConfigModel
delegate: Item {
implicitWidth: listview.width
@ -313,7 +313,7 @@ PageType {
onClicked: {
forceActiveFocus()
PageController.showBusyIndicator(true)
InstallController.updateContainer(AmneziaWireGuardConfigModel.getConfig())
InstallController.updateContainer(AwgConfigModel.getConfig())
PageController.showBusyIndicator(false)
}
}