feat: awg runtime add

This commit is contained in:
fufsob committed 2026-09-28 18:51:47 +00:00
1 parent cd3aa5a53f
commit 364bed8d51
39 files changed
+1581 -190

No files matched your search

+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
};
};
}
+38
View File
@@ -64,6 +64,43 @@ 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. |
## Add one without rebuilding
`amneziaWg.enable` alone is enough: profiles and outbounds can come from `proxy-ctl` instead
of the config.
```nix
services.proxy-suite = {
enable = true;
amneziaWg.enable = true; # no profiles needed
userControl = {
enable = true;
scopes = [ "services" "amneziaWg" "outbounds" ]; # optional: no sudo for these
};
};
```
```sh
proxy-ctl awg add vpn://AAAA… # named after the export, or the server's host
proxy-ctl awg add home ~/home.conf # a name first; a link, a file, or - for stdin
proxy-ctl awg on home
proxy-ctl awg rm home
proxy-ctl proxy outbounds add de ~/de.conf # an outbound instead (needs proxy.enable)
```
- 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.
- 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.
- 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,
`outbounds` for outbounds. Turning a profile on and off is `services`.
- They are kept across reboots. `amneziaWg.runtime.enable = false` turns all of this off.
## Good to know
- A profile that stops getting handshake replies moves to a new source port on its own.
@@ -77,5 +114,6 @@ host's routes and DNS alone. Use it like any other outbound: for selection, in
## See also
- [`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)
- [`settings`](../options/amneziaWg.md#services-proxy-suite-amneziawg-profiles-name-settings)
+10 -3
View File
@@ -37,7 +37,8 @@ Members of the group get the listed scopes. An empty `scopes` list grants all of
|---|---|
| `services` | turning services on, off and restarting them |
| `routing` | `proxy pin`, `proxy unpin`, `proxy mode` |
| `outbounds` | adding, removing, enabling and disabling outbounds and subscriptions |
| `outbounds` | adding, removing, enabling and disabling outbounds and subscriptions, AmneziaWG outbounds included |
| `amneziaWg` | `awg add` and `awg rm`: global AmneziaWG profiles, which take over the host's routes and DNS |
| `perApp` | `apps run` with `tun`, `tproxy` and `zapret` profiles |
| `secrets` | reading share links, subscription URLs and running configs |
| `autoProxy`, `zapret`, `stats`, `whitelistBypass` | the matching `proxy-ctl` groups |
@@ -49,13 +50,19 @@ admin password, or you run `proxy-ctl` with sudo.
| Change | Lasts |
|---|---|
| `proxy outbounds add`, `proxy subs add` | until removed with `rm`; kept across reboots |
| `proxy outbounds add`, `proxy subs add`, `awg add` | until removed with `rm`; kept across reboots |
| `proxy outbounds disable` | until `enable`; works on outbounds from Nix too |
| `proxy pin` | until `unpin`; kept across reboots |
| `proxy mode` | until the next reboot |
| `… on` / `… off` | until the next reboot; boot state comes from the config |
Outbounds from the Nix config cannot be removed at runtime, only disabled.
Outbounds from the Nix config cannot be removed at runtime, only disabled. The same goes for
AmneziaWG profiles: `awg rm` only removes those added with `awg add`.
In the TUI and the app, pasting a link onto a tab adds it there: a share link becomes an
outbound, a subscription URL a subscription. An AmneziaWG `vpn://` link or a whole `.conf`
becomes a global profile, or an outbound when pasted onto the Outbounds tab. See
[Use an AmneziaWG config](./amneziawg.md).
## Commands