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

+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)