feat: integrated xray as a library

This commit is contained in:
Yaroslav Gurov
2025-07-31 13:13:42 +02:00
parent 1909d3c94e
commit 20989ea832
3 changed files with 69 additions and 71 deletions
+12 -5
View File
@@ -3,9 +3,10 @@
#include "QProcess"
#include "containers/containers_defs.h"
#include "openvpnprotocol.h"
#include "protocols/vpnprotocol.h"
#include "rep_ipc_process_tun2socks_replica.h"
#include "settings.h"
#include <cstdint>
class XrayProtocol : public VpnProtocol
{
@@ -24,10 +25,16 @@ protected:
QJsonObject m_xrayConfig;
private:
static QString xrayExecPath();
static QString tun2SocksExecPath();
static void ctxSockCallback(uintptr_t fd, void* ctx) {
reinterpret_cast<XrayProtocol*>(ctx)->sockCallback(fd);
}
static void ctxLogHandler(char* str, void* ctx) {
reinterpret_cast<XrayProtocol*>(ctx)->logHandler(str);
}
void sockCallback(uintptr_t fd);
void logHandler(char* str);
private:
int m_localPort;
QString m_remoteHost;
QString m_remoteAddress;