mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-22 02:01:08 +07:00
feat: drive WG via Tunnel coordinator for seamless server switch
This commit is contained in:
+25
-4
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <QMetaObject>
|
||||
#include <QSet>
|
||||
#include <QString>
|
||||
#include <QScopedPointer>
|
||||
#include <QRemoteObjectNode>
|
||||
@@ -16,6 +17,7 @@
|
||||
#include "core/repositories/secureAppSettingsRepository.h"
|
||||
|
||||
#include "core/vpnTrafficGuard.h"
|
||||
#include "core/tunnel.h"
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
#include "core/protocols/androidVpnProtocol.h"
|
||||
@@ -38,7 +40,7 @@ public:
|
||||
|
||||
QSharedPointer<VpnProtocol> vpnProtocol() const;
|
||||
|
||||
const QString &remoteAddress() const;
|
||||
const QString &remoteAddress() const { return m_remoteAddress; }
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
void restoreConnection();
|
||||
@@ -59,6 +61,7 @@ signals:
|
||||
void bytesChanged(quint64 receivedBytes, quint64 sentBytes);
|
||||
void connectionStateChanged(Vpn::ConnectionState state);
|
||||
void vpnProtocolError(amnezia::ErrorCode error);
|
||||
void serverSwitchFailed();
|
||||
|
||||
void serviceIsNotReady();
|
||||
|
||||
@@ -75,8 +78,12 @@ private:
|
||||
QScopedPointer<VpnTrafficGuard> m_trafficGuard;
|
||||
|
||||
QJsonObject m_vpnConfiguration;
|
||||
QJsonObject m_routeMode;
|
||||
QString m_remoteAddress;
|
||||
QJsonObject m_routeMode;
|
||||
|
||||
Tunnel* m_active = nullptr;
|
||||
Tunnel* m_staging = nullptr;
|
||||
QSet<QString> m_ifnamesInUse;
|
||||
|
||||
// Only for iOS for now, check counters
|
||||
QTimer m_checkTimer;
|
||||
@@ -91,9 +98,23 @@ private:
|
||||
Vpn::ConnectionState m_connectionState;
|
||||
|
||||
void createProtocolConnections();
|
||||
void wireTunnelSignals(Tunnel* tunnel, bool isActive);
|
||||
void wireDaemonReconnectSignals();
|
||||
|
||||
void appendSplitTunnelingConfig();
|
||||
void appendKillSwitchConfig();
|
||||
QString allocateIfname();
|
||||
void releaseIfname(const QString& ifname);
|
||||
|
||||
void appendSplitTunnelingConfig(QJsonObject &config);
|
||||
void appendKillSwitchConfig(QJsonObject &config);
|
||||
|
||||
void startTunnelSwitch(DockerContainer container,
|
||||
const QJsonObject &vpnConfiguration,
|
||||
const QString &resolvedRemote);
|
||||
|
||||
private slots:
|
||||
void onTunnelPrepared();
|
||||
void onTunnelActivated();
|
||||
void onTunnelFailed(amnezia::ErrorCode error);
|
||||
};
|
||||
|
||||
#endif // VPNCONNECTION_H
|
||||
|
||||
Reference in New Issue
Block a user