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>
70 lines
1.5 KiB
C++
70 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 LOCALSOCKETCONTROLLER_H
|
|
#define LOCALSOCKETCONTROLLER_H
|
|
|
|
#include <QHostAddress>
|
|
#include <QLocalSocket>
|
|
#include <QTimer>
|
|
#include <functional>
|
|
|
|
#include "controllerimpl.h"
|
|
|
|
|
|
class QJsonObject;
|
|
|
|
class LocalSocketController final : public ControllerImpl {
|
|
Q_DISABLE_COPY_MOVE(LocalSocketController)
|
|
|
|
public:
|
|
LocalSocketController();
|
|
~LocalSocketController();
|
|
|
|
void initialize(const Device* device, const Keys* keys) override;
|
|
|
|
void activate(const QJsonObject& rawConfig) override;
|
|
|
|
void deactivate() override;
|
|
|
|
void checkStatus() override;
|
|
|
|
void getBackendLogs(std::function<void(const QString&)>&& callback) override;
|
|
|
|
void cleanupBackendLogs() override;
|
|
|
|
bool multihopSupported() override { return true; }
|
|
|
|
private:
|
|
void initializeInternal();
|
|
void disconnectInternal();
|
|
|
|
void daemonConnected();
|
|
void errorOccurred(QLocalSocket::LocalSocketError socketError);
|
|
void readData();
|
|
void parseCommand(const QByteArray& command);
|
|
|
|
void write(const QJsonObject& json);
|
|
|
|
private:
|
|
enum {
|
|
eUnknown,
|
|
eInitializing,
|
|
eReady,
|
|
eDisconnected,
|
|
} m_daemonState = eUnknown;
|
|
|
|
QLocalSocket* m_socket = nullptr;
|
|
|
|
QByteArray m_buffer;
|
|
|
|
QString m_deviceIpv4;
|
|
std::function<void(const QString&)> m_logCallback = nullptr;
|
|
|
|
QTimer m_initializingTimer;
|
|
uint32_t m_initializingRetry = 0;
|
|
};
|
|
|
|
#endif // LOCALSOCKETCONTROLLER_H
|