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
This commit is contained in:
cd-amn
2026-05-04 15:39:07 +04:00
committed by GitHub
parent c28452a5da
commit c0cae0ff01
15 changed files with 221 additions and 7 deletions

View File

@@ -32,6 +32,7 @@
#include "linuxfirewall.h"
#include "logger.h"
#include "xray_defs.h"
#include <QProcess>
#define BRAND_CODE "amn"
@@ -282,6 +283,10 @@ void LinuxFirewall::install()
QStringLiteral("-o tun2+ -j ACCEPT"),
});
installAnchor(Both, QStringLiteral("130.allowMarkedXray"), {
QStringLiteral("-m mark --mark %1 -j ACCEPT").arg(amnezia::xray::xrayTrafficMark),
});
installAnchor(IPv4, QStringLiteral("120.blockNets"), {});
installAnchor(IPv4, QStringLiteral("110.allowNets"), {});
@@ -358,6 +363,7 @@ void LinuxFirewall::uninstall()
uninstallAnchor(IPv6, QStringLiteral("250.blockIPv6"));
uninstallAnchor(Both, QStringLiteral("200.allowVPN"));
uninstallAnchor(IPv4, QStringLiteral("120.blockNets"));
uninstallAnchor(Both, QStringLiteral("130.allowMarkedXray"));
uninstallAnchor(IPv4, QStringLiteral("110.allowNets"));
uninstallAnchor(Both, QStringLiteral("100.blockAll"));