The zapret2-extras component (tools/build-zapret2-extras.sh): z2k at upstream's pinned commit, its strategies made by its own generator as upstream's z2k-profiles.template.sh runs it, with tokens where upstream fills in the configuration at build time; its Lua, lists and fakes; and upstream's own Lua: the extended detector (detect.lua), the per-site key by public suffix, the fail stamp, every-change persistence and the strategy log. winws2 now runs, as upstream's nfqws2 does, with z2k's Lua for its strategies, then the layers: each site's working strategy kept across restarts (z2k's state layer), strategies keyed by site, and with autoHostlist.extendedDetection the detector learning in place of nfqws2's own (its last TLS profile, the stall watch where the learned sites are). Lua arguments name paths as Cygwin does (no colon); what winws2 writes stays under the Low-integrity folder. The server's TLS handshake and alert records reach the detectors through a WinDivert filter part: WinDivert has no per-flow packet window to hand them over by. Options go to winws2 in a file (@file): z2k's alone are 55 KB, past a Windows command line. Both sources, with every layer, verified by winws2's --dry-run under Wine (tools/winws-dry-run.sh). The DPI page picks the strategies and switches the detection. proxyFallback and the cutoff probe are said to be not on Windows yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
49 lines
2.1 KiB
Rust
49 lines
2.1 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,
|
|
};
|
|
for arg in args(&z, &source, &paths, false).unwrap() {
|
|
println!("{arg}");
|
|
}
|
|
}
|