feat: tproxy lan gateway, killswitch; fix: zapret2 fixes, various other

This commit is contained in:
FUFSoB committed 2026-09-23 01:12:31 +05:00
1 parent 4bcc168b2a
commit ae8f65da2e
54 files changed
+1880 -143

No files matched your search

@@ -8,9 +8,11 @@ let
ip
nft
nftablesRulesFile
killSwitchRulesFile
constants
globalTun
globalTproxy
tproxyLanSysctl
perAppRoutingTun
proxyCfg
;
@@ -62,8 +64,24 @@ let
family = "inet";
table = xrayTunReplyTable;
};
deleteKillSwitchTable = builders.mkNftDeleteTable {
inherit nft;
family = "inet";
table = "proxy_suite_killswitch";
};
in
{
killSwitchUpScript = pkgs.writeShellScript "proxy-suite-routing" ''
set -euo pipefail
${deleteKillSwitchTable}
${nft} -f ${killSwitchRulesFile}
'';
killSwitchDownScript = pkgs.writeShellScript "proxy-suite-routing" ''
set +e
${deleteKillSwitchTable}
'';
xrayTunUpScript = pkgs.writeShellScript "proxy-suite-routing" ''
set -euo pipefail
@@ -139,6 +157,12 @@ in
}}
${nft} -f ${nftablesRulesFile}
# Set on NixOS already; system-manager hosts only get them here.
${lib.concatStrings (
lib.mapAttrsToList (name: value: ''
${pkgs.procps}/bin/sysctl -q -w ${name}=${toString value}
'') tproxyLanSysctl
)}
${builders.mkTproxyRoutingUp {
inherit ip;
inherit ipv6;