2025-08-08 06:44:18 +04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QScopedPointer>
|
|
|
|
|
#include <QSharedPointer>
|
2025-12-31 21:16:45 +04:00
|
|
|
#include <memory>
|
|
|
|
|
|
2025-08-08 06:44:18 +04:00
|
|
|
#include "httpapi.h"
|
2025-12-31 21:16:45 +04:00
|
|
|
#include "proxyservice.h"
|
|
|
|
|
|
|
|
|
|
class Settings;
|
2025-08-08 06:44:18 +04:00
|
|
|
|
|
|
|
|
class ProxyServer : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2025-12-31 21:16:45 +04:00
|
|
|
explicit ProxyServer(const std::shared_ptr<Settings> &settings, QObject *parent = nullptr);
|
2025-08-08 06:44:18 +04:00
|
|
|
~ProxyServer();
|
|
|
|
|
|
2026-01-27 11:09:27 +04:00
|
|
|
bool start(quint16 port = 49490);
|
2025-08-08 06:44:18 +04:00
|
|
|
void stop();
|
2026-01-27 11:09:27 +04:00
|
|
|
void syncSettings();
|
2025-08-08 06:44:18 +04:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool startXrayProcess();
|
|
|
|
|
void stopXrayProcess();
|
|
|
|
|
|
2026-01-27 11:09:27 +04:00
|
|
|
std::shared_ptr<Settings> m_settings;
|
2025-08-08 06:44:18 +04:00
|
|
|
QScopedPointer<HttpApi> m_api;
|
|
|
|
|
QSharedPointer<ProxyService> m_service;
|
2025-12-31 18:48:57 +04:00
|
|
|
bool m_isRunning {false};
|
2026-01-27 11:09:27 +04:00
|
|
|
quint16 m_currentApiPort {0};
|
|
|
|
|
quint16 m_currentProxyPort {0};
|
2025-08-08 06:44:18 +04:00
|
|
|
};
|