fix: zapret2 improvements
This commit is contained in:
24 files changed
+1350
-99
No files matched your search
@@ -1,6 +1,8 @@
|
||||
# directSync for the hosts zapret2 pins (`proxy-ctl zapret auto add`) and learns at
|
||||
# runtime: a rule-set the proxy sends direct, so zapret2 sees their traffic. Rebuilt
|
||||
# whenever a host list changes; sing-box reloads it on the rename.
|
||||
# The proxy's two rule-sets from zapret2's runtime state (direct-sync.template.sh):
|
||||
# direct.json, the hosts zapret2 pins (`proxy-ctl zapret auto add`) and learns and can
|
||||
# fix, sent direct so zapret2 sees their traffic (directSync); proxy.json, what it cannot
|
||||
# fix, for the proxy to carry (zapret2.proxyFallback). Rebuilt whenever a host list or a
|
||||
# verdict changes; sing-box reloads them on the rename.
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
@@ -11,7 +13,7 @@ let
|
||||
fillTemplate = import ../lib/fill-template.nix;
|
||||
inherit (import ../derived.nix { inherit lib cfg; }) constants;
|
||||
stateDir = constants.zapret2StateDir;
|
||||
ruleSet = "${constants.zapret2DirectDir}/direct.json";
|
||||
outDir = constants.zapret2DirectDir;
|
||||
|
||||
sync = pkgs.writeShellScript "proxy-suite-zapret2" (
|
||||
fillTemplate ./direct-sync.template.sh {
|
||||
@@ -24,17 +26,19 @@ let
|
||||
);
|
||||
in
|
||||
{
|
||||
inherit sync ruleSet;
|
||||
inherit sync;
|
||||
directRuleSet = "${outDir}/direct.json";
|
||||
proxyRuleSet = "${outDir}/proxy.json";
|
||||
|
||||
service = {
|
||||
description = "proxy-suite - send the hosts zapret2 pins and learns direct in the proxy";
|
||||
description = "proxy-suite - route by what zapret2 can and cannot fix";
|
||||
# Ahead of the proxy at boot, so it starts with the hosts already in.
|
||||
before = [ "proxy-suite-socks.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${sync} ${lib.escapeShellArg stateDir} ${lib.escapeShellArg ruleSet}";
|
||||
# Root's alone, like the cutoff's: what is in it skips the proxy, so the zapret
|
||||
ExecStart = "${sync} ${lib.escapeShellArg stateDir} ${lib.escapeShellArg outDir}";
|
||||
# Root's alone, like the cutoff's: it decides what skips the proxy, so the zapret
|
||||
# scope's group, which edits the host lists, only reaches it through them.
|
||||
StateDirectory = "proxy-suite/zapret2-direct";
|
||||
StateDirectoryMode = "0755";
|
||||
@@ -43,12 +47,13 @@ in
|
||||
};
|
||||
|
||||
path = {
|
||||
description = "proxy-suite - watch zapret2's host lists for directSync";
|
||||
description = "proxy-suite - watch zapret2's host lists and verdicts";
|
||||
wantedBy = [ "paths.target" ];
|
||||
pathConfig.PathChanged = map (name: "${stateDir}/${name}") [
|
||||
"zapret-hosts-user.txt"
|
||||
"zapret-hosts-auto.txt"
|
||||
"zapret-hosts-user-exclude.txt"
|
||||
"verdicts.tsv"
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user