windows: the kill switch

Upstream's killSwitch, on the Windows Filtering Platform: while the TUN or a
system-wide AmneziaWG profile is on, connections that would leave past it are
blocked at the ALE connect layers, while the tunnel runs, restarts or has
failed. Open: loopback, the private and reserved networks with
allowedSubnets, what leaves from the tunnels' own addresses, the tunnel's own
programs (the backend, its helpers, awg-tunnel; the service with
directFallbacks), NTP with allowTimeSync. Turning a tunnel off, or
proxy-ctl killswitch off / the Overview's Lift, lifts it until a tunnel is
turned on again.

The filters live in a dynamic WFP session of the service's: they go with
it, so stopping the service always gets the network back. Upstream holds
from boot; that needs persistent filters, for once these are seen to work
on real Windows (Wine has no WFP). A changed plan goes in under the other of
two sublayers before the old one goes, so nothing leaks between.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 5.5 committed 2026-10-28 00:17:24 +03:00
1 parent ddc1bbe686
commit 32ff264c81
12 files changed
+557 -9

No files matched your search

+26
View File
@@ -68,6 +68,24 @@ pub fn render(model: &Entity<Model>, _: &mut Window, cx: &mut Context<AppView>)
.child(fact(tr("Backend"), text(&p["backend"]), cx))
.child(fact(tr("Mode"), p["mode"].as_str().unwrap_or("default").to_owned(), cx))
.child(fact(tr("Outbound"), p["pinned"].as_str().map(|t| trf("{} (pinned)", &[&t])).unwrap_or_else(|| trf("{} selection", &[&p["selection"].as_str().unwrap_or("?")])), cx))
.when(s["killSwitch"]["enabled"] == true, |d| {
let k = &s["killSwitch"];
let (state, action, on) = if k["holding"] == true {
(tr("holding: what would leave past the tunnel is blocked"), tr("Lift"), false)
} else if k["lifted"] == true {
(tr("lifted until a tunnel is turned on"), tr("Hold again"), true)
} else {
(tr("nothing to hold: no global tunnel is on"), "", true)
};
let model = model.clone();
d.child(
div().h_flex().gap_2().items_center().child(fact(tr("Kill switch"), state, cx)).when(!action.is_empty(), |d| {
d.child(Button::new("killswitch").xsmall().label(action).on_click(move |_, _, cx| {
model.update(cx, |m, cx| m.request(if on { tr("The kill switch holds again") } else { tr("The kill switch is lifted") }, ps_ipc::Request::KillSwitch { on: Some(on) }, cx))
}))
}),
)
})
.child({
let model = model.clone();
let on = m.config()["proxy"]["systemProxy"]["enable"] == true;
@@ -201,6 +219,14 @@ pub const RU: &[(&str, &str)] = &[
("{} (pinned)", "{} (закреплён)"),
("{} selection", "выбор: {}"),
("Use it as the system proxy (browsers and most programs follow it)", "Использовать как системный прокси (ему следуют браузеры и большинство программ)"),
("Kill switch", "Kill switch"),
("holding: what would leave past the tunnel is blocked", "действует: всё, что пошло бы мимо туннеля, блокируется"),
("lifted until a tunnel is turned on", "снят до включения туннеля"),
("nothing to hold: no global tunnel is on", "не нужен: ни один общий туннель не включён"),
("Lift", "Снять"),
("Hold again", "Включить снова"),
("The kill switch holds again", "Kill switch снова действует"),
("The kill switch is lifted", "Kill switch снят"),
("The system proxy follows the local proxy", "Системный прокси следует за локальным прокси"),
("The system proxy is left alone", "Системный прокси не затрагивается"),
("Engine", "Движок"),