mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-20 02:00:55 +07:00
refactor: own killswitch teardown at daemon level
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "leakdetector.h"
|
#include "leakdetector.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
#include "killswitch.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
Logger logger("LinuxDaemon");
|
Logger logger("LinuxDaemon");
|
||||||
@@ -50,3 +51,9 @@ LinuxDaemon* LinuxDaemon::instance() {
|
|||||||
Q_ASSERT(s_daemon);
|
Q_ASSERT(s_daemon);
|
||||||
return s_daemon;
|
return s_daemon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LinuxDaemon::deactivate(bool emitSignals) {
|
||||||
|
bool result = Daemon::deactivate(emitSignals);
|
||||||
|
KillSwitch::instance()->disableKillSwitch();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ class LinuxDaemon final : public Daemon {
|
|||||||
|
|
||||||
static LinuxDaemon* instance();
|
static LinuxDaemon* instance();
|
||||||
|
|
||||||
|
bool deactivate(bool emitSignals = true) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WireguardUtils* wgutils() const override { return m_wgutils; }
|
WireguardUtils* wgutils() const override { return m_wgutils; }
|
||||||
DnsUtils* dnsutils() override { return m_dnsutils; }
|
DnsUtils* dnsutils() override { return m_dnsutils; }
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
#include "leakdetector.h"
|
#include "leakdetector.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
|
||||||
#include "killswitch.h"
|
|
||||||
|
|
||||||
constexpr const int WG_TUN_PROC_TIMEOUT = 5000;
|
constexpr const int WG_TUN_PROC_TIMEOUT = 5000;
|
||||||
constexpr const char* WG_RUNTIME_DIR = "/var/run/amneziawg";
|
constexpr const char* WG_RUNTIME_DIR = "/var/run/amneziawg";
|
||||||
|
|
||||||
@@ -198,8 +196,6 @@ bool WireguardUtilsLinux::deleteInterface() {
|
|||||||
QDir wgRuntimeDir(WG_RUNTIME_DIR);
|
QDir wgRuntimeDir(WG_RUNTIME_DIR);
|
||||||
QFile::remove(wgRuntimeDir.filePath(m_ifname + ".name"));
|
QFile::remove(wgRuntimeDir.filePath(m_ifname + ".name"));
|
||||||
|
|
||||||
// double-check + ensure our firewall is installed and enabled
|
|
||||||
KillSwitch::instance()->disableKillSwitch();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#include "killswitch.h"
|
||||||
#include "leakdetector.h"
|
#include "leakdetector.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
|
||||||
@@ -50,3 +51,9 @@ MacOSDaemon* MacOSDaemon::instance() {
|
|||||||
Q_ASSERT(s_daemon);
|
Q_ASSERT(s_daemon);
|
||||||
return s_daemon;
|
return s_daemon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MacOSDaemon::deactivate(bool emitSignals) {
|
||||||
|
bool result = Daemon::deactivate(emitSignals);
|
||||||
|
KillSwitch::instance()->disableKillSwitch();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ class MacOSDaemon final : public Daemon {
|
|||||||
|
|
||||||
static MacOSDaemon* instance();
|
static MacOSDaemon* instance();
|
||||||
|
|
||||||
|
bool deactivate(bool emitSignals = true) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WireguardUtils* wgutils() const override { return m_wgutils; }
|
WireguardUtils* wgutils() const override { return m_wgutils; }
|
||||||
DnsUtils* dnsutils() override { return m_dnsutils; }
|
DnsUtils* dnsutils() override { return m_dnsutils; }
|
||||||
|
|||||||
@@ -17,8 +17,6 @@
|
|||||||
#include "leakdetector.h"
|
#include "leakdetector.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
|
||||||
#include "killswitch.h"
|
|
||||||
|
|
||||||
constexpr const int WG_TUN_PROC_TIMEOUT = 5000;
|
constexpr const int WG_TUN_PROC_TIMEOUT = 5000;
|
||||||
constexpr const char* WG_RUNTIME_DIR = "/var/run/amneziawg";
|
constexpr const char* WG_RUNTIME_DIR = "/var/run/amneziawg";
|
||||||
|
|
||||||
@@ -193,9 +191,6 @@ bool WireguardUtilsMacos::deleteInterface() {
|
|||||||
m_tunnel.waitForFinished(WG_TUN_PROC_TIMEOUT);
|
m_tunnel.waitForFinished(WG_TUN_PROC_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// double-check + ensure our firewall is installed and enabled
|
|
||||||
KillSwitch::instance()->disableKillSwitch();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user