per-app zapret

This commit is contained in:
FUFSoB committed 2026-04-14 22:50:27 +05:00
1 parent c3f4088458
commit 435c908663
6 files changed
+638 -59

No files matched your search

+17 -1
View File
@@ -9,6 +9,7 @@ let
sb = cfg.singBox;
art = cfg.appRouting.backends.tun;
artp = cfg.appRouting.backends.tproxy;
arz = cfg.appRouting.backends.zapret;
mkLocalSubnetLines = subnets: lib.concatMapStrings (cidr: ''
ip daddr ${cidr} tcp dport != 53 return
@@ -88,10 +89,25 @@ ${lib.optionalString art.enable " meta mark ${toString art.fwmark}
}
'';
appZapretRulesFile = pkgs.writeText "proxy-suite-app-zapret.nft" ''
table inet proxy_suite_app_zapret_mark {
chain prerouting {
type filter hook prerouting priority -103; policy accept;
ct mark and ${toString arz.filterMark} == ${toString arz.filterMark} meta mark set meta mark or ${toString arz.filterMark}
}
chain output {
type route hook output priority -103; policy accept;
ct mark and ${toString arz.filterMark} == ${toString arz.filterMark} meta mark set meta mark or ${toString arz.filterMark}
meta mark and ${toString arz.filterMark} == ${toString arz.filterMark} return
}
}
'';
ip = "${pkgs.iproute2}/bin/ip";
nft = "${pkgs.nftables}/bin/nft";
in
{
inherit nftablesRulesFile appTproxyRulesFile ip nft;
inherit nftablesRulesFile appTproxyRulesFile appZapretRulesFile ip nft;
}