mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-08 14:33:23 +00:00
* fix: app freeze on quit
* fix: typo in VpnConnection destructor
* add trace info
* add more trace info
* set timelimit for flushDns
* Refactor IpcClient::Interface access logic
* cleanup unused variable
* cleanup trace info
* fix: remove second disconnect from VPN on app close
* this object will be deleted at app close
* Don't terminate VPN thread on Linux
* Revert "Don't terminate VPN thread on Linux"
This reverts commit 20e4ea2d4a.
* disconnect all signals from vpnconnection on exit
* add interruption request on vpnConnectionThread
* use checktimer only for iOS
* disconnect all signals from vpnconnection on exit
* disconnect signals on exit before VPN disconnect
* add disconnectSlots method
* fix: add allow traffic rules on killswitch disable
* wait for response from service before object destroy
* change disconnect from vpn order
* add delay for connection close
* change disconnect method order
* use stop method for protocol disconnecect
* change disconnect method order
* allow dns traffic after app close
* delete tun on disconnect
---------
Co-authored-by: vkamn <vk@amnezia.org>
68 lines
2.6 KiB
C++
68 lines
2.6 KiB
C++
#ifndef IPCSERVER_H
|
|
#define IPCSERVER_H
|
|
|
|
#include <QLocalServer>
|
|
#include <QObject>
|
|
#include <QRemoteObjectNode>
|
|
#include <QJsonObject>
|
|
#include "../client/daemon/interfaceconfig.h"
|
|
|
|
#include "ipc.h"
|
|
#include "ipcserverprocess.h"
|
|
#include "ipctun2socksprocess.h"
|
|
|
|
#include "rep_ipc_interface_source.h"
|
|
#include "rep_ipc_process_tun2socks_source.h"
|
|
|
|
class IpcServer : public IpcInterfaceSource
|
|
{
|
|
public:
|
|
explicit IpcServer(QObject *parent = nullptr);
|
|
virtual int createPrivilegedProcess() override;
|
|
|
|
virtual int routeAddList(const QString &gw, const QStringList &ips) override;
|
|
virtual bool clearSavedRoutes() override;
|
|
virtual bool routeDeleteList(const QString &gw, const QStringList &ips) override;
|
|
virtual bool flushDns() override;
|
|
virtual void resetIpStack() override;
|
|
virtual bool checkAndInstallDriver() override;
|
|
virtual QStringList getTapList() override;
|
|
virtual void cleanUp() override;
|
|
virtual void clearLogs() override;
|
|
virtual void setLogsEnabled(bool enabled) override;
|
|
virtual bool createTun(const QString &dev, const QString &subnet) override;
|
|
virtual bool deleteTun(const QString &dev) override;
|
|
virtual bool StartRoutingIpv6() override;
|
|
virtual bool StopRoutingIpv6() override;
|
|
virtual bool disableAllTraffic() override;
|
|
virtual bool addKillSwitchAllowedRange(QStringList ranges) override;
|
|
virtual bool resetKillSwitchAllowedRange(QStringList ranges) override;
|
|
virtual bool enablePeerTraffic(const QJsonObject &configStr) override;
|
|
virtual bool enableKillSwitch(const QJsonObject &excludeAddr, int vpnAdapterIndex) override;
|
|
virtual bool disableKillSwitch() override;
|
|
virtual bool refreshKillSwitch( bool enabled ) override;
|
|
virtual bool updateResolvers(const QString& ifname, const QList<QHostAddress>& resolvers) override;
|
|
virtual bool restoreResolvers() override;
|
|
|
|
private:
|
|
int m_localpid = 0;
|
|
|
|
struct ProcessDescriptor {
|
|
ProcessDescriptor (QObject *parent = nullptr) {
|
|
serverNode = QSharedPointer<QRemoteObjectHost>(new QRemoteObjectHost(parent));
|
|
ipcProcess = QSharedPointer<IpcServerProcess>(new IpcServerProcess(parent));
|
|
tun2socksProcess = QSharedPointer<IpcProcessTun2Socks>(new IpcProcessTun2Socks(parent));
|
|
localServer = QSharedPointer<QLocalServer>(new QLocalServer(parent));
|
|
}
|
|
|
|
QSharedPointer<IpcServerProcess> ipcProcess;
|
|
QSharedPointer<IpcProcessTun2Socks> tun2socksProcess;
|
|
QSharedPointer<QRemoteObjectHost> serverNode;
|
|
QSharedPointer<QLocalServer> localServer;
|
|
};
|
|
|
|
QMap<int, ProcessDescriptor> m_processes;
|
|
};
|
|
|
|
#endif // IPCSERVER_H
|