added models, classes and ui files for amnezia wireguard
This commit is contained in:
parent
d4d6fbab88
commit
6afdd8375d
26 changed files with 534 additions and 60 deletions
10
client/protocols/amneziaWireGuardProtocol.cpp
Normal file
10
client/protocols/amneziaWireGuardProtocol.cpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
#include "amneziaWireGuardProtocol.h"
|
||||
|
||||
AmneziaWireGuardProtocol::AmneziaWireGuardProtocol(const QJsonObject &configuration, QObject *parent)
|
||||
: WireguardProtocol(configuration, parent)
|
||||
{
|
||||
}
|
||||
|
||||
AmneziaWireGuardProtocol::~AmneziaWireGuardProtocol()
|
||||
{
|
||||
}
|
17
client/protocols/amneziaWireGuardProtocol.h
Normal file
17
client/protocols/amneziaWireGuardProtocol.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
#ifndef AMNEZIAWIREGUARDPROTOCOL_H
|
||||
#define AMNEZIAWIREGUARDPROTOCOL_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "wireguardprotocol.h"
|
||||
|
||||
class AmneziaWireGuardProtocol : public WireguardProtocol
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AmneziaWireGuardProtocol(const QJsonObject &configuration, QObject *parent = nullptr);
|
||||
virtual ~AmneziaWireGuardProtocol() override;
|
||||
};
|
||||
|
||||
#endif // AMNEZIAWIREGUARDPROTOCOL_H
|
|
@ -66,6 +66,7 @@ QMap<amnezia::Proto, QString> ProtocolProps::protocolHumanNames()
|
|||
{ Proto::ShadowSocks, "ShadowSocks" },
|
||||
{ Proto::Cloak, "Cloak" },
|
||||
{ Proto::WireGuard, "WireGuard" },
|
||||
{ Proto::WireGuard, "Amnezia WireGuard" },
|
||||
{ Proto::Ikev2, "IKEv2" },
|
||||
{ Proto::L2tp, "L2TP" },
|
||||
|
||||
|
@ -88,6 +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::TorWebSite: return ServiceType::Other;
|
||||
case Proto::Dns: return ServiceType::Other;
|
||||
case Proto::FileShare: return ServiceType::Other;
|
||||
|
@ -103,6 +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::Ikev2: return -1;
|
||||
case Proto::L2tp: return -1;
|
||||
|
||||
|
@ -122,6 +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::Ikev2: return false;
|
||||
case Proto::L2tp: return false;
|
||||
|
||||
|
@ -140,6 +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::Ikev2: return TransportProto::Udp;
|
||||
case Proto::L2tp: return TransportProto::Udp;
|
||||
// non-vpn
|
||||
|
@ -158,6 +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::Ikev2: return false;
|
||||
case Proto::L2tp: return false;
|
||||
// non-vpn
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#define PROTOCOLS_DEFS_H
|
||||
|
||||
#include <QDebug>
|
||||
#include <QObject>
|
||||
#include <QMetaEnum>
|
||||
#include <QObject>
|
||||
|
||||
namespace amnezia
|
||||
{
|
||||
|
@ -158,6 +158,7 @@ namespace amnezia
|
|||
ShadowSocks,
|
||||
Cloak,
|
||||
WireGuard,
|
||||
AmneziaWireGuard,
|
||||
Ikev2,
|
||||
L2tp,
|
||||
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
|
||||
#include "vpnprotocol.h"
|
||||
#include "core/errorstrings.h"
|
||||
#include "vpnprotocol.h"
|
||||
|
||||
#if defined(Q_OS_WINDOWS) || defined(Q_OS_MACX) || (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||
#include "openvpnprotocol.h"
|
||||
#include "shadowsocksvpnprotocol.h"
|
||||
#include "openvpnovercloakprotocol.h"
|
||||
#include "wireguardprotocol.h"
|
||||
#include "openvpnovercloakprotocol.h"
|
||||
#include "openvpnprotocol.h"
|
||||
#include "shadowsocksvpnprotocol.h"
|
||||
#include "wireguardprotocol.h"
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
#include "ikev2_vpn_protocol_windows.h"
|
||||
#include "ikev2_vpn_protocol_windows.h"
|
||||
#endif
|
||||
|
||||
|
||||
VpnProtocol::VpnProtocol(const QJsonObject &configuration, QObject* parent)
|
||||
VpnProtocol::VpnProtocol(const QJsonObject &configuration, QObject *parent)
|
||||
: QObject(parent),
|
||||
m_connectionState(Vpn::ConnectionState::Unknown),
|
||||
m_rawConfig(configuration),
|
||||
|
@ -31,7 +30,7 @@ VpnProtocol::VpnProtocol(const QJsonObject &configuration, QObject* parent)
|
|||
void VpnProtocol::setLastError(ErrorCode lastError)
|
||||
{
|
||||
m_lastError = lastError;
|
||||
if (lastError){
|
||||
if (lastError) {
|
||||
setConnectionState(Vpn::ConnectionState::Error);
|
||||
}
|
||||
qCritical().noquote() << "VpnProtocol error, code" << m_lastError << errorString(m_lastError);
|
||||
|
@ -103,7 +102,7 @@ QString VpnProtocol::vpnGateway() const
|
|||
return m_vpnGateway;
|
||||
}
|
||||
|
||||
VpnProtocol *VpnProtocol::factory(DockerContainer container, const QJsonObject& configuration)
|
||||
VpnProtocol *VpnProtocol::factory(DockerContainer container, const QJsonObject &configuration)
|
||||
{
|
||||
switch (container) {
|
||||
#if defined(Q_OS_WINDOWS)
|
||||
|
@ -114,6 +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);
|
||||
#endif
|
||||
default: return nullptr;
|
||||
}
|
||||
|
@ -135,8 +135,7 @@ QString VpnProtocol::textConnectionState(Vpn::ConnectionState connectionState)
|
|||
case Vpn::ConnectionState::Disconnecting: return tr("Disconnecting...");
|
||||
case Vpn::ConnectionState::Reconnecting: return tr("Reconnecting...");
|
||||
case Vpn::ConnectionState::Error: return tr("Error");
|
||||
default:
|
||||
;
|
||||
default:;
|
||||
}
|
||||
|
||||
return QString();
|
||||
|
|
|
@ -18,7 +18,7 @@ WireguardProtocol::WireguardProtocol(const QJsonObject &configuration, QObject *
|
|||
|
||||
// MZ
|
||||
#if defined(MZ_LINUX)
|
||||
//m_impl.reset(new LinuxController());
|
||||
// m_impl.reset(new LinuxController());
|
||||
#elif defined(Q_OS_MAC) || defined(Q_OS_WIN)
|
||||
m_impl.reset(new LocalSocketController());
|
||||
connect(m_impl.get(), &ControllerImpl::connected, this,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue