
* Crash fix in management server * Openvpn scripts fixes some refactoring * deploy fix * Scripts fix for macos * OpenVpn runtime error codes handling * MacOS deploy script fix * easyrsa scripts for MacOS * Refactoring Ui improvements Bug fixes * new server page fix * Fix some warnings, fix installation scripts (macOS) * Fix crash on fatal error, remove moc files from Windows installation * ss files * Fix issue with easyrsa * ss files * shadowsocks impl * ss fix * ui fix * Macos doc icon * travis scripts * server scripts fix * icon changed * Server scripts fix * travis fix * Bug fixes: - auto install tap - share connectionState - service crash fix * travis release * macos deploy
50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
#ifndef VPNCONNECTION_H
|
|
#define VPNCONNECTION_H
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QScopedPointer>
|
|
|
|
#include "protocols/vpnprotocol.h"
|
|
#include "core/defs.h"
|
|
#include "settings.h"
|
|
|
|
using namespace amnezia;
|
|
|
|
class VpnConnection : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit VpnConnection(QObject* parent = nullptr);
|
|
~VpnConnection() override = default;
|
|
|
|
static QString bytesPerSecToText(quint64 bytes);
|
|
|
|
ErrorCode lastError() const;
|
|
ErrorCode requestVpnConfig(const ServerCredentials &credentials, Protocol protocol);
|
|
ErrorCode connectToVpn(const ServerCredentials &credentials, Protocol protocol = Protocol::Any);
|
|
bool onConnected() const;
|
|
bool onDisconnected() const;
|
|
void disconnectFromVpn();
|
|
|
|
VpnProtocol::ConnectionState connectionState();
|
|
|
|
signals:
|
|
void bytesChanged(quint64 receivedBytes, quint64 sentBytes);
|
|
void connectionStateChanged(VpnProtocol::ConnectionState state);
|
|
void vpnProtocolError(amnezia::ErrorCode error);
|
|
|
|
protected slots:
|
|
void onBytesChanged(quint64 receivedBytes, quint64 sentBytes);
|
|
void onConnectionStateChanged(VpnProtocol::ConnectionState state);
|
|
|
|
protected:
|
|
|
|
QScopedPointer<VpnProtocol> m_vpnProtocol;
|
|
|
|
private:
|
|
Settings m_settings;
|
|
};
|
|
|
|
#endif // VPNCONNECTION_H
|