windows: zapret2's verdicts route the proxy; options kept to what they are
As upstream's direct-sync: from zapret2's lists and the detector's verdicts, two rule-sets sing-box reloads, rebuilt every ten seconds and before it starts: what zapret2 cannot fix (every strategy failed for a site, or an address leaves connections unanswered) through the proxy (zapret2.proxyFallback), after the explicit rules and autoProxy's; what it fixes direct, so it sees it (directSync), unless learned from transfers cut short. all-bypass and all-proxy as upstream. The options file winws2 reads (one a line) refuses an option holding a control character, which would read as more options than it is; and zapret2.ports.extraTcp/extraUdp, which join its options as written, are ports or ranges within 1-65535 (validated, and filtered again). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9eed225ccc
commit
514ffb97ca
10 files changed
+305
-27
No files matched your search
@@ -105,6 +105,10 @@ pub struct Env {
|
||||
pub windows: bool,
|
||||
/// Where autoProxy's learned rule-sets are (one file per exit), when it runs.
|
||||
pub autoproxy_rules_dir: Option<String>,
|
||||
/// zapret2's rule-sets (ps_core::zapret2::routing): what it fixes, sent direct
|
||||
/// (`zapret.directSync`), and what it cannot, for the proxy (`zapret2.proxyFallback`).
|
||||
pub zapret2_direct_rule_set: Option<String>,
|
||||
pub zapret2_proxy_rule_set: Option<String>,
|
||||
}
|
||||
|
||||
pub struct Input<'a> {
|
||||
|
||||
@@ -146,6 +146,21 @@ pub(super) fn config(input: &Input, asm: &Assembly, probe_exits: &[ProbeExit], w
|
||||
let mut rule_sets = route.rule_set;
|
||||
let mut dns_rules = route.dns_rules;
|
||||
autoproxy::apply(input, probe_exits, &mut inbounds, &mut rules, route.pin_at, &mut rule_sets, &mut dns_rules, route.mode);
|
||||
// zapret2's: what it cannot fix through the proxy, after the explicit rules and autoProxy's,
|
||||
// ahead of the hosts it does fix, which go direct so it sees them. all-bypass sends
|
||||
// everything direct, and all-proxy keeps no direct lists.
|
||||
if let Some(path) = &env.zapret2_proxy_rule_set
|
||||
&& route.mode != super::RouteMode::AllBypass
|
||||
{
|
||||
rule_sets.push(json!({ "type": "local", "format": "source", "tag": "zapret-unfixable", "path": path }));
|
||||
rules.push(json!({ "rule_set": ["zapret-unfixable"], "outbound": "proxy" }));
|
||||
}
|
||||
if let Some(path) = &env.zapret2_direct_rule_set
|
||||
&& !matches!(route.mode, super::RouteMode::AllBypass | super::RouteMode::AllProxy)
|
||||
{
|
||||
rule_sets.push(json!({ "type": "local", "format": "source", "tag": "zapret-hosts", "path": path }));
|
||||
rules.push(json!({ "rule_set": ["zapret-hosts"], "outbound": "direct" }));
|
||||
}
|
||||
let after_sniff = rules.iter().position(|r| r["action"] == "sniff").map_or(0, |i| i + 1);
|
||||
rules.insert(after_sniff, json!({ "inbound": ["proxy-suite-test-in"], "outbound": "proxy-suite-test" }));
|
||||
if hybrid {
|
||||
|
||||
Reference in new issue
Block a user