Files
cd-amn c0cae0ff01 fix: outbound freedom for xray (#2479)
* fix: outbound freedom for xray on linux

* fix: outbound freedom for xray on macOS

* build: auto-generate pf rules based on the build type
2026-05-04 19:39:07 +08:00

42 lines
747 B
C++

#ifndef XRAY_H
#define XRAY_H
#include <QString>
class Xray
{
public:
static Xray& getInstance()
{
static Xray instance;
return instance;
}
bool startXray(const QString& cfg);
bool stopXray();
private:
static void ctxSockCallback(uintptr_t fd, void* ctx) {
reinterpret_cast<Xray*>(ctx)->sockCallback(fd);
}
static void ctxLogHandler(char* str, void* ctx) {
reinterpret_cast<Xray*>(ctx)->logHandler(str);
}
void sockCallback(uintptr_t fd);
void logHandler(char* str);
#ifdef Q_OS_LINUX
QByteArray m_defaultIfaceName;
#else
int m_defaultIfaceIdx;
#endif
#ifdef Q_OS_MAC
QString m_uplinkIfaceName;
QString m_uplinkGateway;
#endif
};
#endif // XRAY_H