Fix build action
This commit is contained in:
parent
d94e27bfa9
commit
1a17f2956a
3 changed files with 4 additions and 57 deletions
|
@ -21,9 +21,6 @@ class IpcInterface
|
|||
SLOT( void cleanUp() );
|
||||
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 enablePeerTraffic( const QJsonObject &configStr) );
|
||||
SLOT( bool enableKillSwitch( const QJsonObject &excludeAddr, int vpnAdapterIndex) );
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
@ -226,6 +177,7 @@ bool IpcServer::enableKillSwitch(const QJsonObject &configStr, int vpnAdapterInd
|
|||
return WindowsFirewall::instance()->enableKillSwitch(vpnAdapterIndex);
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
// double-check + ensure our firewall is installed and enabled
|
||||
if (!LinuxFirewall::isInstalled()) LinuxFirewall::install();
|
||||
|
||||
|
@ -255,9 +207,8 @@ bool IpcServer::enableKillSwitch(const QJsonObject &configStr, int vpnAdapterInd
|
|||
// QStringLiteral("100.vpnTunOnly"),
|
||||
// true,
|
||||
// LinuxFirewall::kRawTable);
|
||||
#endif
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool IpcServer::disableKillSwitch()
|
||||
|
@ -266,7 +217,9 @@ bool IpcServer::disableKillSwitch()
|
|||
return WindowsFirewall::instance()->disableKillSwitch();
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
LinuxFirewall::uninstall();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,9 +27,6 @@ public:
|
|||
virtual QStringList getTapList() override;
|
||||
virtual void cleanUp() 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 enableKillSwitch(const QJsonObject &excludeAddr, int vpnAdapterIndex) override;
|
||||
virtual bool disableKillSwitch() override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue