mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-24 02:00:24 +07:00
Fix build action
This commit is contained in:
@@ -21,9 +21,6 @@ class IpcInterface
|
|||||||
SLOT( void cleanUp() );
|
SLOT( void cleanUp() );
|
||||||
SLOT( void setLogsEnabled(bool enabled) );
|
SLOT( void setLogsEnabled(bool enabled) );
|
||||||
|
|
||||||
SLOT( bool copyWireguardConfig(const QString &sourcePath) );
|
|
||||||
SLOT( bool isWireguardRunning() );
|
|
||||||
SLOT( bool isWireguardConfigExists(const QString &configPath) );
|
|
||||||
SLOT( bool disableKillSwitch() );
|
SLOT( bool disableKillSwitch() );
|
||||||
SLOT( bool enablePeerTraffic( const QJsonObject &configStr) );
|
SLOT( bool enablePeerTraffic( const QJsonObject &configStr) );
|
||||||
SLOT( bool enableKillSwitch( const QJsonObject &excludeAddr, int vpnAdapterIndex) );
|
SLOT( bool enableKillSwitch( const QJsonObject &excludeAddr, int vpnAdapterIndex) );
|
||||||
|
|||||||
+4
-51
@@ -170,55 +170,6 @@ void IpcServer::setLogsEnabled(bool enabled)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IpcServer::copyWireguardConfig(const QString &sourcePath)
|
|
||||||
{
|
|
||||||
#ifdef MZ_DEBUG
|
|
||||||
qDebug() << "IpcServer::copyWireguardConfig";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
|
||||||
const QString wireguardConfigPath = "/etc/wireguard/wg99.conf";
|
|
||||||
if (QFile::exists(wireguardConfigPath))
|
|
||||||
{
|
|
||||||
QFile::remove(wireguardConfigPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!QFile::copy(sourcePath, wireguardConfigPath)) {
|
|
||||||
qDebug() << "WireguardProtocol::WireguardProtocol error occurred while copying wireguard config:";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IpcServer::isWireguardRunning()
|
|
||||||
{
|
|
||||||
#ifdef MZ_DEBUG
|
|
||||||
qDebug() << "IpcServer::isWireguardRunning";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
|
||||||
QProcess checkWireguardStatusProcess;
|
|
||||||
|
|
||||||
connect(&checkWireguardStatusProcess, &QProcess::errorOccurred, this, [](QProcess::ProcessError error) {
|
|
||||||
qDebug() << "WireguardProtocol::WireguardProtocol error occurred while checking wireguard status: " << error;
|
|
||||||
});
|
|
||||||
|
|
||||||
checkWireguardStatusProcess.setProgram("/bin/wg");
|
|
||||||
checkWireguardStatusProcess.setArguments(QStringList{"show"});
|
|
||||||
checkWireguardStatusProcess.start();
|
|
||||||
checkWireguardStatusProcess.waitForFinished(10000);
|
|
||||||
QString output = checkWireguardStatusProcess.readAllStandardOutput();
|
|
||||||
if (!output.isEmpty()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IpcServer::enableKillSwitch(const QJsonObject &configStr, int vpnAdapterIndex)
|
bool IpcServer::enableKillSwitch(const QJsonObject &configStr, int vpnAdapterIndex)
|
||||||
{
|
{
|
||||||
@@ -226,6 +177,7 @@ bool IpcServer::enableKillSwitch(const QJsonObject &configStr, int vpnAdapterInd
|
|||||||
return WindowsFirewall::instance()->enableKillSwitch(vpnAdapterIndex);
|
return WindowsFirewall::instance()->enableKillSwitch(vpnAdapterIndex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
// double-check + ensure our firewall is installed and enabled
|
// double-check + ensure our firewall is installed and enabled
|
||||||
if (!LinuxFirewall::isInstalled()) LinuxFirewall::install();
|
if (!LinuxFirewall::isInstalled()) LinuxFirewall::install();
|
||||||
|
|
||||||
@@ -255,9 +207,8 @@ bool IpcServer::enableKillSwitch(const QJsonObject &configStr, int vpnAdapterInd
|
|||||||
// QStringLiteral("100.vpnTunOnly"),
|
// QStringLiteral("100.vpnTunOnly"),
|
||||||
// true,
|
// true,
|
||||||
// LinuxFirewall::kRawTable);
|
// LinuxFirewall::kRawTable);
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IpcServer::disableKillSwitch()
|
bool IpcServer::disableKillSwitch()
|
||||||
@@ -266,7 +217,9 @@ bool IpcServer::disableKillSwitch()
|
|||||||
return WindowsFirewall::instance()->disableKillSwitch();
|
return WindowsFirewall::instance()->disableKillSwitch();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
LinuxFirewall::uninstall();
|
LinuxFirewall::uninstall();
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,6 @@ public:
|
|||||||
virtual QStringList getTapList() override;
|
virtual QStringList getTapList() override;
|
||||||
virtual void cleanUp() override;
|
virtual void cleanUp() override;
|
||||||
virtual void setLogsEnabled(bool enabled) override;
|
virtual void setLogsEnabled(bool enabled) override;
|
||||||
virtual bool copyWireguardConfig(const QString &sourcePath) override;
|
|
||||||
virtual bool isWireguardRunning() override;
|
|
||||||
virtual bool isWireguardConfigExists(const QString &configPath) override;
|
|
||||||
virtual bool enablePeerTraffic(const QJsonObject &configStr) override;
|
virtual bool enablePeerTraffic(const QJsonObject &configStr) override;
|
||||||
virtual bool enableKillSwitch(const QJsonObject &excludeAddr, int vpnAdapterIndex) override;
|
virtual bool enableKillSwitch(const QJsonObject &excludeAddr, int vpnAdapterIndex) override;
|
||||||
virtual bool disableKillSwitch() override;
|
virtual bool disableKillSwitch() override;
|
||||||
|
|||||||
Reference in New Issue
Block a user