mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-21 02:01:03 +07:00
f9b106cf5b
* fix: fixed country model update * fix: fixed context menu crush on ios * fix: fixed passphrase dialog freeze * fix: fixed country switch * fix: fixed start minimized * fix: fixed black screen after remove container * refactor: return cloak and ss only for view * fix: fixed default server change after improt while connected * fix: divider visibility * fix: fixed revoke admin user * fix: fixed language restore after backup * fix: link hover for tor settings page * fix: fixed openvpn connecntion status * fix: fixed free color status * fix: fixed client config update * chore: bump version
61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
#ifndef OPENVPNPROTOCOL_H
|
|
#define OPENVPNPROTOCOL_H
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QTimer>
|
|
|
|
#include "core/utils/managementServer.h"
|
|
#include "vpnProtocol.h"
|
|
|
|
#include "core/utils/ipcClient.h"
|
|
|
|
class OpenVpnProtocol : public VpnProtocol
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit OpenVpnProtocol(const QJsonObject& configuration, QObject* parent = nullptr);
|
|
virtual ~OpenVpnProtocol() override;
|
|
|
|
ErrorCode start() override;
|
|
void stop() override;
|
|
|
|
ErrorCode prepare() override;
|
|
static QString defaultConfigFileName();
|
|
static QString defaultConfigPath();
|
|
|
|
protected slots:
|
|
void onReadyReadDataFromManagementServer();
|
|
|
|
private:
|
|
void cleanupResources();
|
|
QString configPath() const;
|
|
bool openVpnProcessIsRunning() const;
|
|
bool sendTermSignal();
|
|
void readOpenVpnConfiguration(const QJsonObject &configuration);
|
|
void disconnectFromManagementServer();
|
|
void killOpenVpnProcess();
|
|
void sendByteCount();
|
|
void sendInitialData();
|
|
void sendManagementCommand(const QString& command);
|
|
|
|
const QString m_managementHost = "127.0.0.1";
|
|
const unsigned int m_managementPort = 57775;
|
|
|
|
ManagementServer m_managementServer;
|
|
QString m_configFileName;
|
|
QJsonObject m_configData;
|
|
QTemporaryFile m_configFile;
|
|
|
|
uint selectMgmtPort();
|
|
|
|
private:
|
|
void updateRouteGateway(QString line);
|
|
void updateVpnGateway(const QString &line);
|
|
|
|
QSharedPointer<IpcProcessInterfaceReplica> m_openVpnProcess;
|
|
};
|
|
|
|
#endif // OPENVPNPROTOCOL_H
|