mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-22 02:01:08 +07:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 890103a16a | |||
| 56ab82f87f | |||
| 3984acbb44 | |||
| cc404378f9 |
@@ -157,7 +157,7 @@ jobs:
|
|||||||
run: pip install "conan==2.28.0"
|
run: pip install "conan==2.28.0"
|
||||||
|
|
||||||
- name: 'Build dependencies'
|
- name: 'Build dependencies'
|
||||||
run: cmake -S . -B build -G "Visual Studio 17 2022" -DPREBUILTS_ONLY=1
|
run: cmake -S . -B build -DPREBUILTS_ONLY=1
|
||||||
|
|
||||||
- name: 'Authorize in remote'
|
- name: 'Authorize in remote'
|
||||||
if: github.ref == 'refs/heads/dev'
|
if: github.ref == 'refs/heads/dev'
|
||||||
|
|||||||
@@ -836,8 +836,8 @@ ErrorCode InstallController::installDockerWorker(const ServerCredentials &creden
|
|||||||
qDebug().noquote() << "InstallController::installDockerWorker" << stdOut;
|
qDebug().noquote() << "InstallController::installDockerWorker" << stdOut;
|
||||||
|
|
||||||
if (container == DockerContainer::Awg2) {
|
if (container == DockerContainer::Awg2) {
|
||||||
QRegularExpression regex(R"(Linux\s+(\d+)\.(\d+)[^\d]*)");
|
QRegularExpression kernelVersionRegex(R"(Linux\s+(\d+)\.(\d+)[^\d]*)");
|
||||||
QRegularExpressionMatch match = regex.match(stdOut);
|
QRegularExpressionMatch match = kernelVersionRegex.match(stdOut);
|
||||||
if (match.hasMatch()) {
|
if (match.hasMatch()) {
|
||||||
int majorVersion = match.captured(1).toInt();
|
int majorVersion = match.captured(1).toInt();
|
||||||
int minorVersion = match.captured(2).toInt();
|
int minorVersion = match.captured(2).toInt();
|
||||||
@@ -850,8 +850,19 @@ ErrorCode InstallController::installDockerWorker(const ServerCredentials &creden
|
|||||||
|
|
||||||
if (stdOut.contains("lock"))
|
if (stdOut.contains("lock"))
|
||||||
return ErrorCode::ServerPacketManagerError;
|
return ErrorCode::ServerPacketManagerError;
|
||||||
if (stdOut.contains("command not found"))
|
if (stdOut.contains("Container runtime is not supported"))
|
||||||
|
return ErrorCode::ServerContainerRuntimeNotSupported;
|
||||||
|
|
||||||
|
QRegularExpression notFoundRegex(
|
||||||
|
R"(^.*(?:sudo:|docker:).*not found.*$)",
|
||||||
|
QRegularExpression::MultilineOption);
|
||||||
|
|
||||||
|
if (notFoundRegex.match(stdOut).hasMatch()) {
|
||||||
return ErrorCode::ServerDockerFailedError;
|
return ErrorCode::ServerDockerFailedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stdOut.contains("Container runtime service not running"))
|
||||||
|
return ErrorCode::ContainerRuntimeServiceNotRunning;
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
@@ -888,7 +899,7 @@ ErrorCode InstallController::isUserInSudo(const ServerCredentials &credentials,
|
|||||||
return ErrorCode::ServerUserNotInSudo;
|
return ErrorCode::ServerUserNotInSudo;
|
||||||
if (stdOut.contains("can't cd to") || stdOut.contains("Permission denied") || stdOut.contains("No such file or directory"))
|
if (stdOut.contains("can't cd to") || stdOut.contains("Permission denied") || stdOut.contains("No such file or directory"))
|
||||||
return ErrorCode::ServerUserDirectoryNotAccessible;
|
return ErrorCode::ServerUserDirectoryNotAccessible;
|
||||||
if (stdOut.contains("sudoers") || stdOut.contains("is not allowed to run sudo on"))
|
if (stdOut.contains(QRegularExpression(R"(\bsudoers\b)")) || stdOut.contains("is not allowed to") || stdOut.contains("can't do that"))
|
||||||
return ErrorCode::ServerUserNotAllowedInSudoers;
|
return ErrorCode::ServerUserNotAllowedInSudoers;
|
||||||
if (stdOut.contains("password is required") || stdOut.contains("authentication is required"))
|
if (stdOut.contains("password is required") || stdOut.contains("authentication is required"))
|
||||||
return ErrorCode::ServerUserPasswordRequired;
|
return ErrorCode::ServerUserPasswordRequired;
|
||||||
|
|||||||
@@ -9,13 +9,10 @@
|
|||||||
#include "ipc.h"
|
#include "ipc.h"
|
||||||
|
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include <QJsonArray>
|
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QNetworkInterface>
|
#include <QNetworkInterface>
|
||||||
#include <QNetworkProxy>
|
|
||||||
#include <QTcpSocket>
|
|
||||||
#include <QtCore/qlogging.h>
|
#include <QtCore/qlogging.h>
|
||||||
#include <QtCore/qobjectdefs.h>
|
#include <QtCore/qobjectdefs.h>
|
||||||
#include <QtCore/qprocess.h>
|
#include <QtCore/qprocess.h>
|
||||||
@@ -59,28 +56,6 @@ XrayProtocol::XrayProtocol(const QJsonObject &configuration, QObject *parent) :
|
|||||||
qWarning() << "Xray config string is not a valid JSON object";
|
qWarning() << "Xray config string is not a valid JSON object";
|
||||||
m_xrayConfig = {};
|
m_xrayConfig = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
m_serverPort = extractServerPort();
|
|
||||||
}
|
|
||||||
|
|
||||||
int XrayProtocol::extractServerPort() const
|
|
||||||
{
|
|
||||||
const QJsonArray outbounds = m_xrayConfig.value(amnezia::protocols::xray::outbounds).toArray();
|
|
||||||
if (outbounds.isEmpty())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
const QJsonObject settings = outbounds.first().toObject().value(amnezia::protocols::xray::settings).toObject();
|
|
||||||
|
|
||||||
QJsonArray servers;
|
|
||||||
if (settings.contains(amnezia::protocols::xray::vnext))
|
|
||||||
servers = settings.value(amnezia::protocols::xray::vnext).toArray();
|
|
||||||
else if (settings.contains(amnezia::protocols::xray::servers))
|
|
||||||
servers = settings.value(amnezia::protocols::xray::servers).toArray();
|
|
||||||
|
|
||||||
if (servers.isEmpty())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return servers.first().toObject().value(amnezia::protocols::xray::port).toInt();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XrayProtocol::~XrayProtocol()
|
XrayProtocol::~XrayProtocol()
|
||||||
@@ -93,13 +68,6 @@ ErrorCode XrayProtocol::start()
|
|||||||
{
|
{
|
||||||
qDebug() << "XrayProtocol::start()";
|
qDebug() << "XrayProtocol::start()";
|
||||||
|
|
||||||
m_connectivityProbeStarted = false;
|
|
||||||
|
|
||||||
if (!probeServerReachable()) {
|
|
||||||
qCritical() << "XrayProtocol: VPN server" << m_remoteAddress << "is unreachable";
|
|
||||||
return ErrorCode::XrayServerUnreachable;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inject SOCKS5 auth into the inbound before starting xray.
|
// Inject SOCKS5 auth into the inbound before starting xray.
|
||||||
// Re-uses existing credentials if the config already has them (e.g. imported config).
|
// Re-uses existing credentials if the config already has them (e.g. imported config).
|
||||||
amnezia::serialization::inbounds::InboundCredentials creds;
|
amnezia::serialization::inbounds::InboundCredentials creds;
|
||||||
@@ -136,50 +104,22 @@ ErrorCode XrayProtocol::start()
|
|||||||
qDebug() << "XrayProtocol: patched legacy inbound listen address to 127.0.0.1";
|
qDebug() << "XrayProtocol: patched legacy inbound listen address to 127.0.0.1";
|
||||||
}
|
}
|
||||||
|
|
||||||
startTimeoutTimer();
|
|
||||||
|
|
||||||
return IpcClient::withInterface(
|
return IpcClient::withInterface(
|
||||||
[&](QSharedPointer<IpcInterfaceReplica> iface) {
|
[&](QSharedPointer<IpcInterfaceReplica> iface) {
|
||||||
auto xrayStart = iface->xrayStart(xrayConfigStr);
|
auto xrayStart = iface->xrayStart(xrayConfigStr);
|
||||||
if (!xrayStart.waitForFinished() || !xrayStart.returnValue()) {
|
if (!xrayStart.waitForFinished() || !xrayStart.returnValue()) {
|
||||||
qCritical() << "Failed to start xray";
|
qCritical() << "Failed to start xray";
|
||||||
stopTimeoutTimer();
|
|
||||||
return ErrorCode::XrayExecutableCrashed;
|
return ErrorCode::XrayExecutableCrashed;
|
||||||
}
|
}
|
||||||
return startTun2Socks();
|
return startTun2Socks();
|
||||||
},
|
},
|
||||||
[this]() {
|
[]() { return ErrorCode::AmneziaServiceConnectionFailed; });
|
||||||
stopTimeoutTimer();
|
|
||||||
return ErrorCode::AmneziaServiceConnectionFailed;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XrayProtocol::stop()
|
void XrayProtocol::stop()
|
||||||
{
|
{
|
||||||
qDebug() << "XrayProtocol::stop()";
|
qDebug() << "XrayProtocol::stop()";
|
||||||
|
|
||||||
stopTimeoutTimer();
|
|
||||||
stopLivenessMonitor();
|
|
||||||
|
|
||||||
if (m_tun2socksProcess) {
|
|
||||||
m_tun2socksProcess->blockSignals(true);
|
|
||||||
|
|
||||||
#ifndef Q_OS_WIN
|
|
||||||
m_tun2socksProcess->terminate();
|
|
||||||
auto waitForFinished = m_tun2socksProcess->waitForFinished(1000);
|
|
||||||
if (!waitForFinished.waitForFinished() || !waitForFinished.returnValue()) {
|
|
||||||
qWarning() << "Failed to terminate tun2socks. Killing the process...";
|
|
||||||
m_tun2socksProcess->kill();
|
|
||||||
m_tun2socksProcess->waitForFinished(1000);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
m_tun2socksProcess->kill();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_tun2socksProcess->close();
|
|
||||||
m_tun2socksProcess.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
IpcClient::withInterface([](QSharedPointer<IpcInterfaceReplica> iface) {
|
IpcClient::withInterface([](QSharedPointer<IpcInterfaceReplica> iface) {
|
||||||
auto disableKillSwitch = iface->disableKillSwitch();
|
auto disableKillSwitch = iface->disableKillSwitch();
|
||||||
if (!disableKillSwitch.waitForFinished() || !disableKillSwitch.returnValue())
|
if (!disableKillSwitch.waitForFinished() || !disableKillSwitch.returnValue())
|
||||||
@@ -202,13 +142,31 @@ void XrayProtocol::stop()
|
|||||||
qWarning() << "Failed to stop xray";
|
qWarning() << "Failed to stop xray";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (m_tun2socksProcess) {
|
||||||
|
m_tun2socksProcess->blockSignals(true);
|
||||||
|
|
||||||
|
#ifndef Q_OS_WIN
|
||||||
|
m_tun2socksProcess->terminate();
|
||||||
|
auto waitForFinished = m_tun2socksProcess->waitForFinished(1000);
|
||||||
|
if (!waitForFinished.waitForFinished() || !waitForFinished.returnValue()) {
|
||||||
|
qWarning() << "Failed to terminate tun2socks. Killing the process...";
|
||||||
|
m_tun2socksProcess->kill();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// terminate does not do anything useful on Windows
|
||||||
|
// so just kill the process
|
||||||
|
m_tun2socksProcess->kill();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
m_tun2socksProcess->close();
|
||||||
|
m_tun2socksProcess.reset();
|
||||||
|
}
|
||||||
|
|
||||||
setConnectionState(Vpn::ConnectionState::Disconnected);
|
setConnectionState(Vpn::ConnectionState::Disconnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorCode XrayProtocol::startTun2Socks()
|
ErrorCode XrayProtocol::startTun2Socks()
|
||||||
{
|
{
|
||||||
m_tunResourceBusy = false;
|
|
||||||
|
|
||||||
m_tun2socksProcess = IpcClient::CreatePrivilegedProcess();
|
m_tun2socksProcess = IpcClient::CreatePrivilegedProcess();
|
||||||
if (!m_tun2socksProcess->waitForSource()) {
|
if (!m_tun2socksProcess->waitForSource()) {
|
||||||
return ErrorCode::AmneziaServiceConnectionFailed;
|
return ErrorCode::AmneziaServiceConnectionFailed;
|
||||||
@@ -233,31 +191,15 @@ ErrorCode XrayProtocol::startTun2Socks()
|
|||||||
if (!line.contains("[TCP]") && !line.contains("[UDP]"))
|
if (!line.contains("[TCP]") && !line.contains("[UDP]"))
|
||||||
qDebug() << "[tun2socks]:" << line;
|
qDebug() << "[tun2socks]:" << line;
|
||||||
|
|
||||||
if (line.contains("resource busy"))
|
if (line.contains("[STACK] tun://") && line.contains("<-> socks5://")) {
|
||||||
m_tunResourceBusy = true;
|
|
||||||
|
|
||||||
if (line.contains("[STACK] tun://") && line.contains("<-> socks5://") && !m_connectivityProbeStarted) {
|
|
||||||
m_connectivityProbeStarted = true;
|
|
||||||
disconnect(m_tun2socksProcess.data(), &IpcProcessInterfaceReplica::readyReadStandardOutput, this, nullptr);
|
disconnect(m_tun2socksProcess.data(), &IpcProcessInterfaceReplica::readyReadStandardOutput, this, nullptr);
|
||||||
disconnect(m_tun2socksProcess.data(), &IpcProcessInterfaceReplica::readyReadStandardError, this, nullptr);
|
|
||||||
|
|
||||||
runConnectivityProbe([this](bool ok) {
|
if (ErrorCode res = setupRouting(); res != ErrorCode::NoError) {
|
||||||
if (!ok) {
|
stop();
|
||||||
qCritical() << "Xray connectivity probe failed: no traffic flows through the tunnel";
|
setLastError(res);
|
||||||
stop();
|
} else {
|
||||||
setLastError(ErrorCode::XrayConnectivityCheckFailed);
|
setConnectionState(Vpn::ConnectionState::Connected);
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (ErrorCode res = setupRouting(); res != ErrorCode::NoError) {
|
|
||||||
stop();
|
|
||||||
setLastError(res);
|
|
||||||
} else {
|
|
||||||
stopTimeoutTimer();
|
|
||||||
setConnectionState(Vpn::ConnectionState::Connected);
|
|
||||||
startLivenessMonitor();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
@@ -265,7 +207,15 @@ ErrorCode XrayProtocol::startTun2Socks()
|
|||||||
connect(
|
connect(
|
||||||
m_tun2socksProcess.data(), &IpcProcessInterfaceReplica::finished, this,
|
m_tun2socksProcess.data(), &IpcProcessInterfaceReplica::finished, this,
|
||||||
[this](int exitCode, QProcess::ExitStatus exitStatus) {
|
[this](int exitCode, QProcess::ExitStatus exitStatus) {
|
||||||
const bool resourceBusy = m_tunResourceBusy;
|
// Check stdout for "resource busy" — the TUN device was not yet released
|
||||||
|
// by the previous tun2socks instance. Retry after a short delay.
|
||||||
|
bool resourceBusy = false;
|
||||||
|
if (m_tun2socksProcess) {
|
||||||
|
auto readOut = m_tun2socksProcess->readAllStandardOutput();
|
||||||
|
if (readOut.waitForFinished()) {
|
||||||
|
resourceBusy = readOut.returnValue().contains("resource busy");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (resourceBusy && m_tun2socksRetryCount < maxTun2SocksRetries) {
|
if (resourceBusy && m_tun2socksRetryCount < maxTun2SocksRetries) {
|
||||||
m_tun2socksRetryCount++;
|
m_tun2socksRetryCount++;
|
||||||
@@ -381,98 +331,3 @@ ErrorCode XrayProtocol::setupRouting()
|
|||||||
},
|
},
|
||||||
[]() { return ErrorCode::AmneziaServiceConnectionFailed; });
|
[]() { return ErrorCode::AmneziaServiceConnectionFailed; });
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XrayProtocol::probeServerReachable()
|
|
||||||
{
|
|
||||||
if (m_remoteAddress.isEmpty() || m_serverPort <= 0) {
|
|
||||||
qWarning() << "XrayProtocol: skipping server reachability probe (address/port unknown)";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTcpSocket sock;
|
|
||||||
sock.connectToHost(m_remoteAddress, static_cast<quint16>(m_serverPort));
|
|
||||||
const bool ok = sock.waitForConnected(m_serverProbeTimeoutMs);
|
|
||||||
if (!ok) {
|
|
||||||
qWarning() << "XrayProtocol: server" << m_remoteAddress << ":" << m_serverPort
|
|
||||||
<< "unreachable:" << sock.errorString();
|
|
||||||
}
|
|
||||||
sock.abort();
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
void XrayProtocol::runConnectivityProbe(std::function<void(bool)> onResult)
|
|
||||||
{
|
|
||||||
if (m_remoteAddress.isEmpty() || m_serverPort <= 0) {
|
|
||||||
qWarning() << "XrayProtocol: connectivity probe skipped (server address/port unknown)";
|
|
||||||
onResult(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto *sock = new QTcpSocket(this);
|
|
||||||
|
|
||||||
QNetworkProxy proxy(QNetworkProxy::Socks5Proxy, QStringLiteral("127.0.0.1"),
|
|
||||||
static_cast<quint16>(m_socksPort), m_socksUser, m_socksPassword);
|
|
||||||
proxy.setCapabilities(QNetworkProxy::TunnelingCapability | QNetworkProxy::HostNameLookupCapability);
|
|
||||||
sock->setProxy(proxy);
|
|
||||||
|
|
||||||
auto *timeout = new QTimer(this);
|
|
||||||
timeout->setSingleShot(true);
|
|
||||||
|
|
||||||
auto done = QSharedPointer<bool>::create(false);
|
|
||||||
|
|
||||||
auto finish = [=](bool ok) {
|
|
||||||
if (*done)
|
|
||||||
return;
|
|
||||||
*done = true;
|
|
||||||
timeout->stop();
|
|
||||||
timeout->deleteLater();
|
|
||||||
sock->abort();
|
|
||||||
sock->deleteLater();
|
|
||||||
onResult(ok);
|
|
||||||
};
|
|
||||||
|
|
||||||
connect(sock, &QTcpSocket::connected, this, [=]() { finish(true); });
|
|
||||||
connect(sock, &QAbstractSocket::errorOccurred, this, [=](QAbstractSocket::SocketError) { finish(false); });
|
|
||||||
connect(timeout, &QTimer::timeout, this, [=]() { finish(false); });
|
|
||||||
|
|
||||||
timeout->start(m_connectivityProbeTimeoutMs);
|
|
||||||
sock->connectToHost(m_remoteAddress, static_cast<quint16>(m_serverPort));
|
|
||||||
}
|
|
||||||
|
|
||||||
void XrayProtocol::startLivenessMonitor()
|
|
||||||
{
|
|
||||||
if (!m_livenessTimer) {
|
|
||||||
m_livenessTimer = new QTimer(this);
|
|
||||||
connect(m_livenessTimer, &QTimer::timeout, this, [this]() {
|
|
||||||
if (connectionState() != Vpn::ConnectionState::Connected)
|
|
||||||
return;
|
|
||||||
|
|
||||||
runConnectivityProbe([this](bool ok) {
|
|
||||||
if (connectionState() != Vpn::ConnectionState::Connected)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (ok) {
|
|
||||||
m_livenessFailures = 0;
|
|
||||||
} else if (++m_livenessFailures >= m_maxLivenessFailures) {
|
|
||||||
qCritical() << "XrayProtocol: liveness check failed" << m_livenessFailures
|
|
||||||
<< "times in a row, the tunnel is dead";
|
|
||||||
stop();
|
|
||||||
setLastError(ErrorCode::XrayConnectionLost);
|
|
||||||
} else {
|
|
||||||
qWarning() << "XrayProtocol: liveness check failed (" << m_livenessFailures << "/"
|
|
||||||
<< m_maxLivenessFailures << ")";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
m_livenessFailures = 0;
|
|
||||||
m_livenessTimer->start(m_livenessIntervalMs);
|
|
||||||
}
|
|
||||||
|
|
||||||
void XrayProtocol::stopLivenessMonitor()
|
|
||||||
{
|
|
||||||
if (m_livenessTimer)
|
|
||||||
m_livenessTimer->stop();
|
|
||||||
m_livenessFailures = 0;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -6,16 +6,12 @@
|
|||||||
#include <QHostAddress>
|
#include <QHostAddress>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
#include "core/utils/errorCodes.h"
|
#include "core/utils/errorCodes.h"
|
||||||
#include "core/utils/routeModes.h"
|
#include "core/utils/routeModes.h"
|
||||||
#include "core/utils/commonStructs.h"
|
#include "core/utils/commonStructs.h"
|
||||||
#include "core/utils/ipcClient.h"
|
#include "core/utils/ipcClient.h"
|
||||||
#include "vpnProtocol.h"
|
#include "vpnProtocol.h"
|
||||||
|
|
||||||
class QTimer;
|
|
||||||
|
|
||||||
class XrayProtocol : public VpnProtocol
|
class XrayProtocol : public VpnProtocol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -29,17 +25,10 @@ private:
|
|||||||
ErrorCode setupRouting();
|
ErrorCode setupRouting();
|
||||||
ErrorCode startTun2Socks();
|
ErrorCode startTun2Socks();
|
||||||
|
|
||||||
bool probeServerReachable();
|
|
||||||
void runConnectivityProbe(std::function<void(bool)> onResult);
|
|
||||||
void startLivenessMonitor();
|
|
||||||
void stopLivenessMonitor();
|
|
||||||
int extractServerPort() const;
|
|
||||||
|
|
||||||
QJsonObject m_xrayConfig;
|
QJsonObject m_xrayConfig;
|
||||||
amnezia::RouteMode m_routeMode;
|
amnezia::RouteMode m_routeMode;
|
||||||
QList<QHostAddress> m_dnsServers;
|
QList<QHostAddress> m_dnsServers;
|
||||||
QString m_remoteAddress;
|
QString m_remoteAddress;
|
||||||
int m_serverPort = 0;
|
|
||||||
|
|
||||||
QString m_socksUser;
|
QString m_socksUser;
|
||||||
QString m_socksPassword;
|
QString m_socksPassword;
|
||||||
@@ -49,22 +38,6 @@ private:
|
|||||||
int m_tun2socksRetryCount = 0;
|
int m_tun2socksRetryCount = 0;
|
||||||
static constexpr int maxTun2SocksRetries = 5;
|
static constexpr int maxTun2SocksRetries = 5;
|
||||||
static constexpr int tun2socksRetryDelayMs = 400;
|
static constexpr int tun2socksRetryDelayMs = 400;
|
||||||
|
|
||||||
bool m_connectivityProbeStarted = false;
|
|
||||||
bool m_tunResourceBusy = false;
|
|
||||||
|
|
||||||
QTimer *m_livenessTimer = nullptr;
|
|
||||||
int m_livenessFailures = 0;
|
|
||||||
|
|
||||||
static constexpr int defaultServerProbeTimeoutMs = 5000;
|
|
||||||
static constexpr int defaultConnectivityProbeTimeoutMs = 7000;
|
|
||||||
static constexpr int defaultLivenessIntervalMs = 15000;
|
|
||||||
static constexpr int defaultMaxLivenessFailures = 3;
|
|
||||||
|
|
||||||
int m_serverProbeTimeoutMs = defaultServerProbeTimeoutMs;
|
|
||||||
int m_connectivityProbeTimeoutMs = defaultConnectivityProbeTimeoutMs;
|
|
||||||
int m_livenessIntervalMs = defaultLivenessIntervalMs;
|
|
||||||
int m_maxLivenessFailures = defaultMaxLivenessFailures;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // XRAYPROTOCOL_H
|
#endif // XRAYPROTOCOL_H
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ namespace amnezia
|
|||||||
XrayServerConfigInvalid = 215,
|
XrayServerConfigInvalid = 215,
|
||||||
XrayServerNoVlessClients = 216,
|
XrayServerNoVlessClients = 216,
|
||||||
XrayRealityKeysReadFailed = 217,
|
XrayRealityKeysReadFailed = 217,
|
||||||
|
ServerContainerRuntimeNotSupported = 218,
|
||||||
|
ContainerRuntimeServiceNotRunning = 219,
|
||||||
|
|
||||||
// Ssh connection errors
|
// Ssh connection errors
|
||||||
SshRequestDeniedError = 300,
|
SshRequestDeniedError = 300,
|
||||||
@@ -71,9 +73,6 @@ namespace amnezia
|
|||||||
OpenSslFailed = 800,
|
OpenSslFailed = 800,
|
||||||
XrayExecutableCrashed = 803,
|
XrayExecutableCrashed = 803,
|
||||||
Tun2SockExecutableCrashed = 804,
|
Tun2SockExecutableCrashed = 804,
|
||||||
XrayServerUnreachable = 805,
|
|
||||||
XrayConnectivityCheckFailed = 806,
|
|
||||||
XrayConnectionLost = 807,
|
|
||||||
|
|
||||||
// import and install errors
|
// import and install errors
|
||||||
ImportInvalidConfigError = 900,
|
ImportInvalidConfigError = 900,
|
||||||
@@ -127,5 +126,3 @@ namespace amnezia
|
|||||||
Q_DECLARE_METATYPE(amnezia::ErrorCode)
|
Q_DECLARE_METATYPE(amnezia::ErrorCode)
|
||||||
|
|
||||||
#endif // ERRORCODES_H
|
#endif // ERRORCODES_H
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ QString errorString(ErrorCode code) {
|
|||||||
case(ErrorCode::XrayRealityKeysReadFailed):
|
case(ErrorCode::XrayRealityKeysReadFailed):
|
||||||
errorMessage = QObject::tr("Server error: failed to read XRay Reality keys from the server");
|
errorMessage = QObject::tr("Server error: failed to read XRay Reality keys from the server");
|
||||||
break;
|
break;
|
||||||
|
case(ErrorCode::ServerContainerRuntimeNotSupported): errorMessage = QObject::tr("Server error: The default container runtime available for installation on this server is not supported.\n Install Docker Engine on the server manually and try again."); break;
|
||||||
|
case(ErrorCode::ContainerRuntimeServiceNotRunning): errorMessage = QObject::tr("Container runtime error: The container runtime service is not running.\n Check the container runtime service on the server, or wait about a minute and try again."); break;
|
||||||
|
|
||||||
// Libssh errors
|
// Libssh errors
|
||||||
case(ErrorCode::SshRequestDeniedError): errorMessage = QObject::tr("SSH request was denied"); break;
|
case(ErrorCode::SshRequestDeniedError): errorMessage = QObject::tr("SSH request was denied"); break;
|
||||||
@@ -59,9 +61,6 @@ QString errorString(ErrorCode code) {
|
|||||||
case (ErrorCode::OpenVpnExecutableMissing): errorMessage = QObject::tr("OpenVPN executable missing"); break;
|
case (ErrorCode::OpenVpnExecutableMissing): errorMessage = QObject::tr("OpenVPN executable missing"); break;
|
||||||
case (ErrorCode::AmneziaServiceConnectionFailed): errorMessage = QObject::tr("Amnezia helper service error"); break;
|
case (ErrorCode::AmneziaServiceConnectionFailed): errorMessage = QObject::tr("Amnezia helper service error"); break;
|
||||||
case (ErrorCode::OpenSslFailed): errorMessage = QObject::tr("OpenSSL failed"); break;
|
case (ErrorCode::OpenSslFailed): errorMessage = QObject::tr("OpenSSL failed"); break;
|
||||||
case (ErrorCode::XrayServerUnreachable): errorMessage = QObject::tr("Can't connect: the VPN server is unreachable"); break;
|
|
||||||
case (ErrorCode::XrayConnectivityCheckFailed): errorMessage = QObject::tr("Can't connect: no internet traffic flows through the tunnel"); break;
|
|
||||||
case (ErrorCode::XrayConnectionLost): errorMessage = QObject::tr("Connection lost: traffic stopped flowing through the tunnel"); break;
|
|
||||||
|
|
||||||
// VPN errors
|
// VPN errors
|
||||||
case (ErrorCode::OpenVpnAdaptersInUseError): errorMessage = QObject::tr("Can't connect: another VPN connection is active"); break;
|
case (ErrorCode::OpenVpnAdaptersInUseError): errorMessage = QObject::tr("Can't connect: another VPN connection is active"); break;
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QLocalSocket>
|
#include <QLocalSocket>
|
||||||
|
|
||||||
#include "daemon.h"
|
|
||||||
#include "daemonlocalserverconnection.h"
|
#include "daemonlocalserverconnection.h"
|
||||||
#include "leakdetector.h"
|
#include "leakdetector.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
@@ -59,11 +58,8 @@ bool DaemonLocalServer::initialize() {
|
|||||||
|
|
||||||
DaemonLocalServerConnection* connection =
|
DaemonLocalServerConnection* connection =
|
||||||
new DaemonLocalServerConnection(&m_server, socket);
|
new DaemonLocalServerConnection(&m_server, socket);
|
||||||
connect(socket, &QLocalSocket::disconnected, connection, [connection]() {
|
connect(socket, &QLocalSocket::disconnected, connection,
|
||||||
logger.debug() << "Client connection dropped, deactivating daemon";
|
&DaemonLocalServerConnection::deleteLater);
|
||||||
Daemon::instance()->deactivate(true);
|
|
||||||
connection->deleteLater();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
if which apt-get > /dev/null 2>&1; then LOCK_CMD="fuser"; LOCK_FILE="/var/lib/dpkg/lock-frontend";\
|
if which apt-get > /dev/null 2>&1 || command -v apt-get > /dev/null 2>&1; then LOCK_CMD="fuser"; LOCK_FILE="/var/lib/dpkg/lock-frontend";\
|
||||||
elif which dnf > /dev/null 2>&1; then LOCK_CMD="fuser"; LOCK_FILE="/var/cache/dnf/* /var/run/dnf/* /var/lib/dnf/* /var/lib/rpm/*";\
|
elif which dnf > /dev/null 2>&1 || command -v dnf > /dev/null 2>&1; then LOCK_CMD="fuser"; LOCK_FILE="/var/cache/dnf/* /var/run/dnf/* /var/lib/dnf/* /var/lib/rpm/*";\
|
||||||
elif which yum > /dev/null 2>&1; then LOCK_CMD="cat"; LOCK_FILE="/var/run/yum.pid";\
|
elif which yum > /dev/null 2>&1 || command -v yum > /dev/null 2>&1; then LOCK_CMD="cat"; LOCK_FILE="/var/run/yum.pid";\
|
||||||
elif which zypper > /dev/null 2>&1; then LOCK_CMD="cat"; LOCK_FILE="/var/run/zypp.pid";\
|
elif which zypper > /dev/null 2>&1 || command -v zypper > /dev/null 2>&1; then LOCK_CMD="cat"; LOCK_FILE="/var/run/zypp.pid";\
|
||||||
elif which pacman > /dev/null 2>&1; then LOCK_CMD="fuser"; LOCK_FILE="/var/lib/pacman/db.lck";\
|
elif which pacman > /dev/null 2>&1 || command -v pacman > /dev/null 2>&1; then LOCK_CMD="fuser"; LOCK_FILE="/var/lib/pacman/db.lck";\
|
||||||
else echo "Packet manager not found"; echo "Internal error"; exit 1; fi;\
|
else echo "Packet manager not found"; echo "Internal error"; exit 1;\
|
||||||
if command -v $LOCK_CMD > /dev/null 2>&1; then sudo $LOCK_CMD $LOCK_FILE 2>/dev/null; else echo "$LOCK_CMD not installed"; fi
|
fi;\
|
||||||
|
if sudo -n which $LOCK_CMD > /dev/null 2>&1 || command -v $LOCK_CMD > /dev/null 2>&1; then sudo -n $LOCK_CMD $LOCK_FILE 2>/dev/null; else echo "$LOCK_CMD not installed"; fi
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
if which apt-get > /dev/null 2>&1; then pm=$(which apt-get); opt="--version";\
|
if pm=$(which apt-get 2>/dev/null || command -v apt-get 2>/dev/null); then opt="--version";\
|
||||||
elif which dnf > /dev/null 2>&1; then pm=$(which dnf); opt="--version";\
|
elif pm=$(which dnf 2>/dev/null || command -v dnf 2>/dev/null); then opt="--version";\
|
||||||
elif which yum > /dev/null 2>&1; then pm=$(which yum); opt="--version";\
|
elif pm=$(which yum 2>/dev/null || command -v yum 2>/dev/null); then opt="--version";\
|
||||||
elif which zypper > /dev/null 2>&1; then pm=$(which zypper); opt="--version";\
|
elif pm=$(which zypper 2>/dev/null || command -v zypper 2>/dev/null); then opt="--version";\
|
||||||
elif which pacman > /dev/null 2>&1; then pm=$(which pacman); opt="--version";\
|
elif pm=$(which pacman 2>/dev/null || command -v pacman 2>/dev/null); then opt="--version";\
|
||||||
else pm="uname"; opt="-a";\
|
else pm="uname"; opt="-a";\
|
||||||
fi;\
|
fi;\
|
||||||
CUR_USER=$(whoami 2>/dev/null || echo $HOME | sed 's/.*\///');\
|
CUR_USER=$(whoami 2>/dev/null || echo $HOME | sed 's/.*\///');\
|
||||||
|
|||||||
@@ -1,25 +1,34 @@
|
|||||||
if which apt-get > /dev/null 2>&1; then pm=$(which apt-get); silent_inst="-yq install --install-recommends"; check_pkgs="-yq update"; docker_pkg="docker.io"; dist="debian";\
|
if pm=$(which apt-get 2>/dev/null || command -v apt-get 2>/dev/null); then silent_inst="-yq install --install-recommends"; what_pkg="-s install"; check_pkgs="-yq update"; docker_pkg="docker.io"; dist="debian";\
|
||||||
elif which dnf > /dev/null 2>&1; then pm=$(which dnf); silent_inst="-yq install"; check_pkgs="-yq check-update"; docker_pkg="docker"; dist="fedora";\
|
elif pm=$(which dnf 2>/dev/null || command -v dnf 2>/dev/null); then silent_inst="-yq install"; what_pkg="--assumeno install --setopt=tsflags=test"; check_pkgs="-yq check-update"; docker_pkg="docker"; dist="fedora";\
|
||||||
elif which yum > /dev/null 2>&1; then pm=$(which yum); silent_inst="-y -q install"; check_pkgs="-y -q check-update"; docker_pkg="docker"; dist="centos";\
|
elif pm=$(which yum 2>/dev/null || command -v yum 2>/dev/null); then silent_inst="-y -q install"; what_pkg="--assumeno install --setopt=tsflags=test"; check_pkgs="-y -q check-update"; docker_pkg="docker"; dist="centos";\
|
||||||
elif which zypper > /dev/null 2>&1; then pm=$(which zypper); silent_inst="-nq install"; check_pkgs="-nq refresh"; docker_pkg="docker"; dist="opensuse";\
|
elif pm=$(which zypper 2>/dev/null || command -v zypper 2>/dev/null); then silent_inst="-nq install"; what_pkg="--dry-run install"; check_pkgs="-nq refresh"; docker_pkg="docker"; dist="suse";\
|
||||||
elif which pacman > /dev/null 2>&1; then pm=$(which pacman); silent_inst="-S --noconfirm --noprogressbar --quiet"; check_pkgs="-Sup"; docker_pkg="docker"; dist="archlinux";\
|
elif pm=$(which pacman 2>/dev/null || command -v pacman 2>/dev/null); then silent_inst="-S --noconfirm --noprogressbar --quiet"; what_pkg="-Sp"; check_pkgs="-Sup"; docker_pkg="docker"; dist="archlinux";\
|
||||||
else echo "Packet manager not found"; exit 1; fi;\
|
fi;\
|
||||||
echo "Dist: $dist, Packet manager: $pm, Install command: $silent_inst, Check pkgs command: $check_pkgs, Docker pkg: $docker_pkg";\
|
echo "Dist: $dist, Packet manager: $pm, Install command: $silent_inst, What pkg command: $what_pkg, Check pkgs command: $check_pkgs, Docker pkg: $docker_pkg, Language: $LANG";\
|
||||||
|
echo $LANG | grep -qE '^(en_US.UTF-8|C.UTF-8|C)$' || export LC_ALL=C;\
|
||||||
if [ "$dist" = "debian" ]; then export DEBIAN_FRONTEND=noninteractive; fi;\
|
if [ "$dist" = "debian" ]; then export DEBIAN_FRONTEND=noninteractive; fi;\
|
||||||
if ! command -v sudo > /dev/null 2>&1; then $pm $check_pkgs; $pm $silent_inst sudo; fi;\
|
if ! command -v sudo > /dev/null 2>&1; then $pm $check_pkgs; $pm $silent_inst sudo; fi;\
|
||||||
if ! command -v fuser > /dev/null 2>&1; then sudo $pm $check_pkgs; sudo $pm $silent_inst psmisc; fi;\
|
if ! sudo -n sh -c 'command -v which > /dev/null 2>&1'; then sudo -n $pm $check_pkgs; sudo -n $pm $silent_inst which; fi;\
|
||||||
if ! command -v lsof > /dev/null 2>&1; then sudo $pm $check_pkgs; sudo $pm $silent_inst lsof; fi;\
|
if ! sudo -n sh -c 'command -v fuser > /dev/null 2>&1'; then sudo -n $pm $check_pkgs; sudo -n $pm $silent_inst psmisc; fi;\
|
||||||
if ! command -v docker > /dev/null 2>&1; then \
|
if ! sudo -n sh -c 'command -v lsof > /dev/null 2>&1'; then sudo -n $pm $check_pkgs; sudo -n $pm $silent_inst lsof; fi;\
|
||||||
sudo $pm $check_pkgs; sudo $pm $silent_inst $docker_pkg;\
|
if ! sudo -n sh -c 'command -v docker > /dev/null 2>&1'; then \
|
||||||
sleep 5; sudo systemctl enable --now docker; sleep 5;\
|
sudo -n $pm $check_pkgs;\
|
||||||
|
if ! sudo -n $pm $what_pkg $docker_pkg 2>/dev/null | grep -qi podman; then \
|
||||||
|
sudo -n $pm $silent_inst $docker_pkg;\
|
||||||
|
sleep 5; sudo -n systemctl enable --now docker; sleep 5;\
|
||||||
|
else \
|
||||||
|
echo "Container runtime is not supported";\
|
||||||
|
exit 1;\
|
||||||
|
fi;\
|
||||||
fi;\
|
fi;\
|
||||||
if [ "$(cat /sys/module/apparmor/parameters/enabled 2>/dev/null)" = "Y" ]; then \
|
if [ "$(sudo -n cat /sys/module/apparmor/parameters/enabled 2>/dev/null)" = "Y" ]; then \
|
||||||
if ! command -v apparmor_parser > /dev/null 2>&1; then sudo $pm $check_pkgs; sudo $pm $silent_inst apparmor; fi;\
|
if ! sudo -n sh -c 'command -v apparmor_parser > /dev/null 2>&1'; then \
|
||||||
|
sudo -n $pm $check_pkgs; sudo -n $pm $silent_inst apparmor;\
|
||||||
|
fi;\
|
||||||
fi;\
|
fi;\
|
||||||
if [ "$(systemctl is-active docker)" != "active" ]; then \
|
if [ "$(sudo -n systemctl is-active docker)" != "active" ]; then \
|
||||||
sudo $pm $check_pkgs; sudo $pm $silent_inst $docker_pkg;\
|
sleep 5; sudo -n systemctl start docker; sleep 5;\
|
||||||
sleep 5; sudo systemctl start docker; sleep 5;\
|
if [ "$(sudo -n systemctl is-active docker)" != "active" ]; then echo "Container runtime service not running"; fi;\
|
||||||
fi;\
|
fi;\
|
||||||
if ! command -v sudo > /dev/null 2>&1; then echo "Failed to install sudo, command not found"; exit 1; fi;\
|
sudo -n docker --version || docker --version;\
|
||||||
docker --version;\
|
|
||||||
uname -sr
|
uname -sr
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
sudo docker ps -a | grep amnezia | awk '{print $1}' | xargs sudo docker stop;\
|
sudo docker ps -a | grep amnezia | awk '{print $1}' | xargs sudo docker stop;\
|
||||||
sudo docker ps -a | grep amnezia | awk '{print $1}' | xargs sudo docker rm -fv;\
|
sudo docker ps -a | grep amnezia | awk '{print $1}' | xargs sudo docker rm -fv;\
|
||||||
sudo docker images -a --format table | grep amnezia | awk '{print $3, $1 ":" $2}' | xargs sudo docker rmi;\
|
sudo docker images -a --format table | grep amnezia | awk '{print $3, $1 ":" $2}' | xargs sudo docker rmi;\
|
||||||
sudo docker volume ls | grep amnezia | awk '{print $2}' | xargs sudo docker volume rm -f;\
|
sudo docker volume ls --format '{{.Name}}' | grep '^amnezia-' | xargs -r sudo docker volume rm -f;\
|
||||||
sudo docker network ls | grep amnezia-dns-net | awk '{print $1}' | xargs sudo docker network rm;\
|
sudo docker network ls | grep amnezia-dns-net | awk '{print $1}' | xargs sudo docker network rm;\
|
||||||
sudo rm -frd /opt/amnezia
|
sudo rm -frd /opt/amnezia
|
||||||
|
|||||||
+4
-4
@@ -19,12 +19,12 @@ class AmneziaVPN(ConanFile):
|
|||||||
|
|
||||||
if has_service:
|
if has_service:
|
||||||
if os == "Windows":
|
if os == "Windows":
|
||||||
self.requires("awg-windows/0.1.8")
|
self.requires("awg-windows/0.1.9")
|
||||||
self.requires("tap-windows6/9.27.0")
|
self.requires("tap-windows6/9.27.0")
|
||||||
self.requires("win-split-tunnel/1.2.5.0")
|
self.requires("win-split-tunnel/1.2.5.0")
|
||||||
self.requires("wintun/0.14.1")
|
self.requires("wintun/0.14.1")
|
||||||
else:
|
else:
|
||||||
self.requires("awg-go/0.2.16")
|
self.requires("awg-go/0.2.18")
|
||||||
|
|
||||||
self.requires("amnezia-xray-bindings/1.1.0")
|
self.requires("amnezia-xray-bindings/1.1.0")
|
||||||
self.requires("tun2socks/2.6.0")
|
self.requires("tun2socks/2.6.0")
|
||||||
@@ -32,13 +32,13 @@ class AmneziaVPN(ConanFile):
|
|||||||
self.requires("v2ray-rules-dat/202603162227")
|
self.requires("v2ray-rules-dat/202603162227")
|
||||||
|
|
||||||
if has_ne:
|
if has_ne:
|
||||||
self.requires("awg-apple/2.0.1")
|
self.requires("awg-apple/2.0.2")
|
||||||
self.requires("hev-socks5-tunnel/2.15.0", options={"as_framework": True})
|
self.requires("hev-socks5-tunnel/2.15.0", options={"as_framework": True})
|
||||||
self.requires("openvpnadapter/1.0.0")
|
self.requires("openvpnadapter/1.0.0")
|
||||||
|
|
||||||
if os == "Android":
|
if os == "Android":
|
||||||
self.requires("amnezia-libxray/1.0.0")
|
self.requires("amnezia-libxray/1.0.0")
|
||||||
self.requires("awg-android/1.1.7")
|
self.requires("awg-android/2.0.1")
|
||||||
self.requires("openvpn-pt-android/1.0.0")
|
self.requires("openvpn-pt-android/1.0.0")
|
||||||
|
|
||||||
# expicitly use libssh@amnezia to prevent it from being downloaded from conan-center
|
# expicitly use libssh@amnezia to prevent it from being downloaded from conan-center
|
||||||
|
|||||||
@@ -28,42 +28,6 @@ IpcServer::IpcServer(QObject *parent) : IpcInterfaceSource(parent)
|
|||||||
connect(&m_pingHelper, &PingHelper::connectionLose, this, &IpcServer::connectionLose);
|
connect(&m_pingHelper, &PingHelper::connectionLose, this, &IpcServer::connectionLose);
|
||||||
}
|
}
|
||||||
|
|
||||||
IpcServer::~IpcServer()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void IpcServer::resetServiceState()
|
|
||||||
{
|
|
||||||
qDebug() << "IpcServer::resetServiceState — tearing down active VPN state";
|
|
||||||
|
|
||||||
Xray::getInstance().stopXray();
|
|
||||||
|
|
||||||
for (auto it = m_processes.cbegin(); it != m_processes.cend(); ++it) {
|
|
||||||
const ProcessDescriptor &pd = it.value();
|
|
||||||
if (!pd.ipcProcess)
|
|
||||||
continue;
|
|
||||||
pd.ipcProcess->terminate();
|
|
||||||
if (!pd.ipcProcess->waitForFinished(1000)) {
|
|
||||||
pd.ipcProcess->kill();
|
|
||||||
pd.ipcProcess->waitForFinished(1000);
|
|
||||||
}
|
|
||||||
pd.ipcProcess->close();
|
|
||||||
}
|
|
||||||
m_processes.clear();
|
|
||||||
|
|
||||||
Utils::killProcessByName(Utils::tun2socksPath());
|
|
||||||
Utils::killProcessByName(Utils::openVpnExecPath());
|
|
||||||
|
|
||||||
KillSwitch::instance()->disableKillSwitch();
|
|
||||||
|
|
||||||
Router::restoreResolvers();
|
|
||||||
Router::clearSavedRoutes();
|
|
||||||
Router::StartRoutingIpv6();
|
|
||||||
Router::flushDns();
|
|
||||||
|
|
||||||
m_pingHelper.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
int IpcServer::createPrivilegedProcess()
|
int IpcServer::createPrivilegedProcess()
|
||||||
{
|
{
|
||||||
#ifdef MZ_DEBUG
|
#ifdef MZ_DEBUG
|
||||||
|
|||||||
@@ -17,10 +17,6 @@ class IpcServer : public IpcInterfaceSource
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit IpcServer(QObject *parent = nullptr);
|
explicit IpcServer(QObject *parent = nullptr);
|
||||||
virtual ~IpcServer();
|
|
||||||
|
|
||||||
void resetServiceState();
|
|
||||||
|
|
||||||
virtual int createPrivilegedProcess() override;
|
virtual int createPrivilegedProcess() override;
|
||||||
|
|
||||||
virtual int routeAddList(const QString &gw, const QStringList &ips) override;
|
virtual int routeAddList(const QString &gw, const QStringList &ips) override;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import platform
|
|||||||
|
|
||||||
class AwgAndroid(ConanFile):
|
class AwgAndroid(ConanFile):
|
||||||
name = "awg-android"
|
name = "awg-android"
|
||||||
version = "1.1.7"
|
version = "2.0.1"
|
||||||
settings = "os", "arch", "build_type", "compiler"
|
settings = "os", "arch", "build_type", "compiler"
|
||||||
|
|
||||||
def configure(self):
|
def configure(self):
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import os
|
|||||||
|
|
||||||
class AwgApple(ConanFile):
|
class AwgApple(ConanFile):
|
||||||
name = "awg-apple"
|
name = "awg-apple"
|
||||||
version = "2.0.1"
|
version = "2.0.2"
|
||||||
settings = "os", "arch", "compiler"
|
settings = "os", "arch", "compiler"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -39,7 +39,7 @@ class AwgApple(ConanFile):
|
|||||||
|
|
||||||
def source(self):
|
def source(self):
|
||||||
get(self, f"https://github.com/amnezia-vpn/amneziawg-apple/archive/refs/tags/v{self.version}.zip",
|
get(self, f"https://github.com/amnezia-vpn/amneziawg-apple/archive/refs/tags/v{self.version}.zip",
|
||||||
sha256="9fe4f8cfbb6a751558b54b7979db3a5ea46e49731912aae99f093e84a1433e97", strip_root=True
|
sha256="a04f49eac9f82bbf5dd9031bab188d44de2b3482efde1b6e970821de1d5a3c5d", strip_root=True
|
||||||
)
|
)
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import os
|
|||||||
|
|
||||||
class AwgGo(ConanFile):
|
class AwgGo(ConanFile):
|
||||||
name = "awg-go"
|
name = "awg-go"
|
||||||
version = "0.2.16"
|
version = "0.2.18"
|
||||||
package_type = "application"
|
package_type = "application"
|
||||||
settings = "os", "arch"
|
settings = "os", "arch"
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ class AwgGo(ConanFile):
|
|||||||
|
|
||||||
def source(self):
|
def source(self):
|
||||||
get(self, f"https://github.com/amnezia-vpn/amneziawg-go/archive/refs/tags/v{self.version}.zip",
|
get(self, f"https://github.com/amnezia-vpn/amneziawg-go/archive/refs/tags/v{self.version}.zip",
|
||||||
sha256="34da7d4189f215f3930de441548bc2a0c89d54d347a4fb85cb9c715fce6413aa", strip_root=True
|
sha256="58eefbd012e79bd1525f0e02d748979e9480acc1a339df8ceb3b9ffafcedb1ba", strip_root=True
|
||||||
)
|
)
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import os
|
|||||||
|
|
||||||
class AwgWindows(ConanFile):
|
class AwgWindows(ConanFile):
|
||||||
name = "awg-windows"
|
name = "awg-windows"
|
||||||
version = "0.1.8"
|
version = "0.1.9"
|
||||||
settings = "os", "arch"
|
settings = "os", "arch"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -63,7 +63,7 @@ class AwgWindows(ConanFile):
|
|||||||
|
|
||||||
def source(self):
|
def source(self):
|
||||||
get(self, f"https://github.com/amnezia-vpn/amneziawg-windows/archive/refs/tags/v{self.version}.zip",
|
get(self, f"https://github.com/amnezia-vpn/amneziawg-windows/archive/refs/tags/v{self.version}.zip",
|
||||||
sha256="1de472832b332515c96cdf14ea887edde42ed7ad173675280c51baa9a3ef62f2", strip_root=True)
|
sha256="5c29a75cb2beae291cc51b64840a39f838da5f300b9e956f7964813a687ec74c", strip_root=True)
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
tc = AutotoolsToolchain(self)
|
tc = AutotoolsToolchain(self)
|
||||||
|
|||||||
@@ -650,6 +650,9 @@ class OpenSSLConan(ConanFile):
|
|||||||
if self._use_nmake:
|
if self._use_nmake:
|
||||||
self.cpp_info.components["ssl"].libs = ["libssl"]
|
self.cpp_info.components["ssl"].libs = ["libssl"]
|
||||||
self.cpp_info.components["crypto"].libs = ["libcrypto"]
|
self.cpp_info.components["crypto"].libs = ["libcrypto"]
|
||||||
|
elif self.settings.os == "Android" and self.options.shared:
|
||||||
|
self.cpp_info.components["ssl"].libs = ["ssl_3"]
|
||||||
|
self.cpp_info.components["crypto"].libs = ["crypto_3"]
|
||||||
else:
|
else:
|
||||||
self.cpp_info.components["ssl"].libs = ["ssl"]
|
self.cpp_info.components["ssl"].libs = ["ssl"]
|
||||||
self.cpp_info.components["crypto"].libs = ["crypto"]
|
self.cpp_info.components["crypto"].libs = ["crypto"]
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class Openvpn(ConanFile):
|
|||||||
|
|
||||||
def build_requirements(self):
|
def build_requirements(self):
|
||||||
if self._is_windows:
|
if self._is_windows:
|
||||||
self.tool_requires("cmake/[>=3.14 <4]")
|
self.tool_requires("cmake/[>=4.2]")
|
||||||
else:
|
else:
|
||||||
self.tool_requires("libtool/2.4.7")
|
self.tool_requires("libtool/2.4.7")
|
||||||
self.tool_requires("automake/1.16.5")
|
self.tool_requires("automake/1.16.5")
|
||||||
|
|||||||
@@ -35,20 +35,7 @@ LocalServer::LocalServer(QObject *parent) : QObject(parent),
|
|||||||
|
|
||||||
QObject::connect(m_server.data(), &QLocalServer::newConnection, this, [this]() {
|
QObject::connect(m_server.data(), &QLocalServer::newConnection, this, [this]() {
|
||||||
qDebug() << "LocalServer new connection";
|
qDebug() << "LocalServer new connection";
|
||||||
|
m_serverNode.addHostSideConnection(m_server->nextPendingConnection());
|
||||||
QLocalSocket *socket = m_server->nextPendingConnection();
|
|
||||||
if (!socket)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_activeClientSocket = socket;
|
|
||||||
|
|
||||||
QObject::connect(socket, &QLocalSocket::disconnected, this, [this, socket]() {
|
|
||||||
qDebug() << "LocalServer: client disconnected";
|
|
||||||
if (m_activeClientSocket == socket)
|
|
||||||
m_ipcServer.resetServiceState();
|
|
||||||
});
|
|
||||||
|
|
||||||
m_serverNode.addHostSideConnection(socket);
|
|
||||||
|
|
||||||
if (!m_isRemotingEnabled) {
|
if (!m_isRemotingEnabled) {
|
||||||
m_isRemotingEnabled = true;
|
m_isRemotingEnabled = true;
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ public:
|
|||||||
QRemoteObjectHost m_serverNode;
|
QRemoteObjectHost m_serverNode;
|
||||||
bool m_isRemotingEnabled = false;
|
bool m_isRemotingEnabled = false;
|
||||||
|
|
||||||
QPointer<QLocalSocket> m_activeClientSocket;
|
|
||||||
|
|
||||||
NetworkWatcher m_networkWatcher;
|
NetworkWatcher m_networkWatcher;
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
DaemonLocalServer server{qApp};
|
DaemonLocalServer server{qApp};
|
||||||
|
|||||||
Reference in New Issue
Block a user