2025-05-02 23:54:36 -07:00
|
|
|
#ifndef KILLSWITCH_H
|
|
|
|
|
#define KILLSWITCH_H
|
|
|
|
|
|
|
|
|
|
#include <QJsonObject>
|
|
|
|
|
#include <QSharedPointer>
|
|
|
|
|
|
2026-04-30 14:53:03 +08:00
|
|
|
#include "secureQSettings.h"
|
2025-05-02 23:54:36 -07:00
|
|
|
|
|
|
|
|
class KillSwitch : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
static KillSwitch *instance();
|
|
|
|
|
bool init();
|
|
|
|
|
bool refresh(bool enabled);
|
|
|
|
|
bool disableKillSwitch();
|
|
|
|
|
bool disableAllTraffic();
|
|
|
|
|
bool enablePeerTraffic(const QJsonObject &configStr);
|
|
|
|
|
bool enableKillSwitch(const QJsonObject &configStr, int vpnAdapterIndex);
|
|
|
|
|
bool resetAllowedRange(const QStringList &ranges);
|
|
|
|
|
bool addAllowedRange(const QStringList &ranges);
|
|
|
|
|
bool isStrictKillSwitchEnabled();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
KillSwitch(QObject* parent) {};
|
|
|
|
|
QStringList m_allowedRanges;
|
|
|
|
|
QSharedPointer<SecureQSettings> m_appSettigns;
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // KILLSWITCH_H
|