mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-05-08 14:33:23 +00:00
* fix: outbound freedom for xray on linux * fix: outbound freedom for xray on macOS * build: auto-generate pf rules based on the build type
42 lines
747 B
C++
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
|