feat: z2k 16kb probe
This commit is contained in:
18 files changed
+436
-5
No files matched your search
@@ -37,6 +37,8 @@ let
|
||||
perAppRoutingTproxy
|
||||
perAppZapretCfg
|
||||
zapretEngine
|
||||
zapretCutoffEnabled
|
||||
zapretCutoffProxyFallback
|
||||
userControlCfg
|
||||
selectionMode
|
||||
builtinTags
|
||||
@@ -98,6 +100,7 @@ let
|
||||
selectionMode
|
||||
collapseNamedOutbounds
|
||||
constants
|
||||
zapretCutoffProxyFallback
|
||||
;
|
||||
inherit
|
||||
jq
|
||||
@@ -163,6 +166,7 @@ let
|
||||
perAppRoutingTproxy
|
||||
perAppZapretCfg
|
||||
zapretEngine
|
||||
zapretCutoffEnabled
|
||||
constants
|
||||
selectionMode
|
||||
userControlCfg
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
perAppRoutingTproxy,
|
||||
perAppZapretCfg,
|
||||
zapretEngine,
|
||||
zapretCutoffEnabled,
|
||||
constants,
|
||||
selectionMode,
|
||||
userControlCfg,
|
||||
@@ -44,6 +45,7 @@
|
||||
perAppRoutingZapretEnabled = if perAppZapretCfg.enable then "1" else "0";
|
||||
zapretAutoEnabled = if zapretEngine == "zapret2" then "1" else "0";
|
||||
zapretStateDir = constants.zapret2StateDir;
|
||||
zapretCutoffEnabled = if zapretCutoffEnabled then "1" else "0";
|
||||
priorityOutboundFile = constants.priorityOutboundFile;
|
||||
outboundInventoryFile = constants.outboundInventoryFile;
|
||||
runtimeOutboundsDir = constants.runtimeOutboundsDir;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
selectionMode,
|
||||
collapseNamedOutbounds,
|
||||
constants,
|
||||
zapretCutoffProxyFallback,
|
||||
jq,
|
||||
python3,
|
||||
singBox,
|
||||
@@ -159,6 +160,7 @@ let
|
||||
hybridEnabled
|
||||
pureXrayEnabled
|
||||
constants
|
||||
zapretCutoffProxyFallback
|
||||
jq
|
||||
singBox
|
||||
xray
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
hybridEnabled,
|
||||
pureXrayEnabled,
|
||||
constants,
|
||||
zapretCutoffProxyFallback,
|
||||
jq,
|
||||
singBox,
|
||||
xray,
|
||||
@@ -143,6 +144,7 @@ let
|
||||
xraySidecarBasePort ? xraySidecarBasePorts.socks,
|
||||
xrayDnsBridgePort ? xrayDnsBridgePorts.socks,
|
||||
enableAutoProxy ? false,
|
||||
enableZapretCutoff ? false,
|
||||
}:
|
||||
pkgs.writeShellScript name ''
|
||||
set -euo pipefail
|
||||
@@ -234,6 +236,20 @@ let
|
||||
fi
|
||||
''}
|
||||
|
||||
${lib.optionalString enableZapretCutoff ''
|
||||
# zapret2's cutoff probe lists the prefixes of cut-off networks no whitelisted
|
||||
# name gets through; the proxy carries those. sing-box refuses a missing
|
||||
# rule-set path and reloads the file when the probe renames a new one in.
|
||||
if [ "$ROUTE_MODE" != all-bypass ]; then
|
||||
CUTOFF_RULE_SET=${lib.escapeShellArg "${constants.zapret2CutoffDir}/proxy.json"}
|
||||
install -d -m 0755 "$(dirname "$CUTOFF_RULE_SET")"
|
||||
[ -s "$CUTOFF_RULE_SET" ] || echo '{"version":1,"rules":[]}' > "$CUTOFF_RULE_SET"
|
||||
AUTOPROXY_RULE_SETS_JSON=$(${jq} -c --arg p "$CUTOFF_RULE_SET" \
|
||||
'. + [{type: "local", format: "source", tag: "zapret-cutoff", path: $p}]' <<< "$AUTOPROXY_RULE_SETS_JSON")
|
||||
AUTOPROXY_RULES_JSON=$(${jq} -c '. + [{rule_set: ["zapret-cutoff"], outbound: "proxy"}]' <<< "$AUTOPROXY_RULES_JSON")
|
||||
fi
|
||||
''}
|
||||
|
||||
${jq} \
|
||||
--argjson obs "$OUTBOUNDS_JSON" \
|
||||
--argjson probe_inbounds "$PROBE_INBOUNDS_JSON" \
|
||||
@@ -309,6 +325,7 @@ let
|
||||
xrayDnsBridgePort = xrayDnsBridgePorts.socks;
|
||||
# Only the socks unit: relayed traffic reaches it, and the prober needs one home.
|
||||
enableAutoProxy = proxyCfg.autoProxy.enable && !pureXrayEnabled;
|
||||
enableZapretCutoff = zapretCutoffProxyFallback && !pureXrayEnabled;
|
||||
};
|
||||
|
||||
startTun = mkStartScript {
|
||||
|
||||
Reference in new issue
Block a user