feat: per-app awg and custom via

This commit is contained in:
FUFSoB committed 2026-10-04 15:39:56 +05:00
1 parent af5b3ff27a
commit 65082aad88
43 files changed
+2674 -197

No files matched your search

+11
View File
@@ -69,6 +69,7 @@ Part of the [proxy-suite options reference](./index.md).
- runtime
- [enable](#services-proxy-suite-amneziawg-runtime-enable)
- [interfaceName](#services-proxy-suite-amneziawg-runtime-interfacename)
- [outboundKind](#services-proxy-suite-amneziawg-runtime-outboundkind)
- [serverUdpPorts](#services-proxy-suite-amneziawg-serverudpports)
- [toolsPackage](#services-proxy-suite-amneziawg-toolspackage)
- [userspacePackage](#services-proxy-suite-amneziawg-userspacepackage)
@@ -570,6 +571,16 @@ Interface of the global profiles added at runtime\. Only one of them runs at a t
**Type:** string matching the pattern ^\[A-Za-z0-9_\.-]{1,15}$\
**Default:** `"awg-rt"`
<a id="services-proxy-suite-amneziawg-runtime-outboundkind"></a>
## services\.proxy-suite\.amneziaWg\.runtime\.outboundKind
How an outbound added with ` proxy-ctl proxy outbounds add ` runs, unless it says
(` --interface `, ` --userspace `): in wireproxy, or as an AmneziaWG interface of its own
(root hosts only), which apps can also be run through with ` proxy-ctl apps run --via `\.
**Type:** one of “userspace”, “interface”\
**Default:** `"userspace"`
<a id="services-proxy-suite-amneziawg-serverudpports"></a>
## services\.proxy-suite\.amneziaWg\.serverUdpPorts
+7
View File
@@ -46,6 +46,7 @@ services.proxy-suite = {
runtime = {
enable = true;
interfaceName = "awg-rt";
outboundKind = "userspace";
};
serverUdpPorts = [ ];
toolsPackage = ‹proxy-suite's patched amneziawg-tools (pkgs/amneziawg.nix)›;
@@ -138,6 +139,12 @@ services.proxy-suite = {
mtu = 1400;
routeTable = 101;
};
via = {
localSubnets = [
"192.168.0.0/16"
];
pinSlots = 8;
};
zapret = {
enable = false;
filterMark = 268435456;
+39
View File
@@ -12,6 +12,7 @@ Part of the [proxy-suite options reference](./index.md).
- [profiles](#services-proxy-suite-perapprouting-profiles)
- item
- [name](#services-proxy-suite-perapprouting-profiles-name)
- [outbound](#services-proxy-suite-perapprouting-profiles-outbound)
- [route](#services-proxy-suite-perapprouting-profiles-route)
- proxychains
- [enable](#services-proxy-suite-perapprouting-proxychains-enable)
@@ -30,6 +31,9 @@ Part of the [proxy-suite options reference](./index.md).
- [localSubnets](#services-proxy-suite-perapprouting-tun-localsubnets)
- [mtu](#services-proxy-suite-perapprouting-tun-mtu)
- [routeTable](#services-proxy-suite-perapprouting-tun-routetable)
- via
- [localSubnets](#services-proxy-suite-perapprouting-via-localsubnets)
- [pinSlots](#services-proxy-suite-perapprouting-via-pinslots)
- zapret
- [enable](#services-proxy-suite-perapprouting-zapret-enable)
- [filterMark](#services-proxy-suite-perapprouting-zapret-filtermark)
@@ -69,6 +73,20 @@ Unique profile name\.
**Type:** string matching the pattern ^\[a-z0-9]\[a-z0-9-]\*$\
**Example:** `"steam-browser"`
<a id="services-proxy-suite-perapprouting-profiles-outbound"></a>
## services\.proxy-suite\.perAppRouting\.profiles\.\*\.outbound
Send all of the app’s traffic through this outbound, past the routing rules\. An
“interface” AmneziaWG outbound (` amneziaWg.profiles.<name>.asOutbound `), or a
global AmneziaWG profile, takes the app’s packets into its interface directly,
whatever ` route ` is; any other outbound needs ` route ` “tun” or “tproxy”\. For a name
that is both a global profile and an outbound, say which: “awg:\<name>” or
“outbound:\<name>”\.
**Type:** null or string\
**Default:** `null`\
**Example:** `"de"`
<a id="services-proxy-suite-perapprouting-profiles-route"></a>
## services\.proxy-suite\.perAppRouting\.profiles\.\*\.route
@@ -192,6 +210,27 @@ Routing table for the per-app TUN\.
**Type:** signed integer\
**Default:** `101`
<a id="services-proxy-suite-perapprouting-via-localsubnets"></a>
## services\.proxy-suite\.perAppRouting\.via\.localSubnets
Subnets an app run ` --via ` an AmneziaWG interface (an “interface” outbound or a global
profile) still reaches directly; DNS still goes through the tunnel\. Every other
address goes through it, private ones included, as the server may serve them\.
**Type:** list of string\
**Default:** `[ "192.168.0.0/16" ]`\
**Example:** `[ "192.168.0.0/16" "10.0.0.0/8" ]`
<a id="services-proxy-suite-perapprouting-via-pinslots"></a>
## services\.proxy-suite\.perAppRouting\.via\.pinSlots
How many outbounds ` apps run --via ` can send apps through at once, for per-app TProxy
and again for per-app TUN; at most 16\. Apps via the same outbound share one\. An
“interface” AmneziaWG outbound takes none: apps enter it directly\.
**Type:** signed integer\
**Default:** `8`
<a id="services-proxy-suite-perapprouting-zapret-enable"></a>
## services\.proxy-suite\.perAppRouting\.zapret\.enable
+10 -3
View File
@@ -2,10 +2,17 @@
{
services.proxy-suite = {
enable = true;
amneziaWg.enable = true; # no profiles needed
userControl = {
proxy.enable = true;
amneziaWg = {
enable = true;
scopes = [ "services" "amneziaWg" "outbounds" ]; # optional: no sudo for these
profiles.de = {
configFile = "/run/secrets/de-awg.conf";
asOutbound = "interface";
};
};
perAppRouting = {
enable = true;
profiles = [ { name = "games"; outbound = "de"; } ];
};
};
}
+11
View File
@@ -0,0 +1,11 @@
{ config, lib, pkgs, ... }:
{
services.proxy-suite = {
enable = true;
amneziaWg.enable = true; # no profiles needed
userControl = {
enable = true;
scopes = [ "services" "amneziaWg" "outbounds" ]; # optional: no sudo for these
};
};
}
+15
View File
@@ -0,0 +1,15 @@
{ config, lib, pkgs, ... }:
{
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [ { tag = "nl"; urlFile = "/run/secrets/nl-url"; } ];
};
perAppRouting = {
enable = true;
tun.enable = true;
profiles = [ { name = "game"; route = "tun"; outbound = "nl"; } ];
};
};
}
+50 -3
View File
@@ -64,6 +64,46 @@ host's routes and DNS alone. Use it like any other outbound: for selection, in
| `"userspace"` | yes | no | Runs in wireproxy. The only mode on home-manager and Nix-on-Droid. |
| `"singBox"` | no | no | Plain WireGuard inside sing-box. For servers without obfuscation, such as WARP. |
## Run single apps through it
With [per-app routing](./per-app.md) on, `--via` sends one app through an outbound:
```sh
proxy-ctl apps run --via de -- steam
```
An `"interface"` outbound takes the app's packets into its interface directly: no proxy in
between, and UDP as it is. The app's DNS goes to the profile's `DNS` servers (or to
`proxy.dns.remote` when it names none), through the tunnel, even when `/etc/resolv.conf`
points at a local resolver. While the interface is down, the app's connections fail instead of
leaving another way. A `"userspace"` or `"singBox"` outbound works like any other outbound
here: through per-app TUN or TProxy.
A global profile works too, declared or added with `awg add`: `--via home` brings up a copy
of it for the apps alone, the same way, and takes it down after the last one exits. The
rest of the system is untouched. A profile cannot be up globally and for apps at once: while
`awg on home` holds it, `--via home` runs the app as it is, and `awg on home` stops the copy.
When a name is both a global profile and an outbound, say which: `--via awg:home` or
`--via outbound:home`.
```nix
services.proxy-suite = {
enable = true;
proxy.enable = true;
amneziaWg = {
enable = true;
profiles.de = {
configFile = "/run/secrets/de-awg.conf";
asOutbound = "interface";
};
};
perAppRouting = {
enable = true;
profiles = [ { name = "games"; outbound = "de"; } ];
};
};
```
## Add one without rebuilding
`amneziaWg.enable` alone is enough: profiles and outbounds can come from `proxy-ctl` instead
@@ -86,15 +126,21 @@ proxy-ctl awg add home ~/home.conf # a name first; a link, a file, or -
proxy-ctl awg on home
proxy-ctl awg rm home
proxy-ctl proxy outbounds add de ~/de.conf # an outbound instead (needs proxy.enable)
proxy-ctl proxy outbounds add nl ~/nl.conf --interface # on an interface of its own
```
- A global profile works like a declared one: `awg on`, the tray menu, the kill switch. The
ones added this way share one interface, `amneziaWg.runtime.interfaceName`.
- An outbound runs in wireproxy (like `asOutbound = "userspace"`), so the obfuscation stays.
It cannot chain through another outbound.
With `--interface` it gets an AmneziaWG interface of its own instead (like
`asOutbound = "interface"`; root hosts only), which apps can run through directly (see
above).
`amneziaWg.runtime.outboundKind` sets which one an outbound gets when the command does not
say. Either way, it cannot chain through another outbound.
- In `proxy-tui` and the desktop app, paste a `vpn://` link or a whole `.conf` onto a tab: on
the Outbounds tab it becomes an outbound, anywhere else a global profile. The AmneziaWG tab
also adds one from a prompt, and removes what was added.
the Outbounds tab it becomes an outbound, anywhere else a global profile. The Outbounds tab
also adds one on an interface of its own, and the AmneziaWG tab adds a global profile from a
prompt and removes what was added.
- Hooks (`PostUp` and the like) are always refused, whoever adds the config.
`--container <name>` picks one from a `vpn://` export that holds several.
- Adding and removing takes root, or a `userControl` scope: `amneziaWg` for global profiles,
@@ -116,4 +162,5 @@ proxy-ctl proxy outbounds add de ~/de.conf # an outbound instead (needs proxy.e
- [`amneziaWg.profiles`](../options/amneziaWg.md#services-proxy-suite-amneziawg-profiles)
- [`amneziaWg.runtime`](../options/amneziaWg.md#services-proxy-suite-amneziawg-runtime-enable)
- [`asOutbound`](../options/amneziaWg.md#services-proxy-suite-amneziawg-profiles-name-asoutbound)
- [Route a single app](./per-app.md)
- [`settings`](../options/amneziaWg.md#services-proxy-suite-amneziawg-profiles-name-settings)
+41 -1
View File
@@ -63,13 +63,52 @@ services.proxy-suite = {
Then run `proxy-ctl apps run browser -- chromium`.
## Through one outbound
Send an app through one outbound you pick, past the [routing rules](./routing.md):
```sh
proxy-ctl apps run --via nl -- firefox
proxy-ctl apps run --via nl --route tproxy -- curl https://example.com
```
Or name it in a profile:
```nix
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [ { tag = "nl"; urlFile = "/run/secrets/nl-url"; } ];
};
perAppRouting = {
enable = true;
tun.enable = true;
profiles = [ { name = "game"; route = "tun"; outbound = "nl"; } ];
};
};
```
- An "interface" AmneziaWG outbound, or a global AmneziaWG profile (`--via home`), takes the
app straight into its interface, with no proxy in between, and sends the app's DNS to the
profile's DNS server. See [Use an AmneziaWG config](./amneziawg.md).
- Any other outbound goes through per-app TUN or TProxy (`--route`; TUN when both are
enabled) and needs the sing-box or hybrid backend. Each outbound in use takes one of
`perAppRouting.via.pinSlots`.
- When the outbound is down, the app's connections fail; they never leave another way.
- Add profiles without a rebuild: `proxy-ctl apps add game --via nl`, then
`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.
## Good to know
- `tun`, `tproxy` and `zapret` profiles start a system service, so they ask for an admin
password unless `userControl` grants the `perApp` scope (see
[Control it day to day](./control.md)).
- While a global TUN or TProxy is running, these three run the app without their route:
the global mode already carries its traffic. `proxy-ctl` prints a note when it does.
the global mode already carries its traffic. `proxy-ctl` prints a note when it does. So
does `--via`, except that an "interface" AmneziaWG outbound still takes the app under a
global TProxy or AmneziaWG profile.
- If `/etc/resolv.conf` points only at a local resolver (such as systemd-resolved on
127.0.0.53), the app's DNS queries skip its route. `proxy-ctl` warns about this.
- The app follows your [routing rules](./routing.md) like any other proxied traffic.
@@ -79,3 +118,4 @@ Then run `proxy-ctl apps run browser -- chromium`.
- [Wrap programs with the proxy](./wrap-apps.md): a package that always starts through a profile
- [`perAppRouting.profiles`](../options/perAppRouting.md#services-proxy-suite-perapprouting-profiles)
- [`perAppRouting.createDefaultProfiles`](../options/perAppRouting.md#services-proxy-suite-perapprouting-createdefaultprofiles)
- [`perAppRouting.via`](../options/perAppRouting.md#services-proxy-suite-perapprouting-via-pinslots)