feat: per-app keep-running

This commit is contained in:
FUFSoB committed 2026-10-10 16:19:54 +05:00
1 parent 91f2397ac5
commit d70bcb317f
15 files changed
+570 -22

No files matched your search

+3
View File
@@ -130,6 +130,7 @@ services.proxy-suite = {
tproxy = {
enable = false;
fwmark = 17;
keepRunning = false;
localSubnets = [
"192.168.0.0/16"
];
@@ -140,6 +141,7 @@ services.proxy-suite = {
enable = false;
fwmark = 16;
interface = "psperapptun0";
keepRunning = false;
localSubnets = [
"192.168.0.0/16"
];
@@ -155,6 +157,7 @@ services.proxy-suite = {
zapret = {
enable = false;
filterMark = 268435456;
keepRunning = false;
qnum = 201;
};
};
+44
View File
@@ -11,6 +11,7 @@ Part of the [proxy-suite options reference](./index.md).
- [createDefaultProfiles](#services-proxy-suite-perapprouting-createdefaultprofiles)
- [profiles](#services-proxy-suite-perapprouting-profiles)
- item
- [keepRunning](#services-proxy-suite-perapprouting-profiles-keeprunning)
- [name](#services-proxy-suite-perapprouting-profiles-name)
- [outbound](#services-proxy-suite-perapprouting-profiles-outbound)
- [route](#services-proxy-suite-perapprouting-profiles-route)
@@ -21,6 +22,7 @@ Part of the [proxy-suite options reference](./index.md).
- tproxy
- [enable](#services-proxy-suite-perapprouting-tproxy-enable)
- [fwmark](#services-proxy-suite-perapprouting-tproxy-fwmark)
- [keepRunning](#services-proxy-suite-perapprouting-tproxy-keeprunning)
- [localSubnets](#services-proxy-suite-perapprouting-tproxy-localsubnets)
- [routeTable](#services-proxy-suite-perapprouting-tproxy-routetable)
- tun
@@ -28,6 +30,7 @@ Part of the [proxy-suite options reference](./index.md).
- [address](#services-proxy-suite-perapprouting-tun-address)
- [fwmark](#services-proxy-suite-perapprouting-tun-fwmark)
- [interface](#services-proxy-suite-perapprouting-tun-interface)
- [keepRunning](#services-proxy-suite-perapprouting-tun-keeprunning)
- [localSubnets](#services-proxy-suite-perapprouting-tun-localsubnets)
- [mtu](#services-proxy-suite-perapprouting-tun-mtu)
- [routeTable](#services-proxy-suite-perapprouting-tun-routetable)
@@ -37,6 +40,7 @@ Part of the [proxy-suite options reference](./index.md).
- zapret
- [enable](#services-proxy-suite-perapprouting-zapret-enable)
- [filterMark](#services-proxy-suite-perapprouting-zapret-filtermark)
- [keepRunning](#services-proxy-suite-perapprouting-zapret-keeprunning)
- [qnum](#services-proxy-suite-perapprouting-zapret-qnum)
<a id="services-proxy-suite-perapprouting-enable"></a>
@@ -65,6 +69,17 @@ Profiles for ` proxy-ctl apps run <name> -- <command> `\.
**Default:** `[ ]`\
**Example:** `[ { name = "steam-browser"; route = "proxychains"; } ]`
<a id="services-proxy-suite-perapprouting-profiles-keeprunning"></a>
## services\.proxy-suite\.perAppRouting\.profiles\.\*\.keepRunning
Keep what this profile runs through running from boot, rather than starting it with
the first app and stopping it after the last: its ` outbound ` (an AmneziaWG
interface or profile, or a pin slot, which then stays taken), or else its ` route `’s
backend, as ` perAppRouting.<route>.keepRunning ` does\.
**Type:** boolean\
**Default:** `false`
<a id="services-proxy-suite-perapprouting-profiles-name"></a>
## services\.proxy-suite\.perAppRouting\.profiles\.\*\.name
@@ -136,6 +151,16 @@ Firewall mark for wrapped apps’ traffic\.
**Type:** signed integer\
**Default:** `17`
<a id="services-proxy-suite-perapprouting-tproxy-keeprunning"></a>
## services\.proxy-suite\.perAppRouting\.tproxy\.keepRunning
Keep the per-app TProxy backend running from boot, rather than starting it with the first app
and stopping it after the last: apps start without waiting for it\.
Under a global TUN or TProxy it stays down, and comes back once that stops\.
**Type:** boolean\
**Default:** `false`
<a id="services-proxy-suite-perapprouting-tproxy-localsubnets"></a>
## services\.proxy-suite\.perAppRouting\.tproxy\.localSubnets
@@ -185,6 +210,15 @@ Interface name\.
**Type:** network interface name\
**Default:** `"psperapptun0"`
<a id="services-proxy-suite-perapprouting-tun-keeprunning"></a>
## services\.proxy-suite\.perAppRouting\.tun\.keepRunning
Keep the per-app TUN backend running from boot, rather than starting it with the first app
and stopping it after the last: apps start without waiting for it\.
**Type:** boolean\
**Default:** `false`
<a id="services-proxy-suite-perapprouting-tun-localsubnets"></a>
## services\.proxy-suite\.perAppRouting\.tun\.localSubnets
@@ -247,6 +281,16 @@ Firewall mark bit for wrapped apps’ traffic\.
**Type:** signed integer\
**Default:** `268435456`
<a id="services-proxy-suite-perapprouting-zapret-keeprunning"></a>
## services\.proxy-suite\.perAppRouting\.zapret\.keepRunning
Keep the per-app zapret backend running from boot, rather than starting it with the first app
and stopping it after the last: apps start without waiting for it\.
Under a global TUN, TProxy or AmneziaWG profile it stays down, and comes back once that stops\.
**Type:** boolean\
**Default:** `false`
<a id="services-proxy-suite-perapprouting-zapret-qnum"></a>
## services\.proxy-suite\.perAppRouting\.zapret\.qnum
+18
View File
@@ -0,0 +1,18 @@
{ config, lib, pkgs, ... }:
{
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
};
perAppRouting = {
enable = true;
createDefaultProfiles = true;
tun = {
enable = true;
keepRunning = true;
};
};
};
}
+22
View File
@@ -0,0 +1,22 @@
{ config, lib, pkgs, ... }:
{
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [ { tag = "nl"; urlFile = "/run/secrets/nl-url"; } ];
};
amneziaWg = {
enable = true;
profiles.home.configFile = "/run/secrets/home.conf";
};
perAppRouting = {
enable = true;
tun.enable = true;
profiles = [
{ name = "game"; route = "tun"; outbound = "nl"; keepRunning = true; }
{ name = "home"; outbound = "awg:home"; keepRunning = true; }
];
};
};
}
+58
View File
@@ -100,6 +100,64 @@ services.proxy-suite = {
`proxy-ctl apps rm game`. In `proxy-tui` and the desktop app, the Apps tab adds and removes
them, and runs a command via an outbound.
## Keep a route running
`tun`, `tproxy` and `zapret` start their backend with the first app and stop it after the last,
so each first app waits for it to come up. `keepRunning` keeps one running from boot instead:
```nix
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
};
perAppRouting = {
enable = true;
createDefaultProfiles = true;
tun = {
enable = true;
keepRunning = true;
};
};
};
```
The per-app TProxy and zapret step aside under a global TUN or TProxy (zapret under a global
AmneziaWG profile too), as below, and come back once it stops.
A profile through one outbound can be kept running too, with its own `keepRunning`:
```nix
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [ { tag = "nl"; urlFile = "/run/secrets/nl-url"; } ];
};
amneziaWg = {
enable = true;
profiles.home.configFile = "/run/secrets/home.conf";
};
perAppRouting = {
enable = true;
tun.enable = true;
profiles = [
{ name = "game"; route = "tun"; outbound = "nl"; keepRunning = true; }
{ name = "home"; outbound = "awg:home"; keepRunning = true; }
];
};
};
```
- An "interface" AmneziaWG outbound keeps its rules and DNS forwarder for apps up.
- A global AmneziaWG profile is kept up for apps alone (as `--via` brings it up), unless the
profile is up globally, which carries the apps already.
- Any other outbound keeps its pin slot: it counts against `perAppRouting.via.pinSlots`
for good, and with it the route's backend stays up.
Only declared profiles: one `proxy-ctl apps add` adds still starts with its first app.
## Good to know
- `tun`, `tproxy` and `zapret` profiles start a system service, so they ask for an admin