windows: what is not on Windows yet is said, for as long as it holds

The configuration accepted the kill switch, AmneziaWG, WARP, Tor, the SSH
tunnel, whitelist-bypass, serving inbounds, autoProxy, the xray backend,
zapret's hostlistRules, z2k and zapret2's extended detection, and the
service silently did nothing with them: a kill switch turned on looked
like protection that was not there. The validator now warns for each, and
for TUN with zapret together; the status carries the configuration's
warnings as well as the rendering's, so the app's overview and
proxy-ctl status show them until they no longer hold.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 5.5 committed 2026-10-27 07:08:14 +03:00
1 parent c0b089dea8
commit 88c8b88a49
2 files changed
+63 -3

No files matched your search

+6 -2
View File
@@ -6,7 +6,7 @@ use std::sync::Arc;
use std::time::{Duration, SystemTime};
use anyhow::{Context, Result};
use ps_core::config::{Backend, Config, RuleSetFormat};
use ps_core::config::{Backend, Config, RuleSetFormat, Severity, validate};
use ps_core::render::{self, Env, Input, Rendered};
use serde_json::{Value, json};
use sha2::{Digest, Sha256};
@@ -297,6 +297,10 @@ impl Service {
pub fn status(&self) -> Value {
let cfg = self.cfg();
// The rendering's warnings, and the configuration's own (what is not on Windows yet
// among them): said for as long as they hold, not only when it is saved.
let mut warnings: Vec<String> = self.last.as_ref().map(|r| r.warnings.clone()).unwrap_or_default();
warnings.extend(validate(cfg).into_iter().filter(|i| i.severity == Severity::Warning).map(|i| format!("{}: {}", i.path, i.message)));
let units: Vec<Value> = self.sup.status().into_iter().map(|u| serde_json::to_value(u).unwrap()).collect();
let socks = self.sup.state_of(SOCKS_UNIT);
json!({
@@ -323,7 +327,7 @@ impl Service {
"state": self.sup.state_of(crate::tg::UNIT).as_str(),
"listener": format!("{}:{}", cfg.tg_ws_proxy.listener.address, cfg.tg_ws_proxy.listener.port),
},
"warnings": self.last.as_ref().map(|r| r.warnings.clone()).unwrap_or_default(),
"warnings": warnings,
"error": self.last_error,
"revision": self.store.revision,
})