mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-08 14:33:23 +00:00
* Add network status check for AWG/WG protocol * Use service for PingSender * Cleanup unused code * Use networkchecker for all protocols * fix android build * add delay for ping checker stop * handle for interafe problems on windows * Restart IpcClient after OS suspend * Add DBus network checker for Linux * Use ping check for tun interfce * Windows suspend mode handler * MacOS suspend mode handler draft * Add delay for Linux wakeup reconnect * Add delay for Linux wakeup reconnect * Fix macOS wakeup/sleep prob Fix macOS not receiving wakeup/sleep events * fix done * Update deploy.yml fix CICD * Update vpnconnection.cpp update fix build CICD * Update vpnconnection.cpp update fix build cicd macos * Update deploy.yml fix CICD build macos * Update deploy.yml fix CICD macos * feat: implement SCP write buffer, improve network check and refactor macOS OpenGL support * feat: add tunnel addresses updated signal and handle network check based on gateway and local address availability * refactor: improve IpcClient connection handling and instance management * fix: scp revert. * fix: cmake reverted. * fix: submodules updated --------- Co-authored-by: Mykola Baibuz <mykola.baibuz@gmail.com> Co-authored-by: Yaroslav Yashin <yaroslav.yashin@gmail.com> Co-authored-by: vkamn <vk@amnezia.org>
60 lines
1.5 KiB
C++
60 lines
1.5 KiB
C++
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef NETWORKWATCHER_H
|
|
#define NETWORKWATCHER_H
|
|
|
|
#include <QElapsedTimer>
|
|
#include <QMap>
|
|
#include <QNetworkInformation>
|
|
|
|
|
|
class NetworkWatcherImpl;
|
|
|
|
// This class watches for network changes to detect unsecured wifi.
|
|
class NetworkWatcher final : public QObject {
|
|
Q_OBJECT
|
|
Q_DISABLE_COPY_MOVE(NetworkWatcher)
|
|
|
|
public:
|
|
NetworkWatcher();
|
|
~NetworkWatcher();
|
|
|
|
void initialize();
|
|
|
|
// Public for the Inspector.
|
|
void unsecuredNetwork(const QString& networkName, const QString& networkId);
|
|
// Used for the Inspector. simulateOffline = true to mock being disconnected,
|
|
// false to restore.
|
|
void simulateDisconnection(bool simulatedDisconnection);
|
|
|
|
void onSleepMode();
|
|
|
|
QNetworkInformation::Reachability getReachability();
|
|
|
|
signals:
|
|
void networkChange();
|
|
void sleepMode();
|
|
|
|
private:
|
|
void settingsChanged();
|
|
|
|
private:
|
|
bool m_active = false;
|
|
bool m_reportUnsecuredNetwork = false;
|
|
|
|
// Platform-specific implementation.
|
|
NetworkWatcherImpl* m_impl = nullptr;
|
|
|
|
QMap<QString, QElapsedTimer> m_networks;
|
|
|
|
// This is used to connect NotificationHandler lazily.
|
|
bool m_firstNotification = true;
|
|
|
|
// Used to simulate network disconnection in the Inspector
|
|
bool m_simulatedDisconnection = false;
|
|
};
|
|
|
|
#endif // NETWORKWATCHER_H
|