XRay alone (proxy.backend = "xray"), as upstream's xray.nix and its start-time filter make it: the mixed-in listener with its login, DNS remote and local ordered by the route mode with the servers' names on local, IPIfNonMatch routing in upstream's order and modes, zapret's direct lists; urltest as prefixed tags under a leastPing balancer and observatory, a pin or first as one exit; chains by dialerProxy; Tor, SSH, WARP, AmneziaWG and whitelist-bypass as SOCKS hops. What needs sing-box is refused for it, as upstream asserts (TUN, groups, rule sets, autoProxy, selector/failover, DoT, dns.strategy and the like). The service checks it with xray run -test and runs it with its component's geodata (XRAY_LOCATION_ASSET); latency tests and autoProxy stand aside. zapret beside the TUN: winws2 gets the TUN's addresses left out in its --wf-raw-filter (with the cutoff probe's ports); Flowseal's winws, which takes no ANDed part, gets its own filter as it saves it (--wf-save) with them left out, through --wf-raw. WinDivert negates single tests only: the part is spelled positively, and compiled by WinDivert's own parser. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
2.3 KiB
Rust
51 lines
2.3 KiB
Rust
//! For tools/winws-dry-run.sh: winws2's arguments as the service builds them, one per line.
|
|
//! `zapret2_args <component dir> <component dir as Windows sees it> <state dir as Windows sees it>
|
|
//! [<extras dir> <extras dir as Windows sees it> <extras dir as Cygwin sees it> keenetic|z2k]`
|
|
|
|
use ps_core::config::{StrategySource, Zapret2};
|
|
use ps_core::zapret2::{Extras, Paths, args, keenetic, z2k};
|
|
|
|
fn main() {
|
|
let a: Vec<String> = std::env::args().collect();
|
|
let conf = std::fs::read_to_string(std::path::Path::new(&a[1]).join("keenetic").join("nfqws2.conf")).unwrap();
|
|
let (comp, state) = (&a[2], &a[3]);
|
|
let mut z = Zapret2 { domains: vec!["rutracker.org".into()], ..Default::default() };
|
|
let mut source = keenetic(&conf, &format!("{comp}keenetic\\")).unwrap();
|
|
let mut extras = None;
|
|
if let [_, _, _, _, dir, win, cyg, kind] = &a[..] {
|
|
let read = |f: &str| std::fs::read_to_string(std::path::Path::new(dir).join("z2k").join(f)).unwrap();
|
|
if kind == "z2k" {
|
|
z.strategy_source = StrategySource::Z2k;
|
|
source = z2k(
|
|
&read("profiles.plain"),
|
|
&read("profiles.learn"),
|
|
&read("blobs"),
|
|
&read("ports"),
|
|
&format!("{cyg}z2k"),
|
|
&format!("{cyg}z2k/root"),
|
|
&format!("{cyg}z2k/files/lua/"),
|
|
)
|
|
.unwrap();
|
|
}
|
|
let state_cyg = format!("/cygdrive/{}", state.replace(':', "").replace('\\', "/").to_lowercase());
|
|
extras = Some(Extras {
|
|
lua: format!("{win}lua\\"),
|
|
z2k_lua: format!("{win}z2k\\files\\lua\\"),
|
|
auto_lua: format!("{state_cyg}learned/zapret-hosts-auto.txt"),
|
|
exclude_lua: vec![format!("{state_cyg}zapret-hosts-user-exclude.txt")],
|
|
});
|
|
}
|
|
let paths = Paths {
|
|
lua: format!("{comp}lua\\"),
|
|
user: format!("{state}zapret-hosts-user.txt"),
|
|
exclude: format!("{state}zapret-hosts-user-exclude.txt"),
|
|
auto: format!("{state}learned\\zapret-hosts-auto.txt"),
|
|
extras,
|
|
// Beside sing-box's TUN, as its defaults are: checked by winws2 with the rest.
|
|
keep_off: ps_core::zapret::tun_exclusion("172.19.0.1/30", Some("fd66:19::1/64")),
|
|
};
|
|
for arg in args(&z, &source, &paths, false).unwrap() {
|
|
println!("{arg}");
|
|
}
|
|
}
|