docs: improve the wording, add targeted examples

This commit is contained in:
fufsob committed 2026-09-25 09:54:12 +00:00
1 parent 53fc86dd83
commit 63d9dffcae
61 files changed
+3409 -5848

No files matched your search

+96 -93
View File
@@ -1,35 +1,31 @@
# proxy-suite-flake # proxy-suite-flake
Declarative proxy stack for NixOS, on either side of the connection: as a client that routes this host's traffic through outbounds, as a server that accepts clients on its own inbounds, or both at once. Configure it in Nix, rebuild, and it runs as systemd services. It also runs on other Linux distributions (through system-manager or home-manager) and on Android (through Nix-on-Droid). A declarative proxy stack for NixOS. Route this host's traffic through proxies, serve proxies to others, or both, all from one Nix config that runs as systemd services. Also runs on other Linux distributions (system-manager, home-manager) and on Android (Nix-on-Droid).
> [!IMPORTANT] > [!IMPORTANT]
> This project is for study and research purposes only: learning how proxies, tunnels and traffic routing work. It comes with no warranty, and the authors are not responsible for how it is used. > For study and research only: learning how proxies, tunnels and traffic routing work. No warranty; the authors are not responsible for how it is used.
> [!NOTE] > [!NOTE]
> This project is developed with AI assistance: much of the code and documentation was written with AI tools, then reviewed and tested on real-world setups. > Much of the code and documentation was written with AI tools, then reviewed and tested on real setups.
Bundles [sing-box](https://github.com/SagerNet/sing-box), [XRay](https://github.com/XTLS/Xray-core), [AmneziaWG](https://github.com/amnezia-vpn/amneziawg-go), [zapret-discord-youtube](https://github.com/kartavkun/zapret-discord-youtube), [zapret2](https://github.com/bol-van/zapret2), [tg-ws-proxy](https://github.com/Flowseal/tg-ws-proxy) and [whitelist-bypass](https://github.com/kulikov0/whitelist-bypass); see their repositories for their own licenses and documentation. Bundles [sing-box](https://github.com/SagerNet/sing-box), [XRay](https://github.com/XTLS/Xray-core), [AmneziaWG](https://github.com/amnezia-vpn/amneziawg-go), [zapret-discord-youtube](https://github.com/kartavkun/zapret-discord-youtube), [zapret2](https://github.com/bol-van/zapret2), [tg-ws-proxy](https://github.com/Flowseal/tg-ws-proxy) and [whitelist-bypass](https://github.com/kulikov0/whitelist-bypass); see their repositories for licenses and docs. Inspired by [Throne](https://github.com/throneproj/Throne) (formerly NekoRay), [3x-ui](https://github.com/MHSanaei/3x-ui) and similar projects.
Inspired by [Throne](https://github.com/throneproj/Throne) (formerly NekoRay), [3x-ui](https://github.com/MHSanaei/3x-ui) and other similar projects.
## Features ## Features
- Local SOCKS5/HTTP proxy on `127.0.0.1:1080`, backed by sing-box, XRay, or both - Local SOCKS5/HTTP proxy on `127.0.0.1:1080`, on sing-box, XRay, or both
- Global TProxy or TUN mode, on demand or at boot - System-wide TUN or TProxy mode, on demand or at boot
- A kill switch for the global tunnels (TUN, TProxy, AmneziaWG): nothing leaves outside them while they restart or after they fail - Kill switch: nothing leaks while a global tunnel restarts or after it fails
- Per-app routing: `proxy-ctl apps run <profile> -- <cmd>` through proxychains, a per-app TUN/TProxy, or zapret - Per-app routing: `proxy-ctl apps run <profile> -- <cmd>`
- Outbounds from URLs, raw JSON or subscriptions; manual or latency-based selection; per-outbound routing - Outbounds from links, raw JSON or subscriptions, picked by hand or by latency
- vless (REALITY, TLS), vmess, trojan, shadowsocks, hysteria2, socks, http; TUIC, AnyTLS and NaïveProxy on sing-box, XHTTP/ECH on XRay - vless (REALITY, TLS), vmess, trojan, shadowsocks, hysteria2, socks, http; TUIC, AnyTLS and NaïveProxy on sing-box; XHTTP and ECH on XRay
- Proxy chains: any outbound or a whole subscription can connect through another (`detour`) - Proxy chains: any outbound can connect through another
- autoProxy: finds which exit reaches a blocked site and routes it there - autoProxy: finds an exit that reaches each blocked site and routes it there
- zapret DPI bypass, including zapret2, which learns blocked sites at runtime - zapret DPI bypass, including zapret2, which learns blocked sites on its own
- AmneziaWG 1.x–3.x tunnels from `.conf`, `vpn://`, or Nix - AmneziaWG 1.x–3.x from `.conf`, `vpn://` or Nix
- Telegram MTProto WebSocket proxy and SSH SOCKS5 tunnel - Cloudflare WARP, Tor (with bridges and an onion service), an SSH tunnel and a Telegram proxy
- Cloudflare WARP from a `wgcf` profile, as an outbound or an AWG VPN profile - Tunnels through video-call servers, to get past mobile internet whitelists
- Tor as an outbound, with `.onion` names routed to it automatically, bridges (obfs4, webtunnel, meek, snowflake), and an onion service in front of the server inbounds - Server inbounds (XRay protocols, hysteria2, AmneziaWG) with share links, QR codes, subscriptions and traffic stats
- Mobile internet whitelists: a tunnel through the media servers of video calls (WB Stream, Telemost, DION, Bitrix), with the creator on a server and the joiner as an outbound, Nix-on-Droid included - A desktop GUI with a tray icon, the `proxy-ctl` CLI and the `proxy-tui` terminal UI
- Server inbounds (XRay protocols, hysteria2, and multi-user AmneziaWG) with share links, QR codes, per-user subscriptions and traffic stats
- Proxy Suite GUI (a desktop app with a tray icon), the `proxy-ctl` CLI, and the `proxy-tui` terminal UI
## Setup ## Setup
@@ -41,7 +37,17 @@ inputs.proxy-suite.url = "github:FUFSoB/proxy-suite-flake";
modules = [ inputs.proxy-suite.nixosModules.default ]; modules = [ inputs.proxy-suite.nixosModules.default ];
``` ```
Starter config: Other hosts take the same options through their own module:
| Module | For |
|---|---|
| `nixosModules.default` | NixOS |
| `nixosModules.server` | a single-user VPS: VLESS REALITY, TLS and WS inbounds, ACME and SSH |
| `systemManagerModules.default` | other distributions, via [system-manager](https://github.com/numtide/system-manager); firewall and kernel modules are left to the host |
| `homeManagerModules.default` | home-manager, without root: the local proxy, inbounds on ports from 1024, and anything else that needs no root |
| `nixOnDroidModules.default` | Android, via Nix-on-Droid: what home-manager gets, without the GUI |
A starter config:
```nix ```nix
services.proxy-suite = { services.proxy-suite = {
@@ -49,12 +55,12 @@ services.proxy-suite = {
proxy = { proxy = {
enable = true; enable = true;
backend = "sing-box"; # or "xray", or "hybrid" backend = "sing-box"; # or "xray", "hybrid"
# url ends up in the Nix store; use urlFile for real secrets. # `url` ends up in the Nix store; use `urlFile` for secrets.
outbounds = [ { tag = "nl-vps"; url = "hy2://password@example.com:443?sni=example.com"; } ]; outbounds = [ { tag = "nl-vps"; url = "hy2://password@example.com:443?sni=example.com"; } ];
subscriptions = [ { tag = "main-sub"; urlFile = "/run/secrets/sub-url"; } ]; subscriptions = [ { tag = "main-sub"; urlFile = "/run/secrets/sub-url"; } ];
selection = "urltest"; # Default is "first", without any complex selector selection = "urltest"; # pick the fastest; default "first"
tproxy.enable = true; tproxy.enable = true;
tun.enable = true; tun.enable = true;
@@ -69,7 +75,7 @@ services.proxy-suite = {
zapret.enable = true; zapret.enable = true;
}; };
zapret.enable = true; # default is zapret-discord-youtube zapret.enable = true;
sshProxy = { sshProxy = {
enable = true; enable = true;
@@ -81,31 +87,31 @@ services.proxy-suite = {
hostKeyFile = "/run/secrets/proxy-suite-ssh-known-hosts"; hostKeyFile = "/run/secrets/proxy-suite-ssh-known-hosts";
}; };
# Only one AWG, TUN or TProxy global tunnel runs at a time. # Only one global tunnel (AWG, TUN or TProxy) runs at a time.
amneziaWg = { amneziaWg = {
enable = true; enable = true;
profiles.home.configFile = "/run/secrets/home-amneziawg.conf"; profiles.home.configFile = "/run/secrets/home-amneziawg.conf";
profiles.work.vpnFile = "/run/secrets/work-amnezia.vpn"; profiles.work.vpnFile = "/run/secrets/work-amnezia.vpn";
# An outbound tagged "de" instead: the proxy binds to its interface, which gets no routes. # Or use a profile as an outbound, tagged "de":
profiles.de = { profiles.de = {
asOutbound = "interface"; # or "userspace" (no root), or "singBox" (plain WireGuard) asOutbound = "interface"; # or "userspace" (no root), "singBox" (plain WireGuard)
configFile = "/run/secrets/de-amneziawg.conf"; configFile = "/run/secrets/de-amneziawg.conf";
}; };
}; };
# Registers with wgcf on first start. The exit is Cloudflare, but geolocated to your own country. # Registers a WARP device on first start.
warp = { warp = {
enable = true; enable = true;
asOutbound = "singBox"; # tag is "warp"; asOutbound = "interface" runs it as an AmneziaWG profile asOutbound = "singBox"; # outbound tagged "warp"
# asAmneziaWg = true; # or a global profile instead: proxy-ctl awg on warp # asAmneziaWg = true; # or a global profile: proxy-ctl awg on warp
}; };
# An outbound tagged "tor" for routing.rules; .onion names always go to it. # Outbound tagged "tor"; .onion names always go there.
tor = { tor = {
enable = true; enable = true;
asOutbound = true; asOutbound = true;
# bridges.file = "/run/secrets/tor-bridges"; # one obfs4/webtunnel/snowflake line each # bridges.file = "/run/secrets/tor-bridges";
# upstream = "proxy"; # reach Tor through the local proxy # upstream = "proxy"; # reach Tor through the proxy
}; };
tgWsProxy = { tgWsProxy = {
@@ -113,12 +119,12 @@ services.proxy-suite = {
secretFile = "/run/secrets/tg-ws-proxy-secret"; secretFile = "/run/secrets/tg-ws-proxy-secret";
}; };
# Through mobile internet whitelists: the call's media server relays, whatever the IP. # Tunnel through a video call. A creator runs on a free server and logs the call link;
# The server runs a creator per device; its log prints the call link for the joiner. # the joiner here is an outbound tagged "wl".
whitelistBypass = { whitelistBypass = {
enable = true; enable = true;
joiners.wl = { platform = "wbstream"; linkFile = "/run/secrets/wb-link"; }; # an outbound joiners.wl = { platform = "wbstream"; linkFile = "/run/secrets/wb-link"; };
# creators.phone = { platform = "wbstream"; cookiesFile = "/run/secrets/wb-cookies.json"; upstream = "proxy"; }; # creators.phone = { platform = "wbstream"; cookiesFile = "/run/secrets/wb-cookies.json"; };
}; };
gui.enable = true; gui.enable = true;
@@ -127,101 +133,98 @@ services.proxy-suite = {
--- ---
## Options ## Docs
See the [options reference](./docs/options/index.md), one page per option group. Regenerate it and the help below with `nix run .#update-docs`. - [Usage guides](./docs/usage/index.md): common setups, step by step.
- [Options reference](./docs/options/index.md): every option. Regenerate it and the help below with `nix run .#update-docs`.
## `proxy-ctl help` ## `proxy-ctl help`
<!-- proxy-ctl-help:start --> <!-- proxy-ctl-help:start -->
```text ```text
Usage: proxy-ctl <group> [verb] [args] Usage: proxy-ctl <group> [verb] [args]
A group without a verb shows its status or list. A group alone shows its status or list.
Every group with on|off also takes toggle (on if stopped, off if running) and restart. Groups with on|off also take toggle and restart.
Secrets and changes need root, or the userControl group. Changes and secrets need root or the userControl group.
status [--json] services and routing mode (--tray: deprecated key=value lines) status [--json] services and routing mode (--tray: deprecated)
restart restart active services restart restart running services
logs [unit] follow logs (default: every proxy-suite unit) logs [unit] follow logs (default: all proxy-suite units)
where <domain> how this host is routed right now where <domain> how a domain is routed right now
proxy [status|on|off] local proxy backend proxy [status|on|off] local proxy
proxy outbounds [list] outbounds, where each came from, and the pick proxy outbounds [list] outbounds, their source, and the current pick
proxy outbounds add [tag] <url|json|-> [--detour <tag>] proxy outbounds add [tag] <url|json|-> [--detour <tag>]
add an outbound at runtime: a URL, or sing-box/XRay JSON (-: stdin), add an outbound from a link or JSON (-: stdin);
chained through another outbound with --detour; the tag first, --detour: connect through another outbound
or left out to name it after the link
proxy outbounds chain <tag> <through-tag> [new tag] proxy outbounds chain <tag> <through-tag> [new tag]
add a copy of an existing outbound that dials through add a copy of an outbound that connects through another
another one; the original keeps dialing the way it did
proxy outbounds rm <tag> remove a runtime outbound proxy outbounds rm <tag> remove a runtime outbound
proxy outbounds disable|enable <tag> keep an outbound out of automatic use (selection, autoProxy, pins), proxy outbounds disable|enable <tag> exclude from automatic use (selection, autoProxy), or undo
or let it back in; declared ones too
proxy outbounds test [tag...] [--ping] [--delay] [--download] proxy outbounds test [tag...] [--ping] [--delay] [--download]
TCP ping, real delay, download speed (default: ping, delay) test ping, delay, download speed (default: ping, delay)
proxy outbounds link <tag> [--qr|--json|--config] proxy outbounds link <tag> [--qr|--json|--config]
its URL, QR code, backend JSON, or a client config for it its link, QR code, JSON, or client config
proxy pin [tag] always use this outbound (no tag: pick from a menu) proxy pin [tag] always use this outbound (no tag: pick from a menu)
proxy unpin let the configured selection pick again proxy unpin go back to automatic selection
proxy mode [default|whitelist|blacklist|all-proxy|all-bypass] proxy mode [default|whitelist|blacklist|all-proxy|all-bypass]
show or override the routing mode show or override the routing mode
proxy subs [list|update] subscription caches; update refetches them proxy subs [list|update] subscriptions; update refetches them
proxy subs add [tag] <url> add a subscription at runtime; no tag: named after its host proxy subs add [tag] <url> add a subscription (no tag: named after its host)
proxy subs rm <tag> remove a runtime subscription proxy subs rm <tag> remove a runtime subscription
proxy subs link <tag> [--qr] its URL proxy subs link <tag> [--qr] its URL
proxy rulesets [list|update] routing rule sets: when each was fetched; update fetches them now proxy rulesets [list|update] rule sets and when they were fetched; update refetches
proxy config [--raw] client config to import elsewhere; --raw: as running proxy config [--raw] client config to use elsewhere; --raw: as running
proxy tun [status|on|off] global TUN mode proxy tun [status|on|off] global TUN mode
proxy tproxy [status|on|off] global TProxy mode proxy tproxy [status|on|off] global TProxy mode
proxy auto [list] what autoProxy routed, and via which exit proxy auto [list] what autoProxy routed, and through which exit
proxy auto probe <domain>[/path] [--json] [--keep-going] [--exits a,b | --via tag] proxy auto probe <domain>[/path] [--json] [--keep-going] [--exits a,b | --via tag]
find an exit that reaches a domain find an exit that reaches a domain
proxy auto learn <domain> probe now and route it if an exit works proxy auto learn <domain> probe now, and route it if an exit works
proxy auto forget <domain> drop what was learned about it: direct until learned again proxy auto forget <domain> forget it (direct until learned again)
proxy auto relearn <domain> forget it, then probe the host it was learned from now proxy auto relearn <domain> forget it and probe again now
proxy auto clear forget every learned route and verdict proxy auto clear forget everything learned
proxy auto queue [count] destinations waiting to be probed proxy auto queue [count] destinations waiting to be probed
zapret [status|on|off] DPI bypass zapret [status|on|off] DPI bypass
zapret auto [list] hosts zapret2 learned as blocked zapret auto [list] sites zapret2 learned as blocked
zapret auto add|forget|exclude <domain> zapret auto add|forget|exclude <domain>
pin, forget, or never learn a host pin, forget, or never learn a site
zapret auto unpin|include <domain> undo add, or undo exclude zapret auto unpin|include <domain> undo add or exclude
zapret auto clear forget learned hosts and strategies zapret auto clear forget learned sites and strategies
zapret cutoff [status] networks this line cuts at 16 KB, and their names zapret cutoff [status] networks cut off at 16 KB, and names that pass
zapret cutoff probe probe this line again now zapret cutoff probe probe again now
awg [list] AmneziaWG profiles and their state awg [list] AmneziaWG profiles
awg on <profile> | off [profile] | toggle [profile] | restart [profile] awg on <profile> | off [profile] | toggle [profile] | restart [profile]
killswitch [status|on|off] reject traffic outside the global tunnel; up with killswitch [status|on|off] block traffic outside the global tunnel;
TUN, TProxy or AWG, lifted only by off here or on them stays on until turned off here or with the tunnel
ssh [status|on|off] SSH SOCKS5 tunnel ssh [status|on|off] SSH tunnel
warp [status|on|off] WARP tunnel behind the warp outbound warp [status|on|off] WARP tunnel
tor [status|on|off] Tor, behind the tor outbound and the onion service tor [status|on|off] Tor
tor newnym new circuits for new connections tor newnym new circuits for new connections
tg [status|on|off] Telegram WebSocket proxy tg [status|on|off] Telegram proxy
wl [list] whitelist-bypass creators and joiners wl [list] whitelist-bypass creators and joiners
wl link <creator> [--qr] the call link its joiner takes wl link <creator> [--qr] the call link for its joiner
wl auth <creator> [file|-] replace its login: cookies, or asked (DION, Bitrix) wl auth <creator> [file|-] replace its login: cookies, or prompt (DION, Bitrix)
wl join <joiner> <link|-> the call it joins, over its linkFile wl join <joiner> <link|-> set the call to join
wl new <creator> drop its call for a new one wl new <creator> start a new call
wl on|off|toggle|restart [name] one creator or joiner, or all of them wl on|off|toggle|restart [name] one creator or joiner, or all
apps [list] per-app routing profiles apps [list] per-app routing profiles
apps run <profile> -- <cmd> [args] run a command through a profile apps run <profile> -- <cmd> [args] run a command through a profile
inbounds [list] server inbounds inbounds [list] server inbounds
inbounds link <tag> [user] [--onion] [--qr|--json] inbounds link <tag> [user] [--onion] [--qr|--json]
client share link, or the client's outbound JSON; share link or client JSON; --onion: via the onion service
--onion: the one through the onion service
inbounds link <tag> [user] --config [--qr] inbounds link <tag> [user] --config [--qr]
an AmneziaWG client's .conf, or its QR code AmneziaWG client .conf or its QR code
inbounds link <tag> --server-json the server's inbound JSON inbounds link <tag> --server-json the server's inbound JSON
inbounds sub [user] [--qr] subscription users, or one user's URL inbounds sub [user] [--qr] subscription users, or one user's URL
inbounds stats [days] [--by user|inbound|outbound] inbounds stats [days] [--by user|inbound|outbound]
traffic per user, listener or exit traffic by user, listener or exit
inbounds online who is connected now, and when the rest were last seen inbounds online who is online, and when others were last seen
``` ```
<!-- proxy-ctl-help:end --> <!-- proxy-ctl-help:end -->
+170 -564
View File
File diff suppressed because it is too large. Load diff
+11 -27
View File
@@ -1,5 +1,7 @@
# services.proxy-suite.geodata # services.proxy-suite.geodata
Geosite and geoip databases used by routing.
Part of the [proxy-suite options reference](./index.md). Part of the [proxy-suite options reference](./index.md).
## Options ## Options
@@ -14,42 +16,24 @@ Part of the [proxy-suite options reference](./index.md).
<a id="services-proxy-suite-geodata-singbox-geoip"></a> <a id="services-proxy-suite-geodata-singbox-geoip"></a>
## services\.proxy-suite\.geodata\.singBox\.geoip ## services\.proxy-suite\.geodata\.singBox\.geoip
Package with share/sing-box/rule-set/geoip-NAME\.srs (country codes by default)\. Package with share/sing-box/rule-set/geoip-NAME\.srs (countries by default)\.
*Type:* **Type:** package\
package **Default:** `pkgs.sing-geoip`
*Default:*
```nix
pkgs.sing-geoip
```
<a id="services-proxy-suite-geodata-singbox-geosite"></a> <a id="services-proxy-suite-geodata-singbox-geosite"></a>
## services\.proxy-suite\.geodata\.singBox\.geosite ## services\.proxy-suite\.geodata\.singBox\.geosite
Package with share/sing-box/rule-set/geosite-NAME\.srs\. Package with share/sing-box/rule-set/geosite-NAME\.srs\.
*Type:* **Type:** package\
package **Default:** `pkgs.sing-geosite`
*Default:*
```nix
pkgs.sing-geosite
```
<a id="services-proxy-suite-geodata-xray-assets"></a> <a id="services-proxy-suite-geodata-xray-assets"></a>
## services\.proxy-suite\.geodata\.xray\.assets ## services\.proxy-suite\.geodata\.xray\.assets
Package with share/v2ray/{geoip,geosite}\.dat for every XRay process\. Null uses XRay’s own Package with share/v2ray/{geoip,geosite}\.dat for XRay\. ` null `: XRay’s built-in data,
country-only data, where a tag like “geoip:telegram” stops XRay from starting\. which only has countries, so a tag like “geoip:telegram” breaks XRay\.
*Type:* **Type:** null or package\
null or package **Default:** `pkgs.v2ray-rules-dat`
*Default:*
```nix
pkgs.v2ray-rules-dat
```
+11 -34
View File
@@ -1,5 +1,7 @@
# services.proxy-suite.gui # services.proxy-suite.gui
The desktop app with a tray icon.
Part of the [proxy-suite options reference](./index.md). Part of the [proxy-suite options reference](./index.md).
## Options ## Options
@@ -12,48 +14,23 @@ Part of the [proxy-suite options reference](./index.md).
<a id="services-proxy-suite-gui-enable"></a> <a id="services-proxy-suite-gui-enable"></a>
## services\.proxy-suite\.gui\.enable ## services\.proxy-suite\.gui\.enable
Whether to enable Proxy Suite GUI, a desktop app with a tray icon for everything proxy-ctl controls at runtime\. Whether to enable Proxy Suite GUI, a desktop app with a tray icon\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
*Example:*
```nix
true
```
<a id="services-proxy-suite-gui-autostart"></a> <a id="services-proxy-suite-gui-autostart"></a>
## services\.proxy-suite\.gui\.autostart ## services\.proxy-suite\.gui\.autostart
Start the GUI hidden in the tray with graphical sessions, as the Start the GUI in the tray on login to a graphical session\.
` proxy-suite-gui ` systemd user unit on ` graphical-session.target `\.
*Type:* **Type:** boolean\
boolean **Default:** `true`
*Default:*
```nix
true
```
<a id="services-proxy-suite-gui-refreshinterval"></a> <a id="services-proxy-suite-gui-refreshinterval"></a>
## services\.proxy-suite\.gui\.refreshInterval ## services\.proxy-suite\.gui\.refreshInterval
Status refresh interval, in seconds\. How often the status refreshes, in seconds\.
*Type:* **Type:** positive integer, meaning >0\
positive integer, meaning >0 **Default:** `3`
*Default:*
```nix
3
```
+369 -1300
View File
File diff suppressed because it is too large. Load diff
+29 -34
View File
@@ -6,24 +6,37 @@ Update the module option docs there instead of editing these files by hand.
## Option groups ## Option groups
- [amneziaWg](./amneziaWg.md) | Group | What it covers |
- [geodata](./geodata.md) |---|---|
- [gui](./gui.md) | [proxy](./proxy.md) | The local proxy: outbounds, subscriptions, selection, routing, DNS, TUN and TProxy. |
- [inbounds](./inbounds.md) | [killSwitch](./killSwitch.md) | Block traffic outside the global tunnel. |
- [killSwitch](./killSwitch.md) | [perAppRouting](./perAppRouting.md) | Route single apps through proxychains, a per-app TUN or TProxy, or zapret. |
- [perAppRouting](./perAppRouting.md) | [zapret](./zapret.md) | DPI bypass without a proxy: zapret-discord-youtube or zapret2. |
- [proxy](./proxy.md) | [amneziaWg](./amneziaWg.md) | AmneziaWG client profiles, as a global VPN or as outbounds. |
- [sshProxy](./sshProxy.md) | [warp](./warp.md) | Cloudflare WARP, as an outbound or an AmneziaWG profile. |
- [tgWsProxy](./tgWsProxy.md) | [tor](./tor.md) | Tor as an outbound, with bridges, and an onion service for the inbounds. |
- [tor](./tor.md) | [sshProxy](./sshProxy.md) | An SSH SOCKS5 tunnel, optionally as an outbound. |
- [tui](./tui.md) | [tgWsProxy](./tgWsProxy.md) | A Telegram MTProto proxy over WebSocket. |
- [userControl](./userControl.md) | [whitelistBypass](./whitelistBypass.md) | Tunnels through video-call servers, past mobile internet whitelists. |
- [warp](./warp.md) | [inbounds](./inbounds.md) | Server side: listeners for remote clients, share links, subscriptions and stats. |
- [whitelistBypass](./whitelistBypass.md) | [geodata](./geodata.md) | Geosite and geoip databases used by routing. |
- [zapret](./zapret.md) | [userControl](./userControl.md) | Let a group use `proxy-ctl` without root. |
| [gui](./gui.md) | The desktop app with a tray icon. |
| [tui](./tui.md) | The `proxy-tui` terminal UI. |
<a id="services-proxy-suite-enable"></a>
## services\.proxy-suite\.enable
Whether to enable proxy-suite\.
**Type:** boolean\
**Default:** `false`
## Complete default config ## Complete default config
<details>
<summary>Every option at its default</summary>
```nix ```nix
services.proxy-suite = { services.proxy-suite = {
amneziaWg = { amneziaWg = {
@@ -365,22 +378,4 @@ services.proxy-suite = {
}; };
``` ```
<a id="services-proxy-suite-enable"></a> </details>
## services\.proxy-suite\.enable
Whether to enable proxy-suite\.
*Type:*
boolean
*Default:*
```nix
false
```
*Example:*
```nix
true
```
+8 -21
View File
@@ -1,5 +1,7 @@
# services.proxy-suite.killSwitch # services.proxy-suite.killSwitch
Block traffic outside the global tunnel.
Part of the [proxy-suite options reference](./index.md). Part of the [proxy-suite options reference](./index.md).
## Options ## Options
@@ -10,25 +12,10 @@ Part of the [proxy-suite options reference](./index.md).
<a id="services-proxy-suite-killswitch-enable"></a> <a id="services-proxy-suite-killswitch-enable"></a>
## services\.proxy-suite\.killSwitch\.enable ## services\.proxy-suite\.killSwitch\.enable
Whether to enable a kill switch for the global tunnels (proxy\.tun, proxy\.tproxy and global AmneziaWG profiles): Block outgoing traffic that bypasses the active global tunnel (TUN, TProxy or a global
once one starts, outgoing traffic that would leave outside it is rejected, also while it AmneziaWG profile), including while it restarts or after it fails\. LAN, DHCP and NTP stay
restarts, after it crashes or after its handshake gives up\. LAN destinations, DHCP and NTP open; ` proxy.tproxy.lanInterfaces ` devices keep the LAN but lose the internet\. Only turning
stay open; tproxy\.lanInterfaces clients keep the LAN but lose the internet\. Only the tunnel off, or ` proxy-ctl killswitch off `, lifts it\.
` proxy-ctl killswitch off `, ` proxy off `, ` proxy tun off `, ` proxy tproxy off ` or ` awg off `
lift it (proxy-suite-killswitch)
\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
*Example:*
```nix
true
```
+71 -261
View File
@@ -1,5 +1,7 @@
# services.proxy-suite.perAppRouting # services.proxy-suite.perAppRouting
Route single apps through proxychains, a per-app TUN or TProxy, or zapret.
Part of the [proxy-suite options reference](./index.md). Part of the [proxy-suite options reference](./index.md).
## Options ## Options
@@ -38,370 +40,178 @@ Part of the [proxy-suite options reference](./index.md).
Whether to enable per-app routing (` proxy-ctl apps run `)\. Whether to enable per-app routing (` proxy-ctl apps run `)\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
*Example:*
```nix
true
```
<a id="services-proxy-suite-perapprouting-createdefaultprofiles"></a> <a id="services-proxy-suite-perapprouting-createdefaultprofiles"></a>
## services\.proxy-suite\.perAppRouting\.createDefaultProfiles ## services\.proxy-suite\.perAppRouting\.createDefaultProfiles
Add a profile named after each enabled backend (proxychains, tun, tproxy, zapret) unless Add a profile for each enabled method (proxychains, tun, tproxy, zapret), named after it,
one with that name already exists\. unless one already exists\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
<a id="services-proxy-suite-perapprouting-profiles"></a> <a id="services-proxy-suite-perapprouting-profiles"></a>
## services\.proxy-suite\.perAppRouting\.profiles ## services\.proxy-suite\.perAppRouting\.profiles
Profiles for ` proxy-ctl apps run <name> -- <command> `\. Profiles for ` proxy-ctl apps run <name> -- <command> `\.
*Type:* **Type:** list of (submodule)\
list of (submodule) **Default:** `[ ]`\
**Example:** `[ { name = "steam-browser"; route = "proxychains"; } ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
{
name = "steam-browser";
route = "proxychains";
}
]
```
<a id="services-proxy-suite-perapprouting-profiles-name"></a> <a id="services-proxy-suite-perapprouting-profiles-name"></a>
## services\.proxy-suite\.perAppRouting\.profiles\.\*\.name ## services\.proxy-suite\.perAppRouting\.profiles\.\*\.name
Profile name, unique\. Unique profile name\.
*Type:* **Type:** string matching the pattern ^\[a-z0-9]\[a-z0-9-]\*$\
string matching the pattern ^\[a-z0-9]\[a-z0-9-]\*$ **Example:** `"steam-browser"`
*Example:*
```nix
"steam-browser"
```
<a id="services-proxy-suite-perapprouting-profiles-route"></a> <a id="services-proxy-suite-perapprouting-profiles-route"></a>
## services\.proxy-suite\.perAppRouting\.profiles\.\*\.route ## services\.proxy-suite\.perAppRouting\.profiles\.\*\.route
Backend: “direct” (unchanged), “proxychains”, or the per-app “tun”, “tproxy” or “zapret” How the app is routed: “direct” (untouched), “proxychains”, or the per-app “tun”,
backend of perAppRouting\. “tproxy” or “zapret”\.
*Type:* **Type:** one of “direct”, “proxychains”, “tun”, “tproxy”, “zapret”\
one of “direct”, “proxychains”, “tun”, “tproxy”, “zapret” **Default:** `"proxychains"`
*Default:*
```nix
"proxychains"
```
<a id="services-proxy-suite-perapprouting-proxychains-enable"></a> <a id="services-proxy-suite-perapprouting-proxychains-enable"></a>
## services\.proxy-suite\.perAppRouting\.proxychains\.enable ## services\.proxy-suite\.perAppRouting\.proxychains\.enable
Whether to enable the proxychains backend (TCP apps, through LD_PRELOAD)\. Whether to enable proxychains (TCP only, does not work with static binaries)\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
*Example:*
```nix
true
```
<a id="services-proxy-suite-perapprouting-proxychains-proxydns"></a> <a id="services-proxy-suite-perapprouting-proxychains-proxydns"></a>
## services\.proxy-suite\.perAppRouting\.proxychains\.proxyDns ## services\.proxy-suite\.perAppRouting\.proxychains\.proxyDns
Resolve DNS through the proxy (proxy_dns)\. Resolve DNS through the proxy\.
*Type:* **Type:** boolean\
boolean **Default:** `true`
*Default:*
```nix
true
```
<a id="services-proxy-suite-perapprouting-proxychains-quiet"></a> <a id="services-proxy-suite-perapprouting-proxychains-quiet"></a>
## services\.proxy-suite\.perAppRouting\.proxychains\.quiet ## services\.proxy-suite\.perAppRouting\.proxychains\.quiet
Silence proxychains (quiet_mode)\. Hide proxychains output\.
*Type:* **Type:** boolean\
boolean **Default:** `true`
*Default:*
```nix
true
```
<a id="services-proxy-suite-perapprouting-tproxy-enable"></a> <a id="services-proxy-suite-perapprouting-tproxy-enable"></a>
## services\.proxy-suite\.perAppRouting\.tproxy\.enable ## services\.proxy-suite\.perAppRouting\.tproxy\.enable
Whether to enable the per-app TProxy backend\. Whether to enable per-app TProxy\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
*Example:*
```nix
true
```
<a id="services-proxy-suite-perapprouting-tproxy-fwmark"></a> <a id="services-proxy-suite-perapprouting-tproxy-fwmark"></a>
## services\.proxy-suite\.perAppRouting\.tproxy\.fwmark ## services\.proxy-suite\.perAppRouting\.tproxy\.fwmark
Mark that steers wrapped apps into routeTable\. Firewall mark for wrapped apps’ traffic\.
*Type:* **Type:** signed integer\
signed integer **Default:** `17`
*Default:*
```nix
17
```
<a id="services-proxy-suite-perapprouting-tproxy-localsubnets"></a> <a id="services-proxy-suite-perapprouting-tproxy-localsubnets"></a>
## services\.proxy-suite\.perAppRouting\.tproxy\.localSubnets ## services\.proxy-suite\.perAppRouting\.tproxy\.localSubnets
Subnets that bypass interception (DNS excepted)\. Subnets that skip the proxy (DNS still goes through it)\.
*Type:* **Type:** list of string\
list of string **Default:** `[ "192.168.0.0/16" ]`\
**Example:** `[ "192.168.0.0/16" "10.0.0.0/8" ]`
*Default:*
```nix
[
"192.168.0.0/16"
]
```
*Example:*
```nix
[
"192.168.0.0/16"
"10.0.0.0/8"
]
```
<a id="services-proxy-suite-perapprouting-tproxy-routetable"></a> <a id="services-proxy-suite-perapprouting-tproxy-routetable"></a>
## services\.proxy-suite\.perAppRouting\.tproxy\.routeTable ## services\.proxy-suite\.perAppRouting\.tproxy\.routeTable
Policy-routing table of the per-app TProxy\. Routing table for the per-app TProxy\.
*Type:* **Type:** signed integer\
signed integer **Default:** `102`
*Default:*
```nix
102
```
<a id="services-proxy-suite-perapprouting-tun-enable"></a> <a id="services-proxy-suite-perapprouting-tun-enable"></a>
## services\.proxy-suite\.perAppRouting\.tun\.enable ## services\.proxy-suite\.perAppRouting\.tun\.enable
Whether to enable the per-app TUN backend\. Whether to enable per-app TUN\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
*Example:*
```nix
true
```
<a id="services-proxy-suite-perapprouting-tun-address"></a> <a id="services-proxy-suite-perapprouting-tun-address"></a>
## services\.proxy-suite\.perAppRouting\.tun\.address ## services\.proxy-suite\.perAppRouting\.tun\.address
Per-app TUN interface address (CIDR)\. Interface address (CIDR)\.
*Type:* **Type:** string\
string **Default:** `"172.20.0.1/30"`
*Default:*
```nix
"172.20.0.1/30"
```
<a id="services-proxy-suite-perapprouting-tun-fwmark"></a> <a id="services-proxy-suite-perapprouting-tun-fwmark"></a>
## services\.proxy-suite\.perAppRouting\.tun\.fwmark ## services\.proxy-suite\.perAppRouting\.tun\.fwmark
Mark that steers wrapped apps into routeTable\. Firewall mark for wrapped apps’ traffic\.
*Type:* **Type:** signed integer\
signed integer **Default:** `16`
*Default:*
```nix
16
```
<a id="services-proxy-suite-perapprouting-tun-interface"></a> <a id="services-proxy-suite-perapprouting-tun-interface"></a>
## services\.proxy-suite\.perAppRouting\.tun\.interface ## services\.proxy-suite\.perAppRouting\.tun\.interface
Per-app TUN interface name\. Interface name\.
*Type:* **Type:** string\
string **Default:** `"psperapptun0"`
*Default:*
```nix
"psperapptun0"
```
<a id="services-proxy-suite-perapprouting-tun-localsubnets"></a> <a id="services-proxy-suite-perapprouting-tun-localsubnets"></a>
## services\.proxy-suite\.perAppRouting\.tun\.localSubnets ## services\.proxy-suite\.perAppRouting\.tun\.localSubnets
Subnets wrapped apps reach directly (DNS excepted)\. Subnets that skip the proxy (DNS still goes through it)\.
*Type:* **Type:** list of string\
list of string **Default:** `[ "192.168.0.0/16" ]`\
**Example:** `[ "192.168.0.0/16" "10.0.0.0/8" ]`
*Default:*
```nix
[
"192.168.0.0/16"
]
```
*Example:*
```nix
[
"192.168.0.0/16"
"10.0.0.0/8"
]
```
<a id="services-proxy-suite-perapprouting-tun-mtu"></a> <a id="services-proxy-suite-perapprouting-tun-mtu"></a>
## services\.proxy-suite\.perAppRouting\.tun\.mtu ## services\.proxy-suite\.perAppRouting\.tun\.mtu
Per-app TUN interface MTU\. Interface MTU\.
*Type:* **Type:** signed integer\
signed integer **Default:** `1400`
*Default:*
```nix
1400
```
<a id="services-proxy-suite-perapprouting-tun-routetable"></a> <a id="services-proxy-suite-perapprouting-tun-routetable"></a>
## services\.proxy-suite\.perAppRouting\.tun\.routeTable ## services\.proxy-suite\.perAppRouting\.tun\.routeTable
Policy-routing table of the per-app TUN\. Routing table for the per-app TUN\.
*Type:* **Type:** signed integer\
signed integer **Default:** `101`
*Default:*
```nix
101
```
<a id="services-proxy-suite-perapprouting-zapret-enable"></a> <a id="services-proxy-suite-perapprouting-zapret-enable"></a>
## services\.proxy-suite\.perAppRouting\.zapret\.enable ## services\.proxy-suite\.perAppRouting\.zapret\.enable
Whether to enable the per-app zapret backend: a second zapret instance for wrapped apps only\. Whether to enable per-app zapret, a separate zapret for wrapped apps only\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
*Example:*
```nix
true
```
<a id="services-proxy-suite-perapprouting-zapret-filtermark"></a> <a id="services-proxy-suite-perapprouting-zapret-filtermark"></a>
## services\.proxy-suite\.perAppRouting\.zapret\.filterMark ## services\.proxy-suite\.perAppRouting\.zapret\.filterMark
Mark bit that selects wrapped app traffic\. Firewall mark bit for wrapped apps’ traffic\.
*Type:* **Type:** signed integer\
signed integer **Default:** `268435456`
*Default:*
```nix
268435456
```
<a id="services-proxy-suite-perapprouting-zapret-qnum"></a> <a id="services-proxy-suite-perapprouting-zapret-qnum"></a>
## services\.proxy-suite\.perAppRouting\.zapret\.qnum ## services\.proxy-suite\.perAppRouting\.zapret\.qnum
NFQUEUE number\. Must differ from the global instance’s\. NFQUEUE number\. Must differ from the global zapret’s\.
*Type:* **Type:** signed integer\
signed integer **Default:** `201`
*Default:*
```nix
201
```
+387 -1425
View File
File diff suppressed because it is too large. Load diff
+52 -200
View File
@@ -1,5 +1,7 @@
# services.proxy-suite.sshProxy # services.proxy-suite.sshProxy
An SSH SOCKS5 tunnel, optionally as an outbound.
Part of the [proxy-suite options reference](./index.md). Part of the [proxy-suite options reference](./index.md).
## Options ## Options
@@ -26,282 +28,132 @@ Part of the [proxy-suite options reference](./index.md).
<a id="services-proxy-suite-sshproxy-enable"></a> <a id="services-proxy-suite-sshproxy-enable"></a>
## services\.proxy-suite\.sshProxy\.enable ## services\.proxy-suite\.sshProxy\.enable
Whether to enable an SSH dynamic SOCKS5 tunnel\. Whether to enable an SSH SOCKS5 tunnel\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
*Example:*
```nix
true
```
<a id="services-proxy-suite-sshproxy-asoutbound"></a> <a id="services-proxy-suite-sshproxy-asoutbound"></a>
## services\.proxy-suite\.sshProxy\.asOutbound ## services\.proxy-suite\.sshProxy\.asOutbound
Add the tunnel as an outbound tagged “ssh-proxy”\. sing-box dials SSH itself; XRay goes Add the tunnel as an outbound tagged “ssh-proxy”\. On sing-box and hybrid, sing-box connects
through the OpenSSH unit’s SOCKS listener\. over SSH itself and needs ` hostKey ` or ` hostKeyFile `\. Otherwise OpenSSH runs a SOCKS listener, set up
by ` listener `, ` knownHostsFile `, ` strictHostKeyChecking `, ` serviceUser ` and ` extraArgs `\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
<a id="services-proxy-suite-sshproxy-domainstrategy"></a> <a id="services-proxy-suite-sshproxy-domainstrategy"></a>
## services\.proxy-suite\.sshProxy\.domainStrategy ## services\.proxy-suite\.sshProxy\.domainStrategy
Resolve destinations locally before the tunnel (XRay only)\. Can break geo-steered CDNs\. Resolve names locally instead of on the server (XRay only)\. Can make CDNs pick distant servers\.
*Type:* **Type:** null or one of “prefer_ipv4”, “prefer_ipv6”, “ipv4_only”, “ipv6_only”\
null or one of “prefer_ipv4”, “prefer_ipv6”, “ipv4_only”, “ipv6_only” **Default:** `null`\
**Example:** `"prefer_ipv4"`
*Default:*
```nix
null
```
*Example:*
```nix
"prefer_ipv4"
```
<a id="services-proxy-suite-sshproxy-extraargs"></a> <a id="services-proxy-suite-sshproxy-extraargs"></a>
## services\.proxy-suite\.sshProxy\.extraArgs ## services\.proxy-suite\.sshProxy\.extraArgs
Extra OpenSSH arguments\. Extra OpenSSH arguments\.
*Type:* **Type:** list of string\
list of string **Default:** `[ ]`\
**Example:** `[ "-J" "jump.example.com" ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
"-J"
"jump.example.com"
]
```
<a id="services-proxy-suite-sshproxy-hostkey"></a> <a id="services-proxy-suite-sshproxy-hostkey"></a>
## services\.proxy-suite\.sshProxy\.hostKey ## services\.proxy-suite\.sshProxy\.hostKey
Accepted host keys (sing-box)\. List every key ` ssh-keyscan ` prints: the algorithm is Accepted host keys, for sing-box\. List every key ` ssh-keyscan ` prints, since the key type
negotiated\. Empty accepts any key\. is negotiated\.
*Type:* **Type:** list of string\
list of string **Default:** `[ ]`\
**Example:** `[ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI..." ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI..."
]
```
<a id="services-proxy-suite-sshproxy-hostkeyfile"></a> <a id="services-proxy-suite-sshproxy-hostkeyfile"></a>
## services\.proxy-suite\.sshProxy\.hostKeyFile ## services\.proxy-suite\.sshProxy\.hostKeyFile
Known-hosts file to read hostKey from at runtime (sing-box)\. Wins over hostKey\. Known-hosts file to read host keys from (sing-box)\. Takes priority over ` hostKey `\.
*Type:* **Type:** null or string\
null or string **Default:** `null`\
**Example:** `"/root/.ssh/known_hosts"`
*Default:*
```nix
null
```
*Example:*
```nix
"/root/.ssh/known_hosts"
```
<a id="services-proxy-suite-sshproxy-identityfile"></a> <a id="services-proxy-suite-sshproxy-identityfile"></a>
## services\.proxy-suite\.sshProxy\.identityFile ## services\.proxy-suite\.sshProxy\.identityFile
Runtime path to the private key; it may stay root-only, as the daemons get a copy they can read\. Null uses the agent or OpenSSH defaults\. File with the SSH private key\. It can stay root-only\. ` null `: the agent or OpenSSH defaults\.
*Type:* **Type:** null or string\
null or string **Default:** `null`\
**Example:** `"/run/secrets/proxy-suite-ssh-key"`
*Default:*
```nix
null
```
*Example:*
```nix
"/run/secrets/proxy-suite-ssh-key"
```
<a id="services-proxy-suite-sshproxy-knownhostsfile"></a> <a id="services-proxy-suite-sshproxy-knownhostsfile"></a>
## services\.proxy-suite\.sshProxy\.knownHostsFile ## services\.proxy-suite\.sshProxy\.knownHostsFile
Known-hosts file for OpenSSH\. Known-hosts file for OpenSSH\.
*Type:* **Type:** null or string\
null or string **Default:** `null`\
**Example:** `"/run/secrets/proxy-suite-ssh-known-hosts"`
*Default:*
```nix
null
```
*Example:*
```nix
"/run/secrets/proxy-suite-ssh-known-hosts"
```
<a id="services-proxy-suite-sshproxy-listener-address"></a> <a id="services-proxy-suite-sshproxy-listener-address"></a>
## services\.proxy-suite\.sshProxy\.listener\.address ## services\.proxy-suite\.sshProxy\.listener\.address
Address of the OpenSSH SOCKS5 listener\. Address of the OpenSSH SOCKS5 listener\.
*Type:* **Type:** string matching the pattern \[^\[:space:]]+\
string matching the pattern \[^\[:space:]]+ **Default:** `"127.0.0.1"`
*Default:*
```nix
"127.0.0.1"
```
<a id="services-proxy-suite-sshproxy-listener-port"></a> <a id="services-proxy-suite-sshproxy-listener-port"></a>
## services\.proxy-suite\.sshProxy\.listener\.port ## services\.proxy-suite\.sshProxy\.listener\.port
Port of the OpenSSH SOCKS5 listener\. Port of the OpenSSH SOCKS5 listener\.
*Type:* **Type:** 16 bit unsigned integer; between 0 and 65535 (both inclusive)\
16 bit unsigned integer; between 0 and 65535 (both inclusive) **Default:** `1091`
*Default:*
```nix
1091
```
<a id="services-proxy-suite-sshproxy-server-host"></a> <a id="services-proxy-suite-sshproxy-server-host"></a>
## services\.proxy-suite\.sshProxy\.server\.host ## services\.proxy-suite\.sshProxy\.server\.host
SSH server\. SSH server\.
*Type:* **Type:** null or string matching the pattern \[^\[:space:]]+\
null or string matching the pattern \[^\[:space:]]+ **Default:** `null`\
**Example:** `"ssh.example.com"`
*Default:*
```nix
null
```
*Example:*
```nix
"ssh.example.com"
```
<a id="services-proxy-suite-sshproxy-server-port"></a> <a id="services-proxy-suite-sshproxy-server-port"></a>
## services\.proxy-suite\.sshProxy\.server\.port ## services\.proxy-suite\.sshProxy\.server\.port
SSH server port\. SSH server port\.
*Type:* **Type:** 16 bit unsigned integer; between 0 and 65535 (both inclusive)\
16 bit unsigned integer; between 0 and 65535 (both inclusive) **Default:** `22`
*Default:*
```nix
22
```
<a id="services-proxy-suite-sshproxy-server-user"></a> <a id="services-proxy-suite-sshproxy-server-user"></a>
## services\.proxy-suite\.sshProxy\.server\.user ## services\.proxy-suite\.sshProxy\.server\.user
SSH login user\. SSH login user\.
*Type:* **Type:** null or string matching the pattern \[^\[:space:]]+\
null or string matching the pattern \[^\[:space:]]+ **Default:** `null`\
**Example:** `"root"`
*Default:*
```nix
null
```
*Example:*
```nix
"root"
```
<a id="services-proxy-suite-sshproxy-serviceuser"></a> <a id="services-proxy-suite-sshproxy-serviceuser"></a>
## services\.proxy-suite\.sshProxy\.serviceUser ## services\.proxy-suite\.sshProxy\.serviceUser
Unix user running the OpenSSH unit\. The default, proxy-suite-daemon, runs sandboxed and keeps accepted host keys in /var/lib/proxy-suite/ssh; null runs it as root\. User that runs OpenSSH\. The default is sandboxed; ` null ` runs it as root\.
*Type:* **Type:** null or string matching the pattern \[^\[:space:]]+\
null or string matching the pattern \[^\[:space:]]+ **Default:** `"proxy-suite-daemon"`\
**Example:** `"proxy"`
*Default:*
```nix
"proxy-suite-daemon"
```
*Example:*
```nix
"proxy"
```
<a id="services-proxy-suite-sshproxy-stricthostkeychecking"></a> <a id="services-proxy-suite-sshproxy-stricthostkeychecking"></a>
## services\.proxy-suite\.sshProxy\.strictHostKeyChecking ## services\.proxy-suite\.sshProxy\.strictHostKeyChecking
OpenSSH host key policy\. OpenSSH host key policy\.
*Type:* **Type:** one of “yes”, “accept-new”, “no”\
one of “yes”, “accept-new”, “no” **Default:** `"accept-new"`\
**Example:** `"yes"`
*Default:*
```nix
"accept-new"
```
*Example:*
```nix
"yes"
```
+64 -223
View File
@@ -1,5 +1,7 @@
# services.proxy-suite.tgWsProxy # services.proxy-suite.tgWsProxy
A Telegram MTProto proxy over WebSocket.
Part of the [proxy-suite options reference](./index.md). Part of the [proxy-suite options reference](./index.md).
## Options ## Options
@@ -31,319 +33,158 @@ Part of the [proxy-suite options reference](./index.md).
<a id="services-proxy-suite-tgwsproxy-enable"></a> <a id="services-proxy-suite-tgwsproxy-enable"></a>
## services\.proxy-suite\.tgWsProxy\.enable ## services\.proxy-suite\.tgWsProxy\.enable
Whether to enable the Telegram MTProto WebSocket proxy\. Whether to enable the Telegram WebSocket proxy (MTProto)\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
*Example:*
```nix
true
```
<a id="services-proxy-suite-tgwsproxy-bufferkib"></a> <a id="services-proxy-suite-tgwsproxy-bufferkib"></a>
## services\.proxy-suite\.tgWsProxy\.bufferKiB ## services\.proxy-suite\.tgWsProxy\.bufferKiB
Socket buffer size, in KiB\. Socket buffer size, in KiB\.
*Type:* **Type:** integer between 4 and 2147483647 (both inclusive)\
integer between 4 and 2147483647 (both inclusive) **Default:** `256`
*Default:*
```nix
256
```
<a id="services-proxy-suite-tgwsproxy-bypasstransparentproxy"></a> <a id="services-proxy-suite-tgwsproxy-bypasstransparentproxy"></a>
## services\.proxy-suite\.tgWsProxy\.bypassTransparentProxy ## services\.proxy-suite\.tgWsProxy\.bypassTransparentProxy
Keep the relay’s own connections out of TUN/TProxy, which would otherwise loop them\. Keep the relay’s own connections out of TUN and TProxy, so they do not loop\.
*Type:* **Type:** boolean\
boolean **Default:** `true`
*Default:*
```nix
true
```
<a id="services-proxy-suite-tgwsproxy-cloudflare-domains"></a> <a id="services-proxy-suite-tgwsproxy-cloudflare-domains"></a>
## services\.proxy-suite\.tgWsProxy\.cloudflare\.domains ## services\.proxy-suite\.tgWsProxy\.cloudflare\.domains
Cloudflare-proxied domains for WebSocket fallback\. Domains behind Cloudflare to fall back to\.
*Type:* **Type:** list of string\
list of string **Default:** `[ ]`\
**Example:** `[ "cdn.example.com" ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
"cdn.example.com"
]
```
<a id="services-proxy-suite-tgwsproxy-cloudflare-fallback"></a> <a id="services-proxy-suite-tgwsproxy-cloudflare-fallback"></a>
## services\.proxy-suite\.tgWsProxy\.cloudflare\.fallback ## services\.proxy-suite\.tgWsProxy\.cloudflare\.fallback
Fall back to Cloudflare when direct WebSocket fails\. Fall back to Cloudflare when a direct WebSocket fails\.
*Type:* **Type:** boolean\
boolean **Default:** `true`
*Default:*
```nix
true
```
<a id="services-proxy-suite-tgwsproxy-cloudflare-workerdomains"></a> <a id="services-proxy-suite-tgwsproxy-cloudflare-workerdomains"></a>
## services\.proxy-suite\.tgWsProxy\.cloudflare\.workerDomains ## services\.proxy-suite\.tgWsProxy\.cloudflare\.workerDomains
Cloudflare Worker domains, tried first\. Cloudflare Worker domains, tried first\.
*Type:* **Type:** list of string\
list of string **Default:** `[ ]`\
**Example:** `[ "worker.example.com" ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
"worker.example.com"
]
```
<a id="services-proxy-suite-tgwsproxy-dcips"></a> <a id="services-proxy-suite-tgwsproxy-dcips"></a>
## services\.proxy-suite\.tgWsProxy\.dcIps ## services\.proxy-suite\.tgWsProxy\.dcIps
Relay IP per Telegram DC ID\. Relay IP for each Telegram DC ID\.
*Type:* **Type:** attribute set of string\
attribute set of string **Default:** `{ }`\
**Example:** `{ "2" = "149.154.167.220"; }`
*Default:*
```nix
{ }
```
*Example:*
```nix
{
"2" = "149.154.167.220";
}
```
<a id="services-proxy-suite-tgwsproxy-faketlsdomain"></a> <a id="services-proxy-suite-tgwsproxy-faketlsdomain"></a>
## services\.proxy-suite\.tgWsProxy\.fakeTlsDomain ## services\.proxy-suite\.tgWsProxy\.fakeTlsDomain
SNI for Fake TLS masking (ee-secret links)\. Domain to disguise traffic as, with Fake TLS (ee-secret links)\.
*Type:* **Type:** null or string matching the pattern \.+\
null or string matching the pattern \.+ **Default:** `null`\
**Example:** `"www.example.com"`
*Default:*
```nix
null
```
*Example:*
```nix
"www.example.com"
```
<a id="services-proxy-suite-tgwsproxy-fwmark"></a> <a id="services-proxy-suite-tgwsproxy-fwmark"></a>
## services\.proxy-suite\.tgWsProxy\.fwmark ## services\.proxy-suite\.tgWsProxy\.fwmark
Packet mark bypassTransparentProxy uses\. Firewall mark for ` bypassTransparentProxy `\.
*Type:* **Type:** signed integer\
signed integer **Default:** `4`
*Default:*
```nix
4
```
<a id="services-proxy-suite-tgwsproxy-listener-address"></a> <a id="services-proxy-suite-tgwsproxy-listener-address"></a>
## services\.proxy-suite\.tgWsProxy\.listener\.address ## services\.proxy-suite\.tgWsProxy\.listener\.address
Bind address\. Listening address\.
*Type:* **Type:** string\
string **Default:** `"127.0.0.1"`
*Default:*
```nix
"127.0.0.1"
```
<a id="services-proxy-suite-tgwsproxy-listener-port"></a> <a id="services-proxy-suite-tgwsproxy-listener-port"></a>
## services\.proxy-suite\.tgWsProxy\.listener\.port ## services\.proxy-suite\.tgWsProxy\.listener\.port
Listen port\. Listening port\.
*Type:* **Type:** 16 bit unsigned integer; between 0 and 65535 (both inclusive)\
16 bit unsigned integer; between 0 and 65535 (both inclusive) **Default:** `1443`
*Default:*
```nix
1443
```
<a id="services-proxy-suite-tgwsproxy-log-file"></a> <a id="services-proxy-suite-tgwsproxy-log-file"></a>
## services\.proxy-suite\.tgWsProxy\.log\.file ## services\.proxy-suite\.tgWsProxy\.log\.file
Rotating log file, written as the proxy-suite-daemon user; /var/log/proxy-suite-tg-ws-proxy is created for it\. Null logs to stderr\. Log file, rotated\. ` null `: log to the journal\.
*Type:* **Type:** null or string\
null or string **Default:** `null`\
**Example:** `"/var/log/proxy-suite-tg-ws-proxy/tg-ws-proxy.log"`
*Default:*
```nix
null
```
*Example:*
```nix
"/var/log/proxy-suite-tg-ws-proxy/tg-ws-proxy.log"
```
<a id="services-proxy-suite-tgwsproxy-log-keep"></a> <a id="services-proxy-suite-tgwsproxy-log-keep"></a>
## services\.proxy-suite\.tgWsProxy\.log\.keep ## services\.proxy-suite\.tgWsProxy\.log\.keep
Rotated logs kept\. Number of rotated logs to keep\.
*Type:* **Type:** positive integer, meaning >0\
positive integer, meaning >0 **Default:** `1`
*Default:*
```nix
1
```
<a id="services-proxy-suite-tgwsproxy-log-maxsizemib"></a> <a id="services-proxy-suite-tgwsproxy-log-maxsizemib"></a>
## services\.proxy-suite\.tgWsProxy\.log\.maxSizeMiB ## services\.proxy-suite\.tgWsProxy\.log\.maxSizeMiB
Log size before rotation, in MiB\. Rotate the log at this size, in MiB\.
*Type:* **Type:** positive integer or floating point number, meaning >0\
positive integer or floating point number, meaning >0 **Default:** `5.0`
*Default:*
```nix
5.0
```
<a id="services-proxy-suite-tgwsproxy-log-verbose"></a> <a id="services-proxy-suite-tgwsproxy-log-verbose"></a>
## services\.proxy-suite\.tgWsProxy\.log\.verbose ## services\.proxy-suite\.tgWsProxy\.log\.verbose
Debug logging\. Log debug messages\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
<a id="services-proxy-suite-tgwsproxy-poolsize"></a> <a id="services-proxy-suite-tgwsproxy-poolsize"></a>
## services\.proxy-suite\.tgWsProxy\.poolSize ## services\.proxy-suite\.tgWsProxy\.poolSize
WebSocket pool size per DC; 0 disables pooling\. Idle WebSockets kept open per DC\. 0 disables\.
*Type:* **Type:** unsigned integer, meaning >=0\
unsigned integer, meaning >=0 **Default:** `4`
*Default:*
```nix
4
```
<a id="services-proxy-suite-tgwsproxy-proxyprotocol"></a> <a id="services-proxy-suite-tgwsproxy-proxyprotocol"></a>
## services\.proxy-suite\.tgWsProxy\.proxyProtocol ## services\.proxy-suite\.tgWsProxy\.proxyProtocol
Accept a PROXY protocol v1 header from a fronting reverse proxy\. Accept a PROXY protocol v1 header from a reverse proxy in front\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
<a id="services-proxy-suite-tgwsproxy-secret"></a> <a id="services-proxy-suite-tgwsproxy-secret"></a>
## services\.proxy-suite\.tgWsProxy\.secret ## services\.proxy-suite\.tgWsProxy\.secret
Inline MTProto secret (` openssl rand -hex 16 `)\. Ends up in the Nix store; prefer secretFile\. MTProto secret (` openssl rand -hex 16 `)\. Ends up in the Nix store; prefer ` secretFile `\.
*Type:* **Type:** null or string\
null or string **Default:** `null`\
**Example:** `"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"`
*Default:*
```nix
null
```
*Example:*
```nix
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
```
<a id="services-proxy-suite-tgwsproxy-secretfile"></a> <a id="services-proxy-suite-tgwsproxy-secretfile"></a>
## services\.proxy-suite\.tgWsProxy\.secretFile ## services\.proxy-suite\.tgWsProxy\.secretFile
Runtime path to the MTProto secret\. File with the MTProto secret\.
*Type:* **Type:** null or string\
null or string **Default:** `null`\
**Example:** `"/run/secrets/tg-ws-proxy-secret"`
*Default:*
```nix
null
```
*Example:*
```nix
"/run/secrets/tg-ws-proxy-secret"
```
+62 -187
View File
@@ -1,5 +1,7 @@
# services.proxy-suite.tor # services.proxy-suite.tor
Tor as an outbound, with bridges, and an onion service for the inbounds.
Part of the [proxy-suite options reference](./index.md). Part of the [proxy-suite options reference](./index.md).
## Options ## Options
@@ -26,90 +28,47 @@ Part of the [proxy-suite options reference](./index.md).
<a id="services-proxy-suite-tor-enable"></a> <a id="services-proxy-suite-tor-enable"></a>
## services\.proxy-suite\.tor\.enable ## services\.proxy-suite\.tor\.enable
Whether to enable the Tor daemon (proxy-suite-tor)\. Run Tor\. Also turn on ` asOutbound `, ` onionService.enable `, or both\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
*Example:*
```nix
true
```
<a id="services-proxy-suite-tor-package"></a> <a id="services-proxy-suite-tor-package"></a>
## services\.proxy-suite\.tor\.package ## services\.proxy-suite\.tor\.package
Tor package\. Tor package\.
*Type:* **Type:** package\
package **Default:** `pkgs.tor`
*Default:*
```nix
pkgs.tor
```
<a id="services-proxy-suite-tor-asoutbound"></a> <a id="services-proxy-suite-tor-asoutbound"></a>
## services\.proxy-suite\.tor\.asOutbound ## services\.proxy-suite\.tor\.asOutbound
Add Tor as an outbound tagged “tor”: a SOCKS hop to proxy-suite-tor on 127\.0\.0\.1:socksPort, Add Tor as an outbound tagged “tor”\. Selection and autoProxy skip it unless it is the only
which receives names unresolved\. proxy\.selection and autoProxy leave it alone unless it is the outbound; send traffic to it with ` proxy.routing.rules ` or use it as a ` detour `\.
only outbound; route to it with proxy\.routing\.rules or name it as a detour\. Requires proxy\.enable\. Needs ` proxy.enable `\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
<a id="services-proxy-suite-tor-bridges-file"></a> <a id="services-proxy-suite-tor-bridges-file"></a>
## services\.proxy-suite\.tor\.bridges\.file ## services\.proxy-suite\.tor\.bridges\.file
Runtime path to more bridge lines, one per line; blank lines and \# comments are skipped\. File with more bridge lines, one per line\. Blank lines and \# comments are skipped\.
*Type:* **Type:** null or string\
null or string **Default:** `null`\
**Example:** `"/run/secrets/tor-bridges"`
*Default:*
```nix
null
```
*Example:*
```nix
"/run/secrets/tor-bridges"
```
<a id="services-proxy-suite-tor-bridges-lines"></a> <a id="services-proxy-suite-tor-bridges-lines"></a>
## services\.proxy-suite\.tor\.bridges\.lines ## services\.proxy-suite\.tor\.bridges\.lines
Bridge lines, as https://bridges\.torproject\.org hands them out, without the leading Bridge lines from https://bridges\.torproject\.org, without the leading “Bridge”\. Setting
“Bridge”\. Any given turns on UseBridges; obfs4, webtunnel, meek_lite and snowflake any turns bridges on\.
transports are run as needed\.
*Type:* **Type:** list of string\
list of string **Default:** `[ ]`\
**Example:**
*Default:*
```nix
[ ]
```
*Example:*
```nix ```nix
[ [
@@ -120,34 +79,20 @@ list of string
<a id="services-proxy-suite-tor-clientonly"></a> <a id="services-proxy-suite-tor-clientonly"></a>
## services\.proxy-suite\.tor\.clientOnly ## services\.proxy-suite\.tor\.clientOnly
Keep Tor a client (ClientOnly 1): never a relay, exit, bridge or directory server, even when Keep Tor a client, never a relay, even if ` extraConfig ` sets an ORPort\. The onion service
extraConfig sets an ORPort\. The onion service works either way\. Turn off only to run a relay works either way\. Turn off only to run a relay through ` extraConfig `\.
through extraConfig\.
*Type:* **Type:** boolean\
boolean **Default:** `true`
*Default:*
```nix
true
```
<a id="services-proxy-suite-tor-extraconfig"></a> <a id="services-proxy-suite-tor-extraconfig"></a>
## services\.proxy-suite\.tor\.extraConfig ## services\.proxy-suite\.tor\.extraConfig
Lines appended to the generated torrc\. Extra torrc lines\.
*Type:* **Type:** strings concatenated with “\\n”\
strings concatenated with “\\n” **Default:** `""`\
**Example:**
*Default:*
```nix
""
```
*Example:*
```nix ```nix
'' ''
@@ -159,144 +104,74 @@ strings concatenated with “\\n”
<a id="services-proxy-suite-tor-lyrebirdpackage"></a> <a id="services-proxy-suite-tor-lyrebirdpackage"></a>
## services\.proxy-suite\.tor\.lyrebirdPackage ## services\.proxy-suite\.tor\.lyrebirdPackage
Pluggable transport for obfs4, webtunnel and meek_lite bridges\. Bridge transport for obfs4, webtunnel and meek_lite\.
*Type:* **Type:** package\
package **Default:** `pkgs.lyrebird`
*Default:*
```nix
pkgs.lyrebird
```
<a id="services-proxy-suite-tor-onionservice-enable"></a> <a id="services-proxy-suite-tor-onionservice-enable"></a>
## services\.proxy-suite\.tor\.onionService\.enable ## services\.proxy-suite\.tor\.onionService\.enable
Whether to enable an onion service in front of inbounds\.listeners\. Whether to enable an onion service for the server inbounds\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
*Example:*
```nix
true
```
<a id="services-proxy-suite-tor-onionservice-listeners"></a> <a id="services-proxy-suite-tor-onionservice-listeners"></a>
## services\.proxy-suite\.tor\.onionService\.listeners ## services\.proxy-suite\.tor\.onionService\.listeners
inbounds\.listeners served at the onion address, each on its share port\. Null takes every Listeners reachable through the onion address\. ` null `: every TCP listener (not
listener a TCP-only onion can carry: not amneziawg, h3-only xhttp or raw JSON\. amneziawg, h3-only xhttp or raw JSON)\.
Share links for them (` proxy-ctl inbounds link TAG --onion `, and subscriptions) dial the Get their links with ` proxy-ctl inbounds link TAG --onion `; subscriptions include them\.
\.onion address and keep the listener’s TLS and REALITY names\. Clients reach XRay from Onion clients do not show up in ` proxy-ctl inbounds online `\.
127\.0\.0\.1, so ` proxy-ctl inbounds online ` does not list them\.
*Type:* **Type:** null or (list of string)\
null or (list of string) **Default:** `null`\
**Example:** `[ "vless-reality" ]`
*Default:*
```nix
null
```
*Example:*
```nix
[
"vless-reality"
]
```
<a id="services-proxy-suite-tor-onionservice-secretkeyfile"></a> <a id="services-proxy-suite-tor-onionservice-secretkeyfile"></a>
## services\.proxy-suite\.tor\.onionService\.secretKeyFile ## services\.proxy-suite\.tor\.onionService\.secretKeyFile
Runtime path to an hs_ed25519_secret_key, to keep an onion address\. Null lets Tor create File with an hs_ed25519_secret_key, to keep a fixed onion address\. ` null `: Tor creates one\.
one in /var/lib/proxy-suite/tor/onion\.
*Type:* **Type:** null or string\
null or string **Default:** `null`\
**Example:** `"/run/secrets/tor-hs_ed25519_secret_key"`
*Default:*
```nix
null
```
*Example:*
```nix
"/run/secrets/tor-hs_ed25519_secret_key"
```
<a id="services-proxy-suite-tor-routeonion"></a> <a id="services-proxy-suite-tor-routeonion"></a>
## services\.proxy-suite\.tor\.routeOnion ## services\.proxy-suite\.tor\.routeOnion
Send \.onion names to the “tor” outbound in every route mode, and keep them away from DNS: Send \.onion names to the “tor” outbound in every route mode, and never resolve them with
in TUN and TProxy modes sing-box answers them with a fake address it maps back to the name, DNS\. Inbound clients’ \.onion names go there too\. Needs ` asOutbound `\.
and XRay drops the lookup\. Inbound clients’ \.onion names go the same way, through the local
proxy, whatever their listener’s via (except “block”)\. Applies with asOutbound\.
*Type:* **Type:** boolean\
boolean **Default:** `true`
*Default:*
```nix
true
```
<a id="services-proxy-suite-tor-snowflakepackage"></a> <a id="services-proxy-suite-tor-snowflakepackage"></a>
## services\.proxy-suite\.tor\.snowflakePackage ## services\.proxy-suite\.tor\.snowflakePackage
Pluggable transport for snowflake bridges\. Bridge transport for snowflake\.
*Type:* **Type:** package\
package **Default:** `pkgs.snowflake`
*Default:*
```nix
pkgs.snowflake
```
<a id="services-proxy-suite-tor-socksport"></a> <a id="services-proxy-suite-tor-socksport"></a>
## services\.proxy-suite\.tor\.socksPort ## services\.proxy-suite\.tor\.socksPort
Loopback SOCKS port of proxy-suite-tor, which the tor outbound dials\. Loopback SOCKS port of Tor\.
*Type:* **Type:** 16 bit unsigned integer; between 0 and 65535 (both inclusive)\
16 bit unsigned integer; between 0 and 65535 (both inclusive) **Default:** `18530`
*Default:*
```nix
18530
```
<a id="services-proxy-suite-tor-upstream"></a> <a id="services-proxy-suite-tor-upstream"></a>
## services\.proxy-suite\.tor\.upstream ## services\.proxy-suite\.tor\.upstream
How Tor reaches its relays or bridges\. How Tor reaches the network\.
- “direct”: from the uplink, past TUN and TProxy (it runs as proxy-suite-daemon)\. - “direct”: straight from the uplink, bypassing TUN and TProxy\.
- “proxy”: through the local proxy listener (proxy\.listener, with its auth), for a network - “proxy”: through the local proxy, for networks that block Tor\. Works with obfs4,
that blocks Tor\. obfs4, webtunnel and meek_lite bridges follow it; snowflake cannot\. webtunnel and meek_lite bridges, but not snowflake\.
*Type:* **Type:** one of “direct”, “proxy”\
one of “direct”, “proxy” **Default:** `"direct"`
*Default:*
```nix
"direct"
```
+5 -15
View File
@@ -1,5 +1,7 @@
# services.proxy-suite.tui # services.proxy-suite.tui
The `proxy-tui` terminal UI.
Part of the [proxy-suite options reference](./index.md). Part of the [proxy-suite options reference](./index.md).
## Options ## Options
@@ -10,19 +12,7 @@ Part of the [proxy-suite options reference](./index.md).
<a id="services-proxy-suite-tui-enable"></a> <a id="services-proxy-suite-tui-enable"></a>
## services\.proxy-suite\.tui\.enable ## services\.proxy-suite\.tui\.enable
Whether to enable proxy-tui, an interactive terminal UI for everything proxy-ctl controls at runtime\. Whether to enable proxy-tui, a terminal UI\.
*Type:* **Type:** boolean\
boolean **Default:** `true`
*Default:*
```nix
true
```
*Example:*
```nix
true
```
+19 -49
View File
@@ -1,5 +1,7 @@
# services.proxy-suite.userControl # services.proxy-suite.userControl
Let a group use `proxy-ctl` without root.
Part of the [proxy-suite options reference](./index.md). Part of the [proxy-suite options reference](./index.md).
## Options ## Options
@@ -12,66 +14,34 @@ Part of the [proxy-suite options reference](./index.md).
<a id="services-proxy-suite-usercontrol-enable"></a> <a id="services-proxy-suite-usercontrol-enable"></a>
## services\.proxy-suite\.userControl\.enable ## services\.proxy-suite\.userControl\.enable
Whether to enable passwordless ` proxy-ctl ` control for the members of userControl\.group\. Whether to enable ` proxy-ctl ` without root for members of ` userControl.group `\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
*Example:*
```nix
true
```
<a id="services-proxy-suite-usercontrol-group"></a> <a id="services-proxy-suite-usercontrol-group"></a>
## services\.proxy-suite\.userControl\.group ## services\.proxy-suite\.userControl\.group
Group whose members may run privileged ` proxy-ctl ` commands without a password\. Group whose members can run privileged ` proxy-ctl ` commands\.
*Type:* **Type:** string matching the pattern ^\[a-z_]\[a-z0-9_-]\*$\
string matching the pattern ^\[a-z_]\[a-z0-9_-]\*$ **Default:** `"proxy-suite"`
*Default:*
```nix
"proxy-suite"
```
<a id="services-proxy-suite-usercontrol-scopes"></a> <a id="services-proxy-suite-usercontrol-scopes"></a>
## services\.proxy-suite\.userControl\.scopes ## services\.proxy-suite\.userControl\.scopes
What userControl\.group may do; empty allows every scope\. What the group may do\. Empty allows everything\.
- “services”: turn the proxy-suite units on and off (proxy, tun, tproxy, zapret, ssh, warp, tor, tg, awg, inbounds), ` restart `, and ` tor status|newnym ` on Tor’s control socket\. - “services”: start, stop and restart services, and ` tor newnym `\.
- “perApp”: the per-app backend units used by ` proxy-ctl apps run `\. - “perApp”: ` proxy-ctl apps run `\.
- “routing”: ` proxy pin `, ` proxy unpin ` and ` proxy mode `\. - “routing”: ` proxy pin `, ` proxy unpin ` and ` proxy mode `\.
- “outbounds”: add and remove runtime outbounds and subscriptions, disable and enable outbounds, and update subscriptions\. - “outbounds”: add, remove, enable and disable outbounds and subscriptions\.
- “secrets”: read share links, subscription URLs and the running configs\. - “secrets”: read share links, subscription URLs and running configs\.
- “autoProxy”: read what autoProxy learned, and ` proxy auto learn|forget|relearn|clear `\. - “autoProxy”: see and change what autoProxy learned\.
- “zapret”: edit zapret2’s learned hosts, and ` zapret cutoff probe `\. - “zapret”: change zapret2’s learned sites, and ` zapret cutoff probe `\.
- “stats”: ` inbounds stats `\. - “stats”: ` inbounds stats `\.
- “whitelistBypass”: the whitelist-bypass creators and joiners: ` wl on|off|toggle|restart `, their calls (` wl link `), and their logins and links (` wl auth|join|new `)\. - “whitelistBypass”: everything under ` proxy-ctl wl `\.
*Type:* **Type:** list of (one of “services”, “perApp”, “routing”, “outbounds”, “secrets”, “autoProxy”, “zapret”, “stats”, “whitelistBypass”)\
list of (one of “services”, “perApp”, “routing”, “outbounds”, “secrets”, “autoProxy”, “zapret”, “stats”, “whitelistBypass”) **Default:** `[ ]`\
**Example:** `[ "services" "routing" ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
"services"
"routing"
]
```
+34 -97
View File
@@ -1,5 +1,7 @@
# services.proxy-suite.warp # services.proxy-suite.warp
Cloudflare WARP, as an outbound or an AmneziaWG profile.
Part of the [proxy-suite options reference](./index.md). Part of the [proxy-suite options reference](./index.md).
## Options ## Options
@@ -15,130 +17,65 @@ Part of the [proxy-suite options reference](./index.md).
<a id="services-proxy-suite-warp-enable"></a> <a id="services-proxy-suite-warp-enable"></a>
## services\.proxy-suite\.warp\.enable ## services\.proxy-suite\.warp\.enable
Whether to enable Cloudflare WARP\. Run Cloudflare WARP\. Also set ` asOutbound ` or ` asAmneziaWg `\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
*Example:*
```nix
true
```
<a id="services-proxy-suite-warp-asamneziawg"></a> <a id="services-proxy-suite-warp-asamneziawg"></a>
## services\.proxy-suite\.warp\.asAmneziaWg ## services\.proxy-suite\.warp\.asAmneziaWg
Add an AmneziaWG profile named “warp” (` proxy-ctl awg on warp `)\. Requires amneziaWg\.enable, Add a global AmneziaWG profile named “warp” (` proxy-ctl awg on warp `)\. Needs
and excludes asOutbound: both would use the same WARP key\. ` amneziaWg.enable `\. Cannot be used with ` asOutbound `\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
<a id="services-proxy-suite-warp-asoutbound"></a> <a id="services-proxy-suite-warp-asoutbound"></a>
## services\.proxy-suite\.warp\.asOutbound ## services\.proxy-suite\.warp\.asOutbound
Add WARP as an outbound tagged “warp”\. Add WARP as an outbound tagged “warp”\.
- “singBox”: a SOCKS hop to proxy-suite-warp-tunnel, which runs WARP as a sing-box WireGuard - “singBox”: plain WireGuard in sing-box, ignoring AmneziaWG fields\. Restarts itself when
endpoint on 127\.0\.0\.1:18538, as the proxy-suite-daemon user\. The tunnel starts again on a WARP stops answering\.
new source port when WARP does not answer within 15 seconds of a start, or misses three - “userspace”: an AmneziaWG profile, without root\. Needs ` amneziaWg.enable `\.
probes later on, unless the uplink itself is down\. - “interface”: an AmneziaWG profile with its own interface\. Needs ` amneziaWg.enable `\.
- “userspace”: an AmneziaWG profile named “warp” with asOutbound = “userspace”, which honours
the AmneziaWG lines of the profile without an interface or root\. Requires amneziaWg\.enable\.
- “interface”: an AmneziaWG profile named “warp” with asOutbound = “interface”, which honours
the AmneziaWG lines of the profile\. Requires amneziaWg\.enable\.
*Type:* **Type:** null or one of “singBox”, “userspace”, “interface”\
null or one of “singBox”, “userspace”, “interface” **Default:** `null`
*Default:*
```nix
null
```
<a id="services-proxy-suite-warp-configfile"></a> <a id="services-proxy-suite-warp-configfile"></a>
## services\.proxy-suite\.warp\.configFile ## services\.proxy-suite\.warp\.configFile
Runtime path to a WireGuard profile for WARP, as written by ` wgcf register && wgcf generate `\. File with a WARP WireGuard profile, from ` wgcf register && wgcf generate `\. AmneziaWG
AmneziaWG lines (Jc, S1-S4, H1-H4, I1-I5, AWG 3 timing) are honoured by the AmneziaWG profile fields in it only take effect in the AmneziaWG modes\.
(asAmneziaWg, asOutbound = “interface”) only\.
When null, proxy-suite-warp registers a device with wgcf (accepting Cloudflare’s terms) ` null `: register a new device with wgcf on first start (accepting Cloudflare’s terms),
into /var/lib/proxy-suite/warp, through the local proxy when proxy\.enable is set, and through the local proxy if enabled\. WARP does not work until that succeeds\.
retries until it succeeds\. Until then warp connections fail\.
*Type:* **Type:** null or string\
null or string **Default:** `null`\
**Example:** `"/run/secrets/wgcf-profile.conf"`
*Default:*
```nix
null
```
*Example:*
```nix
"/run/secrets/wgcf-profile.conf"
```
<a id="services-proxy-suite-warp-endpoint"></a> <a id="services-proxy-suite-warp-endpoint"></a>
## services\.proxy-suite\.warp\.endpoint ## services\.proxy-suite\.warp\.endpoint
host:port that replaces the profile’s Endpoint (IPv6 in brackets), for when the default host:port (IPv6 in brackets) to use instead of the profile’s endpoint, if the default one
engage\.cloudflareclient\.com:2408 is blocked: another Cloudflare address, another port WARP is blocked: another Cloudflare address, another WARP port (500, 1701, 4500, …), or a relay\.
answers on (500, 1701, 4500, …), or a relay\. Applied in every mode when the tunnel or
AmneziaWG profile starts; the profile file itself is left as is\.
*Type:* **Type:** null or string matching the pattern (\\\[\[0-9A-Fa-f:\.]+]|\[^]:\[]+):\[0-9]+\
null or string matching the pattern (\\\[\[0-9A-Fa-f:\.]+]|\[^]:\[]+):\[0-9]+ **Default:** `null`\
**Example:** `"162.159.192.1:500"`
*Default:*
```nix
null
```
*Example:*
```nix
"162.159.192.1:500"
```
<a id="services-proxy-suite-warp-generatorurl"></a> <a id="services-proxy-suite-warp-generatorurl"></a>
## services\.proxy-suite\.warp\.generatorUrl ## services\.proxy-suite\.warp\.generatorUrl
HTTPS URL of a WARP profile generator, fetched directly when wgcf registration fails URL of a WARP profile generator, used if wgcf registration fails (for example, when the
(e\.g\. the Cloudflare API is blocked and there is no local proxy)\. It must return a Cloudflare API is blocked)\. It must return a WireGuard profile, or JSON with the base64
WireGuard profile, or JSON with the base64 profile in ` .content `\. profile in ` .content `\.
The generator registers the device, so its operator sees the private key\. Its operator sees your private key\.
*Type:* **Type:** null or string\
null or string **Default:** `null`\
**Example:** `"https://valokda-amnezia.vercel.app/api/warp?mode=awg2"`
*Default:*
```nix
null
```
*Example:*
```nix
"https://valokda-amnezia.vercel.app/api/warp?mode=awg2"
```
+50 -140
View File
@@ -1,5 +1,7 @@
# services.proxy-suite.whitelistBypass # services.proxy-suite.whitelistBypass
Tunnels through video-call servers, past mobile internet whitelists.
Part of the [proxy-suite options reference](./index.md). Part of the [proxy-suite options reference](./index.md).
## Options ## Options
@@ -22,51 +24,29 @@ Part of the [proxy-suite options reference](./index.md).
<a id="services-proxy-suite-whitelistbypass-enable"></a> <a id="services-proxy-suite-whitelistbypass-enable"></a>
## services\.proxy-suite\.whitelistBypass\.enable ## services\.proxy-suite\.whitelistBypass\.enable
Whether to enable tunnels through the media servers of video calls, which mobile internet whitelists let Tunnel through video-call servers, which mobile internet whitelists let through
through ([whitelist-bypass](https://github\.com/kulikov0/whitelist-bypass))\. A creator on a ([whitelist-bypass](https://github\.com/kulikov0/whitelist-bypass))\. A creator on a free
free host serves exactly one joiner on a censored one\. host serves one joiner on a censored one\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
*Example:*
```nix
true
```
<a id="services-proxy-suite-whitelistbypass-package"></a> <a id="services-proxy-suite-whitelistbypass-package"></a>
## services\.proxy-suite\.whitelistBypass\.package ## services\.proxy-suite\.whitelistBypass\.package
whitelist-bypass package with the headless creators and joiners\. whitelist-bypass package\.
*Type:* **Type:** package\
package **Default:** proxy-suite’s ` whitelist-bypass ` (` pkgs/whitelist-bypass.nix `)
*Default:*
proxy-suite’s ` whitelist-bypass ` (` pkgs/whitelist-bypass.nix `)
<a id="services-proxy-suite-whitelistbypass-creators"></a> <a id="services-proxy-suite-whitelistbypass-creators"></a>
## services\.proxy-suite\.whitelistBypass\.creators ## services\.proxy-suite\.whitelistBypass\.creators
Creators, one per joiner device\. The link each uses is in its log\. Creators, one per joiner device\. Each logs the call link its joiner needs (also ` proxy-ctl wl link `)\.
*Type:* **Type:** attribute set of (submodule)\
attribute set of (submodule) **Default:** `{ }`\
**Example:**
*Default:*
```nix
{ }
```
*Example:*
```nix ```nix
{ {
@@ -81,112 +61,61 @@ attribute set of (submodule)
<a id="services-proxy-suite-whitelistbypass-creators-name-cookiesfile"></a> <a id="services-proxy-suite-whitelistbypass-creators-name-cookiesfile"></a>
## services\.proxy-suite\.whitelistBypass\.creators\.\<name>\.cookiesFile ## services\.proxy-suite\.whitelistBypass\.creators\.\<name>\.cookiesFile
Runtime path to the platform’s cookies, as the upstream desktop Creator exports them\. File with the platform’s cookies, as exported by the upstream desktop Creator\. Read on
Copied into the state directory on first start only: DION and Bitrix rotate their first start only, since the login refreshes itself afterwards\. ` proxy-ctl wl auth <name> ` replaces it at runtime (or asks for email and password on DION and Bitrix)\.
refresh token into that copy, and a stale one would kill the session\. ` null `: the creator waits for that\.
` proxy-ctl wl auth <name> ` replaces that copy at runtime, with a new export or, for
DION and Bitrix, an email and password\. Null leaves the creator off until then\.
*Type:* **Type:** null or string\
null or string **Default:** `null`\
**Example:** `"/run/secrets/whitelist-bypass-cookies-wbstream.json"`
*Default:*
```nix
null
```
*Example:*
```nix
"/run/secrets/whitelist-bypass-cookies-wbstream.json"
```
<a id="services-proxy-suite-whitelistbypass-creators-name-linkfile"></a> <a id="services-proxy-suite-whitelistbypass-creators-name-linkfile"></a>
## services\.proxy-suite\.whitelistBypass\.creators\.\<name>\.linkFile ## services\.proxy-suite\.whitelistBypass\.creators\.\<name>\.linkFile
Runtime path to the call to rejoin\. Null rejoins the last call written to File with a call link to rejoin\. ` null `: create a call once and keep reusing it, so
` <stateDir>/whitelist-bypass/<name>.link `, and creates one on first start: the link the joiner needs the link only once\. ` proxy-ctl wl new <name> ` starts a new call if the
stays the same across restarts, so the joiner needs it only once\. ` proxy-ctl wl new <name> ` drops it for a new call, when the platform has closed the old one\. platform closed the old one\.
*Type:* **Type:** null or string\
null or string **Default:** `null`\
**Example:** `"/run/secrets/whitelist-bypass-link"`
*Default:*
```nix
null
```
*Example:*
```nix
"/run/secrets/whitelist-bypass-link"
```
<a id="services-proxy-suite-whitelistbypass-creators-name-platform"></a> <a id="services-proxy-suite-whitelistbypass-creators-name-platform"></a>
## services\.proxy-suite\.whitelistBypass\.creators\.\<name>\.platform ## services\.proxy-suite\.whitelistBypass\.creators\.\<name>\.platform
Call platform\. Every one needs an account: “vk” only serves the upstream Android app, Call platform\. Each needs an account\. “vk” only serves the upstream Android joiner app\.
the rest a joiner of this module too\.
*Type:* **Type:** one of “wbstream”, “telemost”, “dion”, “bitrix”, “vk”\
one of “wbstream”, “telemost”, “dion”, “bitrix”, “vk” **Example:** `"wbstream"`
*Example:*
```nix
"wbstream"
```
<a id="services-proxy-suite-whitelistbypass-creators-name-resources"></a> <a id="services-proxy-suite-whitelistbypass-creators-name-resources"></a>
## services\.proxy-suite\.whitelistBypass\.creators\.\<name>\.resources ## services\.proxy-suite\.whitelistBypass\.creators\.\<name>\.resources
Buffer sizes and Go memory limit: 64, 128 or 256 MB\. Memory budget: 64, 128 or 256 MB\.
*Type:* **Type:** one of “moderate”, “default”, “unlimited”\
one of “moderate”, “default”, “unlimited” **Default:** `"moderate"`
*Default:*
```nix
"moderate"
```
<a id="services-proxy-suite-whitelistbypass-creators-name-upstream"></a> <a id="services-proxy-suite-whitelistbypass-creators-name-upstream"></a>
## services\.proxy-suite\.whitelistBypass\.creators\.\<name>\.upstream ## services\.proxy-suite\.whitelistBypass\.creators\.\<name>\.upstream
Where the joiner’s traffic leaves\. Where the traffic from this creator’s joiner exits\.
- “direct”: from this host, past TUN and TProxy (it runs as proxy-suite-daemon)\. - “direct”: straight from this host, bypassing TUN and TProxy\.
- “proxy”: through the local proxy listener (proxy\.listener, with its auth), and so - “proxy”: through the local proxy and its routing\.
its outbounds and routing\.
*Type:* **Type:** one of “direct”, “proxy”\
one of “direct”, “proxy” **Default:** `"direct"`
*Default:*
```nix
"direct"
```
<a id="services-proxy-suite-whitelistbypass-joiners"></a> <a id="services-proxy-suite-whitelistbypass-joiners"></a>
## services\.proxy-suite\.whitelistBypass\.joiners ## services\.proxy-suite\.whitelistBypass\.joiners
Joiners, each an outbound tagged with its name: a loopback SOCKS5 listener that tunnels Joiners, each an outbound tagged with its name that tunnels through the call\. Needs
through the call\. Needs proxy\.enable\. ` proxy.enable `\.
*Type:* **Type:** attribute set of (submodule)\
attribute set of (submodule) **Default:** `{ }`\
**Example:**
*Default:*
```nix
{ }
```
*Example:*
```nix ```nix
{ {
@@ -200,36 +129,17 @@ attribute set of (submodule)
<a id="services-proxy-suite-whitelistbypass-joiners-name-linkfile"></a> <a id="services-proxy-suite-whitelistbypass-joiners-name-linkfile"></a>
## services\.proxy-suite\.whitelistBypass\.joiners\.\<name>\.linkFile ## services\.proxy-suite\.whitelistBypass\.joiners\.\<name>\.linkFile
Runtime path to the call link the creator printed (or wrote to its state directory): File with the call link from the creator’s log\. ` proxy-ctl wl join <name> <link> ` sets
a WB Stream room id, a Telemost link, a DION event slug or a Bitrix conference link\. one at runtime and takes priority\. ` null `: the joiner waits for that\.
` proxy-ctl wl join <name> <link> ` sets one at runtime, which wins over this\. Null
leaves the joiner off until then\.
*Type:* **Type:** null or string\
null or string **Default:** `null`\
**Example:** `"/run/secrets/whitelist-bypass-link"`
*Default:*
```nix
null
```
*Example:*
```nix
"/run/secrets/whitelist-bypass-link"
```
<a id="services-proxy-suite-whitelistbypass-joiners-name-platform"></a> <a id="services-proxy-suite-whitelistbypass-joiners-name-platform"></a>
## services\.proxy-suite\.whitelistBypass\.joiners\.\<name>\.platform ## services\.proxy-suite\.whitelistBypass\.joiners\.\<name>\.platform
Call platform the creator on the other end uses\. VK has no Linux joiner\. Call platform the creator uses\. VK has no joiner here\.
*Type:* **Type:** one of “wbstream”, “telemost”, “dion”, “bitrix”\
one of “wbstream”, “telemost”, “dion”, “bitrix” **Example:** `"wbstream"`
*Example:*
```nix
"wbstream"
```
+169 -595
View File
@@ -1,5 +1,7 @@
# services.proxy-suite.zapret # services.proxy-suite.zapret
DPI bypass without a proxy: zapret-discord-youtube or zapret2.
Part of the [proxy-suite options reference](./index.md). Part of the [proxy-suite options reference](./index.md).
## Options ## Options
@@ -63,248 +65,116 @@ Part of the [proxy-suite options reference](./index.md).
Whether to enable zapret DPI bypass\. Whether to enable zapret DPI bypass\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
*Example:*
```nix
true
```
<a id="services-proxy-suite-zapret-cidrexemption-enable"></a> <a id="services-proxy-suite-zapret-cidrexemption-enable"></a>
## services\.proxy-suite\.zapret\.cidrExemption\.enable ## services\.proxy-suite\.zapret\.cidrExemption\.enable
Whether to enable exempting subnets from zapret, e\.g\. NATed VMs whose traffic it would break\. Whether to enable skipping zapret for some subnets, such as NATed VMs it would break\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
*Example:*
```nix
true
```
<a id="services-proxy-suite-zapret-cidrexemption-cidrs"></a> <a id="services-proxy-suite-zapret-cidrexemption-cidrs"></a>
## services\.proxy-suite\.zapret\.cidrExemption\.cidrs ## services\.proxy-suite\.zapret\.cidrExemption\.cidrs
Exempted subnets\. Subnets zapret skips\.
*Type:* **Type:** list of string\
list of string **Default:** `[ ]`\
**Example:** `[ "192.168.123.0/24" ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
"192.168.123.0/24"
]
```
<a id="services-proxy-suite-zapret-directsync-enable"></a> <a id="services-proxy-suite-zapret-directsync-enable"></a>
## services\.proxy-suite\.zapret\.directSync\.enable ## services\.proxy-suite\.zapret\.directSync\.enable
Add zapret’s domain hostlists to proxy\.routing\.direct\. Send zapret’s domains direct in the proxy routing, so zapret handles them\.
*Type:* **Type:** boolean\
boolean **Default:** `true`
*Default:*
```nix
true
```
<a id="services-proxy-suite-zapret-directsync-upstreamips"></a> <a id="services-proxy-suite-zapret-directsync-upstreamips"></a>
## services\.proxy-suite\.zapret\.directSync\.upstreamIps ## services\.proxy-suite\.zapret\.directSync\.upstreamIps
Add zapret’s upstream ipsets to proxy\.routing\.direct\. Also send zapret’s upstream IP lists direct\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
<a id="services-proxy-suite-zapret-directsync-userips"></a> <a id="services-proxy-suite-zapret-directsync-userips"></a>
## services\.proxy-suite\.zapret\.directSync\.userIps ## services\.proxy-suite\.zapret\.directSync\.userIps
Add zapret-discord-youtube\.ips, minus zapret-discord-youtube\.excludeIps, to proxy\.routing\.direct\. Also send ` zapret-discord-youtube.ips ` (minus ` excludeIps `) direct\.
*Type:* **Type:** boolean\
boolean **Default:** `true`
*Default:*
```nix
true
```
<a id="services-proxy-suite-zapret-engine"></a> <a id="services-proxy-suite-zapret-engine"></a>
## services\.proxy-suite\.zapret\.engine ## services\.proxy-suite\.zapret\.engine
“zapret-discord-youtube”: nfqws with curated presets and static hostlists (zapret\.zapret-discord-youtube)\. Which zapret to run:
“zapret2”: nfqws2, which learns blocked hosts at runtime (zapret\.zapret2)\.
*Type:* - “zapret-discord-youtube”: ready-made presets and fixed site lists\.
one of “zapret-discord-youtube”, “zapret2” - “zapret2”: learns blocked sites at runtime\.
*Default:* **Type:** one of “zapret-discord-youtube”, “zapret2”\
**Default:** `"zapret-discord-youtube"`\
```nix **Example:** `"zapret2"`
"zapret-discord-youtube"
```
*Example:*
```nix
"zapret2"
```
<a id="services-proxy-suite-zapret-zapret-discord-youtube-configname"></a> <a id="services-proxy-suite-zapret-zapret-discord-youtube-configname"></a>
## services\.proxy-suite\.zapret\.zapret-discord-youtube\.configName ## services\.proxy-suite\.zapret\.zapret-discord-youtube\.configName
Upstream strategy preset\. Names that differ only in whitespace match\. Strategy preset name (spaces are ignored)\.
*Type:* **Type:** string\
string **Default:** `"general(ALT)"`\
**Example:** `"general (ALT9)"`
*Default:*
```nix
"general(ALT)"
```
*Example:*
```nix
"general (ALT9)"
```
<a id="services-proxy-suite-zapret-zapret-discord-youtube-domains"></a> <a id="services-proxy-suite-zapret-zapret-discord-youtube-domains"></a>
## services\.proxy-suite\.zapret\.zapret-discord-youtube\.domains ## services\.proxy-suite\.zapret\.zapret-discord-youtube\.domains
Extra domains to bypass\. Extra domains to unblock\.
*Type:* **Type:** list of string\
list of string **Default:** `[ ]`\
**Example:** `[ "youtube.com" ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
"youtube.com"
]
```
<a id="services-proxy-suite-zapret-zapret-discord-youtube-excludedomains"></a> <a id="services-proxy-suite-zapret-zapret-discord-youtube-excludedomains"></a>
## services\.proxy-suite\.zapret\.zapret-discord-youtube\.excludeDomains ## services\.proxy-suite\.zapret\.zapret-discord-youtube\.excludeDomains
Domains never bypassed\. Domains zapret never touches\.
*Type:* **Type:** list of string\
list of string **Default:** `[ ]`\
**Example:** `[ "music.youtube.com" ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
"music.youtube.com"
]
```
<a id="services-proxy-suite-zapret-zapret-discord-youtube-excludeips"></a> <a id="services-proxy-suite-zapret-zapret-discord-youtube-excludeips"></a>
## services\.proxy-suite\.zapret\.zapret-discord-youtube\.excludeIps ## services\.proxy-suite\.zapret\.zapret-discord-youtube\.excludeIps
IPs/CIDRs never bypassed\. IPs or CIDRs zapret never touches\.
*Type:* **Type:** list of string\
list of string **Default:** `[ ]`\
**Example:** `[ "203.0.113.10/32" ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
"203.0.113.10/32"
]
```
<a id="services-proxy-suite-zapret-zapret-discord-youtube-gamefilter"></a> <a id="services-proxy-suite-zapret-zapret-discord-youtube-gamefilter"></a>
## services\.proxy-suite\.zapret\.zapret-discord-youtube\.gameFilter ## services\.proxy-suite\.zapret\.zapret-discord-youtube\.gameFilter
Game traffic filter, or “null” for off\. Which game traffic to handle, or “null” for none\.
*Type:* **Type:** one of “all”, “tcp”, “udp”, “null”\
one of “all”, “tcp”, “udp”, “null” **Default:** `"null"`\
**Example:** `"all"`
*Default:*
```nix
"null"
```
*Example:*
```nix
"all"
```
<a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules"></a> <a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules"></a>
## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules ## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules
Extra named hostlists, each with its own strategy: cloned from a preset or configName, Extra site lists, each with its own strategy: copied from a ` preset ` or ` configName `,
or given as nfqwsArgs\. or given as raw ` nfqwsArgs `\.
*Type:* **Type:** list of (submodule)\
list of (submodule) **Default:** `[ ]`\
**Example:**
*Default:*
```nix
[ ]
```
*Example:*
```nix ```nix
[ [
@@ -328,548 +198,265 @@ list of (submodule)
<a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-enabledirectsync"></a> <a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-enabledirectsync"></a>
## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.enableDirectSync ## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.enableDirectSync
Include these domains in zapret\.directSync\. Include these domains in ` zapret.directSync `\.
*Type:* **Type:** boolean\
boolean **Default:** `true`
*Default:*
```nix
true
```
<a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-configname"></a> <a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-configname"></a>
## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.configName ## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.configName
Config to clone strategies from\. Exclusive with nfqwsArgs\. Config to copy the strategy from\. Cannot be used with ` nfqwsArgs `\.
*Type:* **Type:** null or string\
null or string **Default:** `null`\
**Example:** `"general(ALT9)"`
*Default:*
```nix
null
```
*Example:*
```nix
"general(ALT9)"
```
<a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-defaultdomains"></a> <a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-defaultdomains"></a>
## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.defaultDomains ## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.defaultDomains
Upstream lists to include (“discord” = “general”, “youtube” = “google”)\. Without preset, Upstream lists to include (“discord” is “general”, “youtube” is “google”)\. Without
use one per rule so the strategy family can be inferred\. ` preset `, use only one, so the strategy can be inferred from it\.
*Type:* **Type:** list of (one of “general”, “google”, “discord”, “youtube”, “instagram”, “soundcloud”, “twitter”)\
list of (one of “general”, “google”, “discord”, “youtube”, “instagram”, “soundcloud”, “twitter”) **Default:** `[ ]`\
**Example:** `[ "google" ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
"google"
]
```
<a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-defaultips"></a> <a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-defaultips"></a>
## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.defaultIps ## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.defaultIps
Upstream ipsets to include (“all” is ipset-all\.txt)\. Upstream IP lists to include\.
*Type:* **Type:** list of value “all” (singular enum)\
list of value “all” (singular enum) **Default:** `[ ]`\
**Example:** `[ "all" ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
"all"
]
```
<a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-domains"></a> <a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-domains"></a>
## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.domains ## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.domains
Domains in this hostlist\. Domains in this list\.
*Type:* **Type:** list of string\
list of string **Default:** `[ ]`\
**Example:** `[ "example.com" ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
"example.com"
]
```
<a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-ips"></a> <a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-ips"></a>
## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.ips ## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.ips
IPs/CIDRs in this rule’s ipset\. IPs or CIDRs in this list\.
*Type:* **Type:** list of string\
list of string **Default:** `[ ]`\
**Example:** `[ "203.0.113.0/24" ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
"203.0.113.0/24"
]
```
<a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-name"></a> <a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-name"></a>
## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.name ## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.name
Hostlist name (hostlists/list-\<name>\.txt)\. List name\.
*Type:* **Type:** string matching the pattern ^\[a-z0-9]\[a-z0-9-]\*$\
string matching the pattern ^\[a-z0-9]\[a-z0-9-]\*$ **Example:** `"cloudflare"`
*Example:*
```nix
"cloudflare"
```
<a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-nfqwsargs"></a> <a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-nfqwsargs"></a>
## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.nfqwsArgs ## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.nfqwsArgs
Raw NFQWS arguments; --hostlist and --new are added\. Exclusive with configName\. Raw nfqws arguments; ` --hostlist ` and ` --new ` are added\. Cannot be used with ` configName `\.
*Type:* **Type:** list of string\
list of string **Default:** `[ ]`\
**Example:** `[ "--filter-tcp=443 --dpi-desync=fake,multisplit" ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
"--filter-tcp=443 --dpi-desync=fake,multisplit"
]
```
<a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-preset"></a> <a id="services-proxy-suite-zapret-zapret-discord-youtube-hostlistrules-preset"></a>
## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.preset ## services\.proxy-suite\.zapret\.zapret-discord-youtube\.hostlistRules\.\*\.preset
Strategy family to clone, from configName or the active config\. Strategy to copy, from ` configName ` or the active config\.
*Type:* **Type:** null or one of “general”, “google”, “instagram”, “soundcloud”, “twitter”\
null or one of “general”, “google”, “instagram”, “soundcloud”, “twitter” **Default:** `null`\
**Example:** `"google"`
*Default:*
```nix
null
```
*Example:*
```nix
"google"
```
<a id="services-proxy-suite-zapret-zapret-discord-youtube-includeextraupstreamlists"></a> <a id="services-proxy-suite-zapret-zapret-discord-youtube-includeextraupstreamlists"></a>
## services\.proxy-suite\.zapret\.zapret-discord-youtube\.includeExtraUpstreamLists ## services\.proxy-suite\.zapret\.zapret-discord-youtube\.includeExtraUpstreamLists
Also use the upstream instagram, soundcloud and twitter lists\. Also use the upstream instagram, soundcloud and twitter lists\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
<a id="services-proxy-suite-zapret-zapret-discord-youtube-ips"></a> <a id="services-proxy-suite-zapret-zapret-discord-youtube-ips"></a>
## services\.proxy-suite\.zapret\.zapret-discord-youtube\.ips ## services\.proxy-suite\.zapret\.zapret-discord-youtube\.ips
Extra IPs/CIDRs to bypass\. Extra IPs or CIDRs to unblock\.
*Type:* **Type:** list of string\
list of string **Default:** `[ ]`\
**Example:** `[ "203.0.113.0/24" ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
"203.0.113.0/24"
]
```
<a id="services-proxy-suite-zapret-zapret2-autohostlist-enable"></a> <a id="services-proxy-suite-zapret-zapret2-autohostlist-enable"></a>
## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.enable ## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.enable
Learn blocked hosts: after failThreshold failures (retransmissions, early RST, DPI Learn blocked sites: after ` failThreshold ` failed connections, a site is treated as
redirect, one-sided UDP) a host joins /var/lib/proxy-suite/zapret2/zapret-hosts-auto\.txt\. blocked\. When off, only ` zapret2.domains ` and ` proxy-ctl zapret auto add ` are used\.
Off, only zapret2\.domains and ` proxy-ctl zapret auto add ` are acted on\.
The thresholds below also fill whichever of them a profile’s strategy rotation
(circular) leaves unset; its own fails and time are kept\.
*Type:* **Type:** boolean\
boolean **Default:** `true`
*Default:*
```nix
true
```
*Example:*
```nix
true
```
<a id="services-proxy-suite-zapret-zapret2-autohostlist-debuglog"></a> <a id="services-proxy-suite-zapret-zapret2-autohostlist-debuglog"></a>
## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.debugLog ## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.debugLog
Log why hosts are or are not learned to zapret-hosts-auto-debug\.log\. Log why sites are or are not learned\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
<a id="services-proxy-suite-zapret-zapret2-autohostlist-failthreshold"></a> <a id="services-proxy-suite-zapret-zapret2-autohostlist-failthreshold"></a>
## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.failThreshold ## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.failThreshold
Failures before a host is learned\. Failures before a site is learned\.
*Type:* **Type:** positive integer, meaning >0\
positive integer, meaning >0 **Default:** `3`
*Default:*
```nix
3
```
<a id="services-proxy-suite-zapret-zapret2-autohostlist-failtime"></a> <a id="services-proxy-suite-zapret-zapret2-autohostlist-failtime"></a>
## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.failTime ## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.failTime
Seconds allowed between two failures before the count resets\. Seconds without a failure before the count resets\.
*Type:* **Type:** positive integer, meaning >0\
positive integer, meaning >0 **Default:** `300`
*Default:*
```nix
300
```
<a id="services-proxy-suite-zapret-zapret2-autohostlist-incomingmaxseq"></a> <a id="services-proxy-suite-zapret-zapret2-autohostlist-incomingmaxseq"></a>
## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.incomingMaxseq ## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.incomingMaxseq
Incoming sequence number past which an RST or redirect is not a failure\. After this many bytes received, a reset or redirect is not a failure\.
*Type:* **Type:** positive integer, meaning >0\
positive integer, meaning >0 **Default:** `4096`
*Default:*
```nix
4096
```
<a id="services-proxy-suite-zapret-zapret2-autohostlist-retransmaxseq"></a> <a id="services-proxy-suite-zapret-zapret2-autohostlist-retransmaxseq"></a>
## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.retransMaxseq ## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.retransMaxseq
Outgoing sequence number past which failure detection stops\. Stop watching a connection for failures after this many bytes sent\.
*Type:* **Type:** positive integer, meaning >0\
positive integer, meaning >0 **Default:** `32768`
*Default:*
```nix
32768
```
<a id="services-proxy-suite-zapret-zapret2-autohostlist-retransreset"></a> <a id="services-proxy-suite-zapret-zapret2-autohostlist-retransreset"></a>
## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.retransReset ## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.retransReset
RST a stalled client once retransThreshold is hit, so failures are counted fast\. Reset a stalled connection at ` retransThreshold `, so failures are counted faster\.
*Type:* **Type:** boolean\
boolean **Default:** `true`
*Default:*
```nix
true
```
<a id="services-proxy-suite-zapret-zapret2-autohostlist-retransthreshold"></a> <a id="services-proxy-suite-zapret-zapret2-autohostlist-retransthreshold"></a>
## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.retransThreshold ## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.retransThreshold
Retransmissions of the first request that count as one failure\. Retransmissions of the first request that count as a failure\.
*Type:* **Type:** positive integer, meaning >0\
positive integer, meaning >0 **Default:** `3`
*Default:*
```nix
3
```
<a id="services-proxy-suite-zapret-zapret2-autohostlist-udpin"></a> <a id="services-proxy-suite-zapret-zapret2-autohostlist-udpin"></a>
## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.udpIn ## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.udpIn
Incoming UDP packets at or below which an exchange is one-sided\. Most UDP replies that still count as no answer (see ` udpOut `)\.
*Type:* **Type:** positive integer, meaning >0\
positive integer, meaning >0 **Default:** `1`
*Default:*
```nix
1
```
<a id="services-proxy-suite-zapret-zapret2-autohostlist-udpout"></a> <a id="services-proxy-suite-zapret-zapret2-autohostlist-udpout"></a>
## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.udpOut ## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.udpOut
Outgoing UDP packets before a one-sided exchange counts as a failure\. UDP packets sent, with at most ` udpIn ` replies, that count as a failure\.
*Type:* **Type:** positive integer, meaning >0\
positive integer, meaning >0 **Default:** `4`
*Default:*
```nix
4
```
<a id="services-proxy-suite-zapret-zapret2-blobs"></a> <a id="services-proxy-suite-zapret-zapret2-blobs"></a>
## services\.proxy-suite\.zapret\.zapret2\.blobs ## services\.proxy-suite\.zapret\.zapret2\.blobs
Fake payloads by name (blob=\<name>) on top of those of strategySource: a file in zapret2’s files/fake, or an absolute path\. Extra fake payloads by name (blob=\<name>): a file in zapret2’s files/fake, or an absolute path\.
*Type:* **Type:** attribute set of string\
attribute set of string **Default:** `{ }`\
**Example:** `{ tls_clienthello = "/etc/proxy-suite/my_clienthello.bin"; }`
*Default:*
```nix
{ }
```
*Example:*
```nix
{
tls_clienthello = "/etc/proxy-suite/my_clienthello.bin";
}
```
<a id="services-proxy-suite-zapret-zapret2-cutoff-enable"></a> <a id="services-proxy-suite-zapret-zapret2-cutoff-enable"></a>
## services\.proxy-suite\.zapret\.zapret2\.cutoff\.enable ## services\.proxy-suite\.zapret\.zapret2\.cutoff\.enable
Some lines let TLS to certain hosting networks handshake and then cut it at 12-34 KB, Work around ISPs that cut TLS to some hosting networks after about 16 KB, which no
which no strategy fixes\. z2k’s probe checks this line against ~110 known targets when strategy fixes\. A daily probe finds the affected networks and a whitelisted name that
its network changes and once a day, and for each cut-off network searches a whitelisted gets through for each\. Only with ` strategySource = "z2k" `\. Each run makes thousands of
name that nfqws2 then puts into a fake ClientHello (strategySource “z2k” only; ahead of short direct connections\. ` proxy-ctl zapret cutoff ` shows the results\.
the nfqws2-keenetic strategies it breaks them): thousands of short TLS connections to
foreign hosting IPs per full run, sent directly and never touched by zapret2\. State and
maps live in /var/lib/proxy-suite/zapret2/cutoff; ` proxy-ctl zapret cutoff ` shows them\.
*Type:* **Type:** boolean\
boolean **Default:** `true`
*Default:*
```nix
true
```
*Example:*
```nix
true
```
<a id="services-proxy-suite-zapret-zapret2-cutoff-proxyfallback"></a> <a id="services-proxy-suite-zapret-zapret2-cutoff-proxyfallback"></a>
## services\.proxy-suite\.zapret\.zapret2\.cutoff\.proxyFallback ## services\.proxy-suite\.zapret\.zapret2\.cutoff\.proxyFallback
Route the cut-off networks no name fixes through the proxy outbound\. Needs the sing-box Send cut-off networks that no name fixes through the proxy\. Needs the sing-box backend,
backend with an outbound and a route mode other than all-bypass, and only applies to an outbound, and a route mode other than all-bypass\. Only works for traffic the proxy
traffic the backend sees by address (TUN, TProxy, per-app routing, clients that dial IPs); sees by IP (TUN, TProxy, per-app routing)\. Explicit direct rules still win\.
explicit direct rules still win\.
*Type:* **Type:** boolean\
boolean **Default:** `true`
*Default:*
```nix
true
```
<a id="services-proxy-suite-zapret-zapret2-domains"></a> <a id="services-proxy-suite-zapret-zapret2-domains"></a>
## services\.proxy-suite\.zapret\.zapret2\.domains ## services\.proxy-suite\.zapret\.zapret2\.domains
Domains always treated as blocked\. At runtime: ` proxy-ctl zapret auto add `\. Domains always treated as blocked\. At runtime: ` proxy-ctl zapret auto add `\.
*Type:* **Type:** list of string\
list of string **Default:** `[ ]`\
**Example:** `[ "rutracker.org" ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
"rutracker.org"
]
```
<a id="services-proxy-suite-zapret-zapret2-excludedomains"></a> <a id="services-proxy-suite-zapret-zapret2-excludedomains"></a>
## services\.proxy-suite\.zapret\.zapret2\.excludeDomains ## services\.proxy-suite\.zapret\.zapret2\.excludeDomains
Domains never touched or learned\. At runtime: ` proxy-ctl zapret auto exclude `\. Domains never touched or learned\. At runtime: ` proxy-ctl zapret auto exclude `\.
*Type:* **Type:** list of string\
list of string **Default:** `[ ]`\
**Example:** `[ "bank.example.com" ]`
*Default:*
```nix
[ ]
```
*Example:*
```nix
[
"bank.example.com"
]
```
<a id="services-proxy-suite-zapret-zapret2-ipv6"></a> <a id="services-proxy-suite-zapret-zapret2-ipv6"></a>
## services\.proxy-suite\.zapret\.zapret2\.ipv6 ## services\.proxy-suite\.zapret\.zapret2\.ipv6
Intercept IPv6 as well as IPv4\. Handle IPv6 too\.
*Type:* **Type:** boolean\
boolean **Default:** `false`
*Default:*
```nix
false
```
<a id="services-proxy-suite-zapret-zapret2-ports-tcp"></a> <a id="services-proxy-suite-zapret-zapret2-ports-tcp"></a>
## services\.proxy-suite\.zapret\.zapret2\.ports\.tcp ## services\.proxy-suite\.zapret\.zapret2\.ports\.tcp
TCP ports sent to NFQUEUE\. Must cover every port a profile filters on\. null uses the ports of strategySource\. TCP ports zapret2 handles\. Must include every port a profile uses\. ` null `: use the ports from ` strategySource `\.
*Type:* **Type:** null or string\
null or string **Default:** `null`\
**Example:** `"80,443"`
*Default:*
```nix
null
```
*Example:*
```nix
"80,443"
```
<a id="services-proxy-suite-zapret-zapret2-ports-udp"></a> <a id="services-proxy-suite-zapret-zapret2-ports-udp"></a>
## services\.proxy-suite\.zapret\.zapret2\.ports\.udp ## services\.proxy-suite\.zapret\.zapret2\.ports\.udp
UDP ports sent to NFQUEUE\. Must cover every port a profile filters on\. null uses the ports of strategySource\. UDP ports zapret2 handles\. Must include every port a profile uses\. ` null `: use the ports from ` strategySource `\.
*Type:* **Type:** null or string\
null or string **Default:** `null`\
**Example:** `"443"`
*Default:*
```nix
null
```
*Example:*
```nix
"443"
```
<a id="services-proxy-suite-zapret-zapret2-profiles"></a> <a id="services-proxy-suite-zapret-zapret2-profiles"></a>
## services\.proxy-suite\.zapret\.zapret2\.profiles ## services\.proxy-suite\.zapret\.zapret2\.profiles
nfqws2 profiles replacing those of strategySource, joined with --new; first match wins\. Your own nfqws2 profiles, instead of those from ` strategySource `\. The first match wins\.
\<HOSTLIST> expands to the hostlist arguments, \<HOSTLIST_NOAUTO> to the same without ` <HOSTLIST> ` expands to the site list arguments, ` <HOSTLIST_NOAUTO> ` to the same without
learning\. --qnum, --fwmark and --lua-init are added automatically\. null uses the profiles of strategySource\. learning\. ` --qnum `, ` --fwmark ` and ` --lua-init ` are added for you\. ` null `: use the profiles from ` strategySource `\.
*Type:* **Type:** null or (list of string)\
null or (list of string) **Default:** `null`\
**Example:**
*Default:*
```nix
null
```
*Example:*
```nix ```nix
[ [
@@ -880,26 +467,13 @@ null
<a id="services-proxy-suite-zapret-zapret2-strategysource"></a> <a id="services-proxy-suite-zapret-zapret2-strategysource"></a>
## services\.proxy-suite\.zapret\.zapret2\.strategySource ## services\.proxy-suite\.zapret\.zapret2\.strategySource
Where profiles, blobs and ports come from; both are pinned flake inputs\. Where the strategies, blobs and ports come from\.
“nfqws2-keenetic”: its nfqws2\.conf strategies with its user and exclude lists\.
“z2k”: z2k’s own config generator, run at build time: per-category rotation pools
(general, YouTube, googlevideo, QUIC, Discord), its failure detectors and fake-TTL
hook, its blobs, whitelist and hostlists, including the ~125k-domain RKN list
(about 15 MB more RSS per nfqws2 process)\.
Either way each host’s working strategy is remembered across restarts in
/var/lib/proxy-suite/zapret2/circular/state\.tsv\.
*Type:* - “nfqws2-keenetic”: its strategies and site lists\.
one of “nfqws2-keenetic”, “z2k” - “z2k”: z2k’s strategies, which rotate per category (YouTube, Discord, QUIC, …), with
its site lists, including the full RKN list (more memory)\.
Either way, each site’s working strategy is remembered across restarts\.
*Default:* **Type:** one of “nfqws2-keenetic”, “z2k”\
**Default:** `"nfqws2-keenetic"`\
```nix **Example:** `"z2k"`
"nfqws2-keenetic"
```
*Example:*
```nix
"z2k"
```
+76
View File
@@ -0,0 +1,76 @@
# Use an AmneziaWG config
Bring the AmneziaWG config from your provider or your own server, either as a `.conf` file or
as an Amnezia app `vpn://` export. AmneziaWG 1.x to 3.x are supported. Each profile can run
in one of two ways:
- **as a global VPN**: all traffic goes through it, like `wg-quick up`;
- **as an outbound**: the proxy sends only what your routing picks through it.
## As a global VPN
```nix
services.proxy-suite = {
enable = true;
amneziaWg = {
enable = true;
profiles.home.configFile = "/run/secrets/home-awg.conf";
profiles.work = {
vpnFile = "/run/secrets/work-amnezia.vpn";
autostart = true; # at most one profile
};
};
killSwitch.enable = true; # optional: no leaks while the tunnel is down
};
```
```sh
proxy-ctl awg # profiles and which one is up
proxy-ctl awg on home # switches from any other global tunnel
proxy-ctl awg off
```
Only one global tunnel runs at a time: an AmneziaWG profile, TUN or TProxy. Starting one
stops the others.
## As an outbound
```nix
services.proxy-suite = {
enable = true;
proxy.enable = true;
amneziaWg = {
enable = true;
profiles.de = {
configFile = "/run/secrets/de-awg.conf";
asOutbound = "interface";
};
};
};
```
The outbound is tagged with the profile's name (`de` here). It always runs, and leaves the
host's routes and DNS alone. Use it like any other outbound: for selection, in
[routing rules](./routing.md), or as a hop in a [chain](./chains.md).
| `asOutbound` | Obfuscation | Needs root | Notes |
|---|---|---|---|
| `"interface"` | yes | yes | A real AmneziaWG interface with no routes. |
| `"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. |
## Good to know
- A profile that stops getting handshake replies moves to a new source port on its own.
`settings.listenPort` pins the port and turns this off.
- If the server's address is blocked, `profiles.<name>.endpoint` replaces it without
editing the file.
- Imported configs cannot run `PostUp` and other hooks unless you set `allowConfigHooks`.
- The profile can also be written in Nix instead of a file, with `profiles.<name>.settings`.
- To host an AmneziaWG server, see [Run your own server](./server.md).
## See also
- [`amneziaWg.profiles`](../options/amneziaWg.md#services-proxy-suite-amneziawg-profiles)
- [`asOutbound`](../options/amneziaWg.md#services-proxy-suite-amneziawg-profiles-name-asoutbound)
- [`settings`](../options/amneziaWg.md#services-proxy-suite-amneziawg-profiles-name-settings)
+95
View File
@@ -0,0 +1,95 @@
# Chain proxies and add exits
Two things are covered here: reaching a server through another one (a chain), and adding
built-in exits (WARP, Tor, an SSH tunnel) for your routing to use.
## Chains
Set `detour` to make an outbound connect through another one. This helps when your
network cannot reach a server directly but can reach a hop that can. It also hides the
final server's address from your ISP.
```nix
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [
{ tag = "hop"; urlFile = "/run/secrets/hop-url"; }
{ tag = "de-vps"; urlFile = "/run/secrets/de-vps-url"; detour = "hop"; }
];
selectionExclude = [ "hop" ]; # never picked as the exit on its own
};
};
```
Any outbound can be a hop, including subscription entries, WARP, the SSH tunnel and
AmneziaWG outbounds. A subscription's `detour` applies to every entry in it. On the hybrid
backend, an XRay outbound can only chain through another XRay outbound.
At runtime:
```sh
proxy-ctl proxy outbounds chain de-vps hop de-via-hop # a chained copy of de-vps
proxy-ctl proxy outbounds add 'vless://…' --detour hop # a new outbound behind hop
```
## Extra exits
Each of these adds an outbound with a fixed tag. Route sites to it with
[routing rules](./routing.md), or use it as a hop.
```nix
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
routing.rules = [
{ domains = [ "chatgpt.com" "openai.com" ]; outbound = "warp"; }
{ domains = [ "check.torproject.org" ]; outbound = "tor"; }
];
};
# Tagged "warp". Registers a free WARP device on first start.
warp = {
enable = true;
asOutbound = "singBox";
};
# Tagged "tor". .onion names always go to it.
tor = {
enable = true;
asOutbound = true;
};
# Tagged "ssh-proxy".
sshProxy = {
enable = true;
asOutbound = true;
server = { user = "me"; host = "ssh.example.com"; };
identityFile = "/run/secrets/ssh-key";
hostKeyFile = "/run/secrets/ssh-known-hosts"; # from ssh-keyscan
};
};
```
| Exit | Good to know |
|---|---|
| WARP | Registering accepts Cloudflare's terms. If the Cloudflare API is blocked, set `warp.generatorUrl`, or `warp.configFile` with a profile made elsewhere. If the endpoint is blocked, try `warp.endpoint`. |
| Tor | Selection and autoProxy skip it unless it is the only outbound. Where Tor is blocked, add `tor.bridges.lines`, or reach Tor through the proxy with `tor.upstream = "proxy"`. |
| SSH | Needs the server's host keys on sing-box (`hostKeyFile` or `hostKey`). Any SSH server that allows TCP forwarding works, with nothing to install on it. |
## Good to know
- `proxy.selectionExclude` keeps hops and special exits out of automatic selection. You can
still pin them.
- autoProxy tries your exits, WARP included, for each blocked site and keeps the first one
that works.
- WARP can also run as a global VPN instead, through AmneziaWG: `warp.asAmneziaWg`.
## See also
- [`detour`](../options/proxy.md#services-proxy-suite-proxy-outbounds-detour)
- [`proxy.selectionExclude`](../options/proxy.md#services-proxy-suite-proxy-selectionexclude)
- [WARP](../options/warp.md), [Tor](../options/tor.md), [SSH](../options/sshProxy.md)
+68
View File
@@ -0,0 +1,68 @@
# Connect through a proxy
Run a local proxy on `127.0.0.1:1080` that forwards traffic through your server or
subscription.
## Config
```nix
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
subscriptions = [ { tag = "provider"; urlFile = "/run/secrets/provider-sub-url"; } ];
selection = "urltest";
};
};
```
- `outbounds` takes proxy links (`vless://`, `hy2://`, `trojan://`, `ss://`, …), one per
entry. Put each link in a file; see [Keep secrets out of the Nix store](./secrets.md).
- `subscriptions` fetches a list of links from a URL and refreshes it daily. Its entries are
tagged with the subscription's tag as a prefix.
- `selection` picks which outbound to use: `"first"` (the default), `"urltest"` (the
fastest) or `"selector"` (you pick).
You only need one outbound or subscription. With neither, the proxy waits until you add one
with `proxy-ctl proxy outbounds add`.
## Use it
Point apps at `127.0.0.1:1080`. The port speaks both SOCKS5 and HTTP. Many apps follow the
usual variables:
```sh
export all_proxy=socks5h://127.0.0.1:1080
export https_proxy=http://127.0.0.1:1080
```
To route apps without setting them up, see [Route the whole machine](./system-wide.md) or
[Route a single app](./per-app.md).
## Commands
```sh
proxy-ctl status # what is running
proxy-ctl proxy outbounds # outbounds, and which one is in use
proxy-ctl proxy outbounds test # ping and delay of each one
proxy-ctl proxy pin my-vps # always use this one
proxy-ctl proxy unpin # back to automatic selection
proxy-ctl proxy outbounds add 'vless://…' # add one at runtime, no rebuild
proxy-ctl proxy subs update # refetch subscriptions now
```
## Good to know
- `proxy.backend` picks the engine: sing-box (the default), XRay, or `"hybrid"`, which runs
sing-box and hands XHTTP and ECH links to XRay.
- `urltest` tests each outbound by fetching `proxy.urlTest.url`. Set it to a site that is
blocked where you are, so an outbound only passes if it really gets around the block.
- Set `proxy.listener.auth` before exposing the port with `listener.address = "0.0.0.0"`.
## See also
- [`proxy.outbounds`](../options/proxy.md#services-proxy-suite-proxy-outbounds)
- [`proxy.subscriptions`](../options/proxy.md#services-proxy-suite-proxy-subscriptions)
- [`proxy.selection`](../options/proxy.md#services-proxy-suite-proxy-selection)
- [`proxy.backend`](../options/proxy.md#services-proxy-suite-proxy-backend)
+75
View File
@@ -0,0 +1,75 @@
# Control it day to day
Once the config is built, you rarely need to rebuild: most switches happen at runtime,
through one of three front ends.
- **`proxy-ctl`**: the command line. `proxy-ctl help` lists everything, and shell completion
is included.
- **`proxy-tui`**: a terminal UI with the same controls. It works over SSH too. On by default.
- **The desktop app** (`gui.enable`): the same again, with a tray icon. It starts with your
graphical session.
The TUI and the app run `proxy-ctl` underneath, so they can do exactly what it can.
## Without sudo
Reading status needs no privileges. Changing things does, unless you use `userControl`:
```nix
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
};
gui.enable = true;
userControl = {
enable = true;
scopes = [ "services" "routing" "outbounds" "perApp" ];
};
};
users.users.alice.extraGroups = [ "proxy-suite" ];
```
Members of the group get the listed scopes. An empty `scopes` list grants all of them:
| Scope | Allows |
|---|---|
| `services` | turning services on, off and restarting them |
| `routing` | `proxy pin`, `proxy unpin`, `proxy mode` |
| `outbounds` | adding, removing, enabling and disabling outbounds and subscriptions |
| `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 |
Log out and back in after joining the group. Without `userControl`, a change asks for an
admin password, or you run `proxy-ctl` with sudo.
## Runtime changes and the Nix config
| Change | Lasts |
|---|---|
| `proxy outbounds add`, `proxy subs 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.
## Commands
```sh
proxy-ctl status # everything at a glance
proxy-ctl status --json # the same, for scripts
proxy-ctl logs # follow the logs of every proxy-suite service
proxy-ctl restart # restart what is running
proxy-ctl where example.com
```
## See also
- [`userControl.scopes`](../options/userControl.md#services-proxy-suite-usercontrol-scopes)
- [`gui.enable`](../options/gui.md#services-proxy-suite-gui-enable)
- [`tui.enable`](../options/tui.md#services-proxy-suite-tui-enable)
- [The full `proxy-ctl help`](../../README.md), at the end of the README
+19
View File
@@ -0,0 +1,19 @@
# Usage guides
Short guides for common setups. Each one has a minimal config, the commands you will use,
and links into the [options reference](../options/index.md) for the details.
| Guide | When to read it |
|---|---|
| [Connect through a proxy](./client-basics.md) | You have a proxy link or a subscription |
| [Route the whole machine](./system-wide.md) | Every app should use the proxy, not only those set to it |
| [Choose what goes through the proxy](./routing.md) | Only blocked sites through the proxy, or everything but some |
| [Route a single app](./per-app.md) | Only some apps should use the proxy |
| [Unblock sites without a server](./zapret.md) | YouTube, Discord or other sites are slowed or blocked by DPI |
| [Run your own server](./server.md) | You have a VPS and want to connect your devices to it |
| [Keep secrets out of the Nix store](./secrets.md) | Your config holds links, keys or passwords |
| [Control it day to day](./control.md) | Switching things without editing Nix or typing sudo |
| [Use an AmneziaWG config](./amneziawg.md) | You have an AmneziaWG `.conf` or an Amnezia `vpn://` export |
| [Chain proxies and add exits](./chains.md) | WARP, Tor, SSH, or reaching a server through another one |
| [Other Linux and Android](./other-hosts.md) | You are not on NixOS |
| [Get past mobile whitelists](./whitelist-bypass.md) | Mobile internet lets only whitelisted services through |
+74
View File
@@ -0,0 +1,74 @@
# Other Linux and Android
The same `services.proxy-suite` options work outside NixOS, through a module for each
kind of host. The other guides apply as they are, within the limits below.
| Host | Module | Runs as |
|---|---|---|
| Any distribution, with [system-manager](https://github.com/numtide/system-manager) | `systemManagerModules.default` | root, in the system's systemd |
| Any distribution, with [home-manager](https://github.com/nix-community/home-manager) | `homeManagerModules.default` | your user, in your systemd user session |
| Android, with [Nix-on-Droid](https://github.com/nix-community/nix-on-droid) | `nixOnDroidModules.default` | the Nix-on-Droid app |
## system-manager
Nearly everything works as on NixOS: TUN, TProxy, zapret, the kill switch and the GUI.
```nix no-check
systemConfigs.default = system-manager.lib.makeSystemConfig {
modules = [
proxy-suite.systemManagerModules.default
{ services.proxy-suite = { enable = true; /* … */ }; }
];
};
```
- Open inbound ports in your distribution's firewall yourself. proxy-suite leaves it alone.
- AmneziaWG runs in userspace, since kernel modules cannot come from Nix here.
## home-manager
Rootless: only what an ordinary user can do.
```nix no-check
homeConfigurations.me = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
proxy-suite.homeManagerModules.default
{ services.proxy-suite = { enable = true; /* … */ }; }
];
};
```
Available: the local proxy with its outbounds, subscriptions and routing, proxychains
per-app routing, AmneziaWG as a `"userspace"` outbound, inbounds on ports 1024 and up, the
GUI and the TUI.
Not available, since they need root: TUN, TProxy, the kill switch, zapret, per-app `tun`,
`tproxy` and `zapret`, and AmneziaWG interfaces. `userControl` has nothing to grant, since
you own the services. The build stops with a message if the config asks for any of these.
## Nix-on-Droid
What home-manager gets, without the GUI. Use `proxy-ctl` or `proxy-tui` in the app's shell.
```nix no-check
nixOnDroidConfigurations.default = nix-on-droid.lib.nixOnDroidConfiguration {
inherit pkgs;
modules = [
proxy-suite.nixOnDroidModules.default
{ services.proxy-suite = { enable = true; /* … */ }; }
];
};
```
- Android has no boot hook for the app. The services start when a Nix-on-Droid shell opens,
or on `proxy-suitectl boot`.
- Android stops background apps. Keep the app's wake lock on, and turn off battery
optimisation for it.
- Point other apps at `127.0.0.1:1080`, in their own proxy settings or in the Wi-Fi proxy
settings.
## See also
- [Keep secrets out of the Nix store](./secrets.md): secret files must be readable by your
user on home-manager and Nix-on-Droid.
+79
View File
@@ -0,0 +1,79 @@
# Route a single app
Run one program through the proxy, or through zapret, and leave the rest of the system
alone.
## Config
```nix
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
};
perAppRouting = {
enable = true;
createDefaultProfiles = true; # a profile named after each method below
proxychains.enable = true;
tun.enable = true;
};
};
```
## Run an app
```sh
proxy-ctl apps # list profiles
proxy-ctl apps run tun -- firefox
proxy-ctl apps run proxychains -- curl https://example.com
```
Run it as yourself, not with sudo.
## Which method
| Method | Covers | Notes |
|---|---|---|
| `proxychains` | TCP | Preloads a library into the app. Needs no privileges, but does not work with statically linked programs or most Go programs. |
| `tun` | TCP and UDP | Puts the app in its own cgroup and routes it into a separate TUN. Works with any program. |
| `tproxy` | TCP and UDP | Like `tun`, but intercepts with nftables. |
| `zapret` | What zapret handles | No proxy: runs a separate zapret for the app, to get past DPI. |
`tun` works with any program. `proxychains` is handy for a quick command.
## Your own profiles
Name profiles after what they are for, to keep commands short:
```nix
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
};
perAppRouting = {
enable = true;
tun.enable = true;
profiles = [ { name = "browser"; route = "tun"; } ];
};
};
```
Then run `proxy-ctl apps run browser -- chromium`.
## 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)).
- These three refuse to start while a global TUN or TProxy is running.
- 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.
## See also
- [`perAppRouting.profiles`](../options/perAppRouting.md#services-proxy-suite-perapprouting-profiles)
- [`perAppRouting.createDefaultProfiles`](../options/perAppRouting.md#services-proxy-suite-perapprouting-createdefaultprofiles)
+109
View File
@@ -0,0 +1,109 @@
# Choose what goes through the proxy
Decide per site whether traffic goes through the proxy, goes direct, or is blocked. This
applies to the local proxy, TUN, TProxy and per-app routing alike.
## How a destination is routed
1. `proxy.routing.rules`, in order. The first match wins, and a rule can name a specific
outbound.
2. The `proxy`, `direct` and `block` lists.
3. Anything left goes to `proxy.routing.default`: `"proxy"` (the default) or `"direct"`.
Russian sites and IPs go direct unless you set `routing.directRu = false`.
Each list and rule matches by `domains` (subdomains included), `ips` (CIDR), `geosites`,
`geoips` and `ruleSets`.
## Only blocked sites through the proxy
```nix
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
routing = {
default = "direct";
proxy.domains = [ "youtube.com" "googlevideo.com" ];
proxy.geosites = [ "instagram" ];
};
# Find blocked sites on its own, and route each one through an exit that reaches it.
autoProxy.enable = true;
};
};
```
`autoProxy` saves you from listing every blocked site. It probes new destinations in the
background and routes only those that fail directly. It needs the sing-box backend.
## Everything through the proxy, with exceptions
```nix
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [
{ tag = "nl-vps"; urlFile = "/run/secrets/nl-vps-url"; }
{ tag = "us-vps"; urlFile = "/run/secrets/us-vps-url"; }
];
routing = {
rules = [ { geosites = [ "netflix" ]; outbound = "us-vps"; } ];
direct.domains = [ "bank.example" ];
block.geosites = [ "category-ads-all" ];
};
};
};
```
## Rule sets
Rule sets are lists that sing-box downloads and refreshes on its own, so they stay current
without a rebuild. Name them in `routing.ruleSets` and use them in any `ruleSets` list:
```nix
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
routing = {
default = "direct";
ruleSets.blocked.url = "https://example.com/blocked.srs";
proxy.ruleSets = [ "blocked" ];
};
};
};
```
They need the sing-box or hybrid backend.
## Commands
```sh
proxy-ctl where youtube.com # how a site is routed right now, and why
proxy-ctl proxy mode whitelist # direct unless a rule says otherwise
proxy-ctl proxy mode blacklist # proxy unless a rule says otherwise
proxy-ctl proxy mode all-proxy # everything through the proxy, except blocks
proxy-ctl proxy mode all-bypass # everything direct, except blocks
proxy-ctl proxy mode default # back to routing.default
proxy-ctl proxy auto # what autoProxy routed, and where
proxy-ctl proxy rulesets update # refetch rule sets now
```
A route mode set with `proxy-ctl` lasts until the next reboot.
## Good to know
- Geosite and geoip names come from the [geodata](../options/geodata.md) databases.
- With `zapret`, sites that zapret handles are sent direct, so zapret can unblock them. See
[Unblock sites without a server](./zapret.md).
- To send some sites to WARP, Tor or another exit, see [Chain proxies and add exits](./chains.md).
## See also
- [`proxy.routing.rules`](../options/proxy.md#services-proxy-suite-proxy-routing-rules)
- [`proxy.routing.default`](../options/proxy.md#services-proxy-suite-proxy-routing-default)
- [`proxy.routing.ruleSets`](../options/proxy.md#services-proxy-suite-proxy-routing-rulesets)
- [`proxy.autoProxy`](../options/proxy.md#services-proxy-suite-proxy-autoproxy-enable)
+67
View File
@@ -0,0 +1,67 @@
# Keep secrets out of the Nix store
Everything in a Nix config is copied to `/nix/store`, which every user on the machine can
read. That includes proxy links, passwords and keys. So every option that holds a secret has
a `…File` twin, which takes a path that is read when the service starts:
| Inline (ends up in the store) | Use instead |
|---|---|
| `url` | `urlFile` |
| `password` | `passwordFile` |
| `uuid` | `uuidFile` |
| `vpn` | `vpnFile` |
| `privateKey` | `privateKeyFile` |
| `secret` | `secretFile` |
The option reference marks each inline one with "Ends up in the Nix store".
A file can stay owned by root with mode `0400`. The services read it as root when they start.
With home-manager and Nix-on-Droid, your own user must be able to read it.
## With sops-nix
```nix no-check
sops.secrets."proxy/my-vps-url" = { };
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [
{ tag = "my-vps"; urlFile = config.sops.secrets."proxy/my-vps-url".path; }
];
};
};
```
## With agenix
```nix no-check
age.secrets.my-vps-url.file = ./secrets/my-vps-url.age;
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [
{ tag = "my-vps"; urlFile = config.age.secrets.my-vps-url.path; }
];
};
};
```
## Without a secrets tool
Any path outside the store works, such as a root-only file you create by hand:
```sh
sudo install -D -m 0400 /dev/stdin /var/lib/proxy-secrets/my-vps-url <<< 'vless://…'
```
## Good to know
- A secret file that changes takes effect on the next restart: `proxy-ctl restart`.
- Anything added at runtime with `proxy-ctl` (outbounds, subscriptions) is kept outside the
store, readable by root and by the `userControl` group.
- Share links, subscription URLs and running configs contain secrets too. `proxy-ctl` shows
them only to root, and to `userControl` members with the `secrets` scope.
+110
View File
@@ -0,0 +1,110 @@
# Run your own server
Accept proxy clients on a VPS, and hand out share links, QR codes and subscriptions for
them. The listeners run on XRay, and AmneziaWG listeners run on AmneziaWG.
## A fresh VPS: the installer
If your provider lets you boot a custom ISO, build the installer:
```sh
nix build github:FUFSoB/proxy-suite-flake#installer-iso
```
Boot the VPS from it. The console installer asks for the public IP, users, an optional
domain and the disk to erase, then installs NixOS with `nixosModules.server`: VLESS
REALITY, TLS and WS listeners, ACME certificates and SSH. After the reboot, log in and run:
```sh
proxy-ctl inbounds link vless-reality --qr
```
## An existing NixOS host
```nix
services.proxy-suite = {
enable = true;
inbounds = {
enable = true;
serverAddress = "vpn.example.com"; # null: this host's public IPv4
routing.via = "direct"; # clients exit straight from this host
listeners = {
vless-reality = {
type = "vless";
port = 443;
flow = "xtls-rprx-vision";
users = [
{ name = "phone"; uuidFile = "/run/secrets/uuid-phone"; }
{ name = "laptop"; uuidFile = "/run/secrets/uuid-laptop"; }
];
reality = {
enable = true;
serverNames = [ "www.microsoft.com" ];
privateKeyFile = "/run/secrets/reality-private-key";
publicKey = "jNXH…"; # from the same `xray x25519` run
shortIds = [ "0123abcd" ];
};
};
# Keys for the server and each user are generated on first start.
awg = {
type = "amneziawg";
port = 51820;
users = [ { name = "phone"; } ];
};
};
};
};
```
Store the secrets with your secrets tool (see [Keep secrets out of the Nix store](./secrets.md)).
To make them:
```sh
uuidgen # one UUID per user
nix run nixpkgs#xray -- x25519 # the private key for the file, the public key for the config
```
The firewall opens the listener ports on its own. Other protocols (trojan, shadowsocks,
hysteria2, vmess, …) and transports (ws, grpc, xhttp) are set per listener; see
[`inbounds.listeners`](../options/inbounds.md#services-proxy-suite-inbounds-listeners).
## Share access
```sh
proxy-ctl inbounds # listeners
proxy-ctl inbounds link vless-reality phone --qr # link as a QR code for the phone
proxy-ctl inbounds link awg phone --config # AmneziaWG .conf
proxy-ctl inbounds stats # traffic per user
proxy-ctl inbounds online # who is connected
```
Subscriptions give each user one URL with their links from every listener, so clients pick
up changes on their own. Enable them and serve the directory with a web server:
```nix
services.proxy-suite.inbounds.subscriptions = {
enable = true;
baseUrl = "https://vpn.example.com/sub";
};
services.nginx.virtualHosts."vpn.example.com".locations."/sub/".alias =
"/run/proxy-suite-inbounds/subscriptions/";
```
Then `proxy-ctl inbounds sub phone --qr` prints that user's subscription.
## Good to know
- Clients cannot reach this host's LAN or Russian sites by default
(`inbounds.routing.blockPrivate`, `blockRu`).
- With `routing.via = "proxy"` (the default), client traffic goes through this host's own
proxy instead, following its routing. That needs `proxy.enable`. A listener can also exit
through one outbound with `via = "<tag>"`.
- For clients that cannot reach the server at all, `tor.onionService` serves the
listeners over Tor too.
## See also
- [`inbounds.listeners`](../options/inbounds.md#services-proxy-suite-inbounds-listeners)
- [`inbounds.routing.via`](../options/inbounds.md#services-proxy-suite-inbounds-routing-via)
- [`inbounds.subscriptions`](../options/inbounds.md#services-proxy-suite-inbounds-subscriptions-enable)
- [`tor.onionService`](../options/tor.md#services-proxy-suite-tor-onionservice-enable)
+61
View File
@@ -0,0 +1,61 @@
# Route the whole machine
Send every app's traffic through the proxy, including apps with no proxy settings. There
are two global modes, and either can start at boot.
## Config
```nix
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
tun.enable = true;
autostart = "tun"; # or null, to start it by hand
};
killSwitch.enable = true;
};
```
## TUN or TProxy
- **TUN** adds a virtual network interface and routes everything into it. It is the usual
pick.
- **TProxy** intercepts TCP and UDP with nftables instead of adding an interface. Pick it if
this host is a gateway for other devices: list their interfaces in
`proxy.tproxy.lanInterfaces` (NixOS needs `networking.nftables.enable` for that).
You can enable both and switch between them. Starting one global mode stops the other, and
an AmneziaWG profile running as a global VPN counts as one too.
Your [routing rules](./routing.md) still apply in both modes. Sites that the rules send
direct skip the proxy.
## Commands
```sh
proxy-ctl proxy tun on # or: off, toggle, restart
proxy-ctl proxy tproxy on
proxy-ctl status # which mode is running
proxy-ctl killswitch # kill switch state
proxy-ctl killswitch off # lift the kill switch without stopping the tunnel
```
## Good to know
- The kill switch blocks outgoing traffic while the tunnel restarts or after it fails, so
nothing leaks. LAN, DHCP and NTP stay open. Turning the tunnel off lifts it.
- If the uplink has no IPv6, set `proxy.dns.strategy = "ipv4_only"` (sing-box). Otherwise
direct IPv6 connections hang instead of falling back to IPv4.
- `proxy.tproxy.localSubnets` lists networks that skip TProxy. Add your LAN and VM bridges if
they are not in `192.168.0.0/16`.
- Per-app `tun`, `tproxy` and `zapret` profiles refuse to start while a global mode is on.
## See also
- [`proxy.tun`](../options/proxy.md#services-proxy-suite-proxy-tun-enable)
- [`proxy.tproxy`](../options/proxy.md#services-proxy-suite-proxy-tproxy-enable)
- [`proxy.autostart`](../options/proxy.md#services-proxy-suite-proxy-autostart)
- [`killSwitch.enable`](../options/killSwitch.md#services-proxy-suite-killswitch-enable)
- [`proxy.ipv6`](../options/proxy.md#services-proxy-suite-proxy-ipv6)
+87
View File
@@ -0,0 +1,87 @@
# Get past mobile whitelists
Some mobile networks let through only a whitelist of services, such as video calls, and
block everything else. [whitelist-bypass](https://github.com/kulikov0/whitelist-bypass)
tunnels your traffic through a video call on a whitelisted platform.
It takes two machines:
- a **creator** on a host with normal internet access, such as a VPS or a home machine. It
logs in to the call platform, starts a call and relays traffic to the internet;
- a **joiner** on the censored side, such as a laptop on mobile internet. It joins that call
and becomes an outbound for the proxy.
Supported platforms: `"wbstream"`, `"telemost"`, `"dion"` and `"bitrix"`. Each needs an
account for the creator.
## The creator
One creator per joiner device.
```nix
services.proxy-suite = {
enable = true;
whitelistBypass = {
enable = true;
creators.laptop = {
platform = "wbstream";
cookiesFile = "/run/secrets/wbstream-cookies.json";
};
};
};
```
The cookies come from the upstream desktop Creator app. They are read on first start, and
the login refreshes itself after that. `proxy-ctl wl auth laptop` replaces them at runtime,
and asks for an email and password instead on DION and Bitrix.
The creator starts a call and keeps reusing it. Get its link with:
```sh
proxy-ctl wl link laptop
```
## The joiner
The joiner is an outbound tagged with its name (`wl` here), so it needs the local proxy.
```nix
services.proxy-suite = {
enable = true;
proxy.enable = true;
whitelistBypass = {
enable = true;
joiners.wl.platform = "wbstream";
};
};
```
Give it the creator's link, then send traffic through it:
```sh
proxy-ctl wl join wl 'https://…' # the link from `proxy-ctl wl link`
proxy-ctl proxy pin wl
```
The link can also come from a file, with `joiners.<name>.linkFile`.
## Commands
```sh
proxy-ctl wl # creators and joiners, and their state
proxy-ctl wl new laptop # start a new call, if the platform closed the old one
proxy-ctl wl restart # restart all of them; or name one
```
## Good to know
- By default, the creator's traffic exits straight from its host. With
`creators.<name>.upstream = "proxy"`, it goes through that host's own proxy and routing.
- Use it when nothing else gets through, and `proxy-ctl proxy unpin` once other outbounds
work again.
- Pair it with [Route the whole machine](./system-wide.md) on the joiner to cover every app.
## See also
- [`whitelistBypass.creators`](../options/whitelistBypass.md#services-proxy-suite-whitelistbypass-creators)
- [`whitelistBypass.joiners`](../options/whitelistBypass.md#services-proxy-suite-whitelistbypass-joiners)
+79
View File
@@ -0,0 +1,79 @@
# Unblock sites without a server
zapret gets around DPI blocking by changing how the first packets of a connection look. It
needs no proxy server: the traffic still goes straight to the site. It only helps with
blocks that DPI enforces, and not with sites whose IPs are blocked outright.
## Ready-made presets: zapret-discord-youtube
The default engine. It covers YouTube and Discord out of the box.
```nix
services.proxy-suite = {
enable = true;
zapret = {
enable = true;
zapret-discord-youtube = {
configName = "general(ALT)"; # the default; try others if it does not work
domains = [ "rutracker.org" ]; # more sites to unblock
};
};
};
```
Which preset works depends on your ISP. If sites still do not load, try other presets from
the [zapret-discord-youtube](https://github.com/kartavkun/zapret-discord-youtube) list, such
as `"general (ALT9)"`.
## Blocked sites found automatically: zapret2
zapret2 notices failing connections, marks the site as blocked, and finds a strategy that
works for it. Each site's strategy is remembered.
```nix
services.proxy-suite = {
enable = true;
zapret = {
enable = true;
engine = "zapret2";
zapret2.domains = [ "rutracker.org" ]; # always treated as blocked
};
};
```
`zapret2.strategySource = "z2k"` switches to z2k's strategies and site lists, which include
the full RKN list and use more memory. It also turns on a workaround for ISPs that cut
TLS to some hosting networks after about 16 KB.
## Commands
```sh
proxy-ctl zapret # status
proxy-ctl zapret off # or: on, toggle, restart
proxy-ctl zapret auto # sites zapret2 learned
proxy-ctl zapret auto add example.com # treat a site as blocked
proxy-ctl zapret auto exclude example.com # never touch or learn a site
proxy-ctl zapret auto forget example.com # forget it and its strategy
proxy-ctl zapret cutoff # networks cut off at 16 KB (z2k)
```
## With a proxy
zapret and the proxy work side by side. By default (`zapret.directSync`), the sites zapret
handles are sent direct, so they skip the proxy and reach zapret. Everything else follows
your [routing rules](./routing.md).
To use zapret for a single app only, see [Route a single app](./per-app.md).
## Good to know
- zapret needs root, so it is not available with home-manager or Nix-on-Droid.
- If it breaks VMs or containers behind NAT, list their subnets in `zapret.cidrExemption`.
- For games, set `zapret-discord-youtube.gameFilter`.
## See also
- [`zapret.engine`](../options/zapret.md#services-proxy-suite-zapret-engine)
- [`zapret-discord-youtube.configName`](../options/zapret.md#services-proxy-suite-zapret-zapret-discord-youtube-configname)
- [`zapret2.strategySource`](../options/zapret.md#services-proxy-suite-zapret-zapret2-strategysource)
- [`zapret.directSync`](../options/zapret.md#services-proxy-suite-zapret-directsync-enable)
+9 -10
View File
@@ -16,24 +16,24 @@ let
in in
{ {
options.services.proxy-suite.amneziaWg = { options.services.proxy-suite.amneziaWg = {
enable = mkEnableOption "native AmneziaWG client profiles"; enable = mkEnableOption "AmneziaWG client profiles";
toolsPackage = mkOption { toolsPackage = mkOption {
type = types.package; type = types.package;
default = awgPackages.tools; default = awgPackages.tools;
description = "AWG 3.1 package providing awg and awg-quick."; description = "AWG 3.1 package with `awg` and `awg-quick`.";
}; };
userspacePackage = mkOption { userspacePackage = mkOption {
type = types.package; type = types.package;
default = awgPackages.userspace; default = awgPackages.userspace;
description = "AWG 3.1 userspace implementation used when the kernel interface is unavailable."; description = "AWG 3.1 userspace implementation, used when the kernel module is unavailable.";
}; };
wireproxyPackage = mkOption { wireproxyPackage = mkOption {
type = types.package; type = types.package;
default = awgPackages.wireproxy; default = awgPackages.wireproxy;
description = "wireproxy build with AWG 3.1 and FwMark, which runs profiles with asOutbound = \"userspace\"."; description = "wireproxy build with AWG 3.1, used by profiles with `asOutbound = \"userspace\"`.";
}; };
kernelModulePackage = mkOption { kernelModulePackage = mkOption {
@@ -43,19 +43,18 @@ in
kernelPackages = config.services.proxy-suite.host.kernelPackages; kernelPackages = config.services.proxy-suite.host.kernelPackages;
in in
if kernelPackages == null then null else awgPackages.kernelModule kernelPackages; if kernelPackages == null then null else awgPackages.kernelModule kernelPackages;
description = "AWG 3.1 kernel module package. Set null to use userspace-only fallback."; description = "AWG 3.1 kernel module package. `null`: userspace only.";
}; };
profiles = mkOption { profiles = mkOption {
type = types.attrsOf t.profileType; type = types.attrsOf t.profileType;
default = { }; default = { };
description = '' description = ''
Named AmneziaWG client profiles. Only one global profile can be active. AmneziaWG client profiles, by name. Each sets exactly one of `configFile`, `vpnFile`, `vpn`
or `settings`. Only one global profile can run at a time.
A profile moves to a new source port, keeping its routes, when a handshake goes When handshakes go unanswered, a profile switches to a new source port on its own.
unanswered: every 5 seconds while it starts (it gives up after 20), and when Setting `settings.listenPort` pins the port and turns this off.
proxy-suite-awg-NAME-watchdog sees a rekey not getting through. settings.listenPort
pins the port and turns that off.
''; '';
}; };
}; };
+3 -3
View File
@@ -11,8 +11,8 @@ in
default = pkgs.v2ray-rules-dat; default = pkgs.v2ray-rules-dat;
defaultText = literalExpression "pkgs.v2ray-rules-dat"; defaultText = literalExpression "pkgs.v2ray-rules-dat";
description = '' description = ''
Package with share/v2ray/{geoip,geosite}.dat for every XRay process. Null uses XRay's own Package with share/v2ray/{geoip,geosite}.dat for XRay. `null`: XRay's built-in data,
country-only data, where a tag like "geoip:telegram" stops XRay from starting. which only has countries, so a tag like "geoip:telegram" breaks XRay.
''; '';
}; };
@@ -21,7 +21,7 @@ in
type = types.package; type = types.package;
default = pkgs.sing-geoip; default = pkgs.sing-geoip;
defaultText = literalExpression "pkgs.sing-geoip"; defaultText = literalExpression "pkgs.sing-geoip";
description = "Package with share/sing-box/rule-set/geoip-NAME.srs (country codes by default)."; description = "Package with share/sing-box/rule-set/geoip-NAME.srs (countries by default).";
}; };
geosite = mkOption { geosite = mkOption {
+3 -4
View File
@@ -5,21 +5,20 @@ let
in in
{ {
options.services.proxy-suite.gui = { options.services.proxy-suite.gui = {
enable = mkEnableOption "Proxy Suite GUI, a desktop app with a tray icon for everything proxy-ctl controls at runtime"; enable = mkEnableOption "Proxy Suite GUI, a desktop app with a tray icon";
autostart = mkOption { autostart = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
description = '' description = ''
Start the GUI hidden in the tray with graphical sessions, as the Start the GUI in the tray on login to a graphical session.
`proxy-suite-gui` systemd user unit on `graphical-session.target`.
''; '';
}; };
refreshInterval = mkOption { refreshInterval = mkOption {
type = types.ints.positive; type = types.ints.positive;
default = 3; default = 3;
description = "Status refresh interval, in seconds."; description = "How often the status refreshes, in seconds.";
}; };
}; };
} }
+18 -18
View File
@@ -13,46 +13,46 @@ let
in in
{ {
options.services.proxy-suite.inbounds = { options.services.proxy-suite.inbounds = {
enable = mkEnableOption "server inbounds that accept proxy connections from outside"; enable = mkEnableOption "server inbounds, which accept proxy clients from outside";
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = proxySuiteUpstream.xray; default = proxySuiteUpstream.xray;
defaultText = literalMD "proxy-suite's `xray` (`pkgs/xray.nix`)"; defaultText = literalMD "proxy-suite's `xray` (`pkgs/xray.nix`)";
example = literalExpression "pkgs.xray"; example = literalExpression "pkgs.xray";
description = "XRay package serving the inbounds, whatever the client-side backend."; description = "XRay package that runs the inbounds, whichever client backend is used.";
}; };
serverAddress = mkOption { serverAddress = mkOption {
type = types.nullOr (types.strMatching "[^[:space:]]+"); type = types.nullOr (types.strMatching "[^[:space:]]+");
default = null; default = null;
description = "Public address clients connect to, used in share links. Null detects the uplink IPv4."; description = "Public address for share links. `null`: detect the uplink IPv4.";
example = "vpn.example.com"; example = "vpn.example.com";
}; };
openFirewall = bool true "Open every non-loopback listener port."; openFirewall = bool true "Open the firewall for every listener not on loopback.";
shareLinks = bool true "Write client share links for `proxy-ctl inbounds link` (root, and userControl.group with the secrets scope)."; shareLinks = bool true "Generate client share links for `proxy-ctl inbounds link`. Readable by root, and by `userControl.group` with the secrets scope.";
subscriptions = { subscriptions = {
enable = mkEnableOption "" // { enable = mkEnableOption "" // {
description = '' description = ''
Write one subscription file per user (their links from every listener, base64) to Generate a subscription per user, with their links from every listener, in
/run/proxy-suite-inbounds/subscriptions/<token>. Serve that directory with a web server; /run/proxy-suite-inbounds/subscriptions/<token>. Serve that directory with a web server.
see the README. Needs `shareLinks`.
''; '';
}; };
group = mkOption { group = mkOption {
type = types.str; type = types.str;
default = "nginx"; default = "nginx";
description = "Group allowed to read the subscription files: the web server serving them."; description = "Group of the web server that serves the subscription files.";
example = "caddy"; example = "caddy";
}; };
baseUrl = mkOption { baseUrl = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = "URL the subscription directory is served at, for `proxy-ctl inbounds sub`."; description = "Public URL of the subscription directory, used by `proxy-ctl inbounds sub`.";
example = "https://vpn.example.com/sub"; example = "https://vpn.example.com/sub";
}; };
}; };
@@ -63,27 +63,27 @@ in
type = types.str; type = types.str;
default = "proxy"; default = "proxy";
description = '' description = ''
Default egress of inbound traffic; listeners can override it: Where client traffic exits by default. Each listener can override it.
- "proxy": through the local proxy and its current selection (needs proxy.enable). - "proxy": through the local proxy and its current pick (needs `proxy.enable`).
- a proxy.outbounds tag: pinned to that server (url, urlFile or xrayJson outbounds only). - an outbound tag from `proxy.outbounds`: always that one (`url`, `urlFile` or `xrayJson` only).
- "direct": out from this machine. - "direct": straight from this host.
- "block": dropped. - "block": dropped.
''; '';
example = "direct"; example = "direct";
}; };
proxy = t.routingFields; proxy = t.routingFields "that clients always reach through the local proxy, whatever the listener's `via`";
blockRu = bool true ''Block Russian destinations (geosite "category-ru", geoip "ru").''; blockRu = bool true ''Block Russian destinations (geosite "category-ru", geoip "ru").'';
blockPrivate = bool true "Block private and loopback destinations, so clients cannot reach this host's LAN or local services."; blockPrivate = bool true "Block private and loopback addresses, so clients cannot reach this host's LAN or local services.";
zapretDirect = bool true "Send zapret's hostlist destinations direct, so this host's zapret unblocks them (default via only)."; zapretDirect = bool true "Send zapret hostlist sites direct, so this host's zapret unblocks them. Only for the default `via`.";
}; };
listeners = mkOption { listeners = mkOption {
type = types.attrsOf t.inboundType; type = types.attrsOf t.inboundType;
default = { }; default = { };
description = "Listeners by tag."; description = "Server listeners, by tag.";
example = literalExpression '' example = literalExpression ''
{ {
vless-reality = { vless-reality = {
+7 -7
View File
@@ -1,11 +1,11 @@
{ lib, ... }: { lib, ... }:
{ {
options.services.proxy-suite.killSwitch.enable = lib.mkEnableOption '' options.services.proxy-suite.killSwitch.enable = lib.mkEnableOption "the kill switch" // {
a kill switch for the global tunnels (proxy.tun, proxy.tproxy and global AmneziaWG profiles): description = ''
once one starts, outgoing traffic that would leave outside it is rejected, also while it Block outgoing traffic that bypasses the active global tunnel (TUN, TProxy or a global
restarts, after it crashes or after its handshake gives up. LAN destinations, DHCP and NTP AmneziaWG profile), including while it restarts or after it fails. LAN, DHCP and NTP stay
stay open; tproxy.lanInterfaces clients keep the LAN but lose the internet. Only open; `proxy.tproxy.lanInterfaces` devices keep the LAN but lose the internet. Only turning
`proxy-ctl killswitch off`, `proxy off`, `proxy tun off`, `proxy tproxy off` or `awg off` the tunnel off, or `proxy-ctl killswitch off`, lifts it.
lift it (proxy-suite-killswitch)
''; '';
};
} }
+19 -19
View File
@@ -24,8 +24,8 @@ in
type = types.bool; type = types.bool;
default = false; default = false;
description = '' description = ''
Add a profile named after each enabled backend (proxychains, tun, tproxy, zapret) unless Add a profile for each enabled method (proxychains, tun, tproxy, zapret), named after it,
one with that name already exists. unless one already exists.
''; '';
}; };
@@ -42,53 +42,53 @@ in
}; };
proxychains = { proxychains = {
enable = mkEnableOption "the proxychains backend (TCP apps, through LD_PRELOAD)"; enable = mkEnableOption "proxychains (TCP only, does not work with static binaries)";
quiet = mkOption { quiet = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
description = "Silence proxychains (quiet_mode)."; description = "Hide proxychains output.";
}; };
proxyDns = mkOption { proxyDns = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
description = "Resolve DNS through the proxy (proxy_dns)."; description = "Resolve DNS through the proxy.";
}; };
}; };
tun = { tun = {
enable = mkEnableOption "the per-app TUN backend"; enable = mkEnableOption "per-app TUN";
fwmark = int 16 "Mark that steers wrapped apps into routeTable."; fwmark = int 16 "Firewall mark for wrapped apps' traffic.";
routeTable = int 101 "Policy-routing table of the per-app TUN."; routeTable = int 101 "Routing table for the per-app TUN.";
localSubnets = localSubnets "Subnets wrapped apps reach directly (DNS excepted)."; localSubnets = localSubnets "Subnets that skip the proxy (DNS still goes through it).";
interface = mkOption { interface = mkOption {
type = types.str; type = types.str;
default = "psperapptun0"; default = "psperapptun0";
description = "Per-app TUN interface name."; description = "Interface name.";
}; };
address = mkOption { address = mkOption {
type = types.str; type = types.str;
default = "172.20.0.1/30"; default = "172.20.0.1/30";
description = "Per-app TUN interface address (CIDR)."; description = "Interface address (CIDR).";
}; };
mtu = int 1400 "Per-app TUN interface MTU."; mtu = int 1400 "Interface MTU.";
}; };
tproxy = { tproxy = {
enable = mkEnableOption "the per-app TProxy backend"; enable = mkEnableOption "per-app TProxy";
fwmark = int 17 "Mark that steers wrapped apps into routeTable."; fwmark = int 17 "Firewall mark for wrapped apps' traffic.";
routeTable = int 102 "Policy-routing table of the per-app TProxy."; routeTable = int 102 "Routing table for the per-app TProxy.";
localSubnets = localSubnets "Subnets that bypass interception (DNS excepted)."; localSubnets = localSubnets "Subnets that skip the proxy (DNS still goes through it).";
}; };
zapret = { zapret = {
enable = mkEnableOption "the per-app zapret backend: a second zapret instance for wrapped apps only"; enable = mkEnableOption "per-app zapret, a separate zapret for wrapped apps only";
filterMark = int 268435456 "Mark bit that selects wrapped app traffic."; filterMark = int 268435456 "Firewall mark bit for wrapped apps' traffic.";
qnum = int 201 "NFQUEUE number. Must differ from the global instance's."; qnum = int 201 "NFQUEUE number. Must differ from the global zapret's.";
}; };
}; };
} }
+16 -20
View File
@@ -20,9 +20,8 @@ in
type = "tcp"; type = "tcp";
}; };
description = '' description = ''
Resolver for direct traffic and the default domain resolver. Goes through the proxy in Resolver for direct traffic. In global TUN mode it goes through the proxy. TCP by default,
global TUN mode. TCP by default: plain UDP queries to well-known resolvers are often because ISP DPI often fakes UDP answers from well-known resolvers, which breaks zapret.
answered by the ISP's DPI instead, which breaks blocked names routed direct to zapret.
''; '';
example = { example = {
type = "tls"; type = "tls";
@@ -35,9 +34,8 @@ in
type = t.dnsUpstreamType; type = t.dnsUpstreamType;
default = cloudflare; default = cloudflare;
description = '' description = ''
Resolver used through the proxy; the DNS default when proxy.routing.default is proxy. On Resolver reached through the proxy. On sing-box, proxied names are always resolved here,
sing-box, names the routing sends through the proxy are always looked up here, so the ISP so the ISP never sees them. Also the default resolver when `proxy.routing.default` is "proxy".
never sees them, and direct ones locally.
''; '';
example = { example = {
type = "tls"; type = "tls";
@@ -56,7 +54,7 @@ in
] ]
); );
default = null; default = null;
description = "Which addresses sing-box asks for. `ipv4_only` for an uplink without IPv6. sing-box and hybrid backends."; description = "Which IP versions to resolve. Use `ipv4_only` if the uplink has no IPv6. sing-box and hybrid only.";
example = "ipv4_only"; example = "ipv4_only";
}; };
@@ -64,8 +62,8 @@ in
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = '' description = ''
EDNS client subnet sent with every query, so a resolver reached through the proxy still EDNS client subnet sent with every query, so CDNs pick servers near you even through the
answers with CDN nodes near this network. sing-box and hybrid backends. proxy. sing-box and hybrid only.
''; '';
example = "203.0.113.0/24"; example = "203.0.113.0/24";
}; };
@@ -75,19 +73,17 @@ in
type = types.bool; type = types.bool;
default = false; default = false;
description = '' description = ''
In TUN mode (global and per-app), answer A queries from the TUN with a fake address and Answer DNS in TUN mode with fake addresses that sing-box maps back to names. Saves a
AAAA ones with nothing; sing-box maps the address back to the name when the connection lookup per new site, and proxied names are never resolved locally. Direct names and those
comes. Saves a lookup per new site and no real lookup leaves for proxied names. Names that matched by `proxy.dns.singBox.rules` still get real answers. sing-box and hybrid only;
proxy.dns.singBox.rules or the direct routing lists send elsewhere keep real answers. The XRay's TUN has its own fake DNS.
addresses handed out are kept in /var/lib/proxy-suite/fakeip, so they survive a restart.
sing-box and hybrid backends; XRay's TUN already uses its own fake DNS.
''; '';
}; };
inet4Range = mkOption { inet4Range = mkOption {
type = types.str; type = types.str;
default = "198.18.0.0/15"; default = "198.18.0.0/15";
description = "Range the fake addresses come from."; description = "Address range for fake IPs.";
}; };
}; };
@@ -96,8 +92,8 @@ in
type = types.listOf types.attrs; type = types.listOf types.attrs;
default = [ ]; default = [ ];
description = '' description = ''
Extra sing-box DNS servers, as sing-box JSON, for proxy.dns.singBox.rules to name. The Extra DNS servers in sing-box JSON, for use in `proxy.dns.singBox.rules`. Built-in
built-in ones are `local`, `remote`, and `fakeip` when fakeIp is on. servers: `local`, `remote`, and `fakeip` when fake IP is on.
''; '';
example = [ example = [
{ {
@@ -112,8 +108,8 @@ in
type = types.listOf types.attrs; type = types.listOf types.attrs;
default = [ ]; default = [ ];
description = '' description = ''
sing-box DNS rules, as sing-box JSON, checked before the generated ones. Kept when the DNS rules in sing-box JSON, checked before the generated ones. Unlike those, they stay
route mode is all-proxy or all-bypass, which drop the generated ones. active in the all-proxy and all-bypass modes.
''; '';
example = [ example = [
{ {
+17 -19
View File
@@ -10,8 +10,9 @@ in
type = types.listOf t.outboundType; type = types.listOf t.outboundType;
default = [ ]; default = [ ];
description = '' description = ''
Static proxy outbounds. The proxy needs at least one outbound or subscription to start; Proxy servers to connect through. Each sets exactly one of `url`, `urlFile`, `singBoxJson`
`proxy-ctl proxy outbounds add` supplies one at runtime if none is declared here. or `xrayJson`. The proxy needs at least one outbound or subscription to start;
`proxy-ctl proxy outbounds add` can add one at runtime.
''; '';
example = [ example = [
{ {
@@ -29,9 +30,8 @@ in
type = types.listOf t.subscriptionType; type = types.listOf t.subscriptionType;
default = [ ]; default = [ ];
description = '' description = ''
Subscription URLs serving a base64 or plain list of proxy URIs. Fetched on first start, Subscription URLs that serve a list of proxy links (plain or base64). Fetched on first
cached under /var/lib/proxy-suite/subscriptions, refreshed by a timer. Ones added with start, cached, and refreshed on a timer. `proxy-ctl proxy subs add` adds more at runtime.
`proxy-ctl proxy subs add` live in /var/lib/proxy-suite/subscriptions.d and refresh alongside.
''; '';
example = [ example = [
{ {
@@ -56,14 +56,13 @@ in
]; ];
default = "first"; default = "first";
description = '' description = ''
How to pick among outbounds: How to pick an outbound:
- "first": one at a time - the pinned outbound, or the first available. - "first": the pinned one, or else the first available.
- "selector": all of them, pick by hand. - "selector": pick by hand.
- "urltest": all of them, ranked by latency unless one is pinned. - "urltest": the fastest, unless one is pinned.
`proxy-ctl proxy pin` pins an outbound in every mode, and the pin outlives a restart. `proxy-ctl proxy pin` works in every mode and survives restarts. On sing-box, "selector"
"selector" and "urltest" switch without restarting the backend (sing-box only); "first" and "urltest" switch without restarting the backend.
and XRay restart it.
''; '';
example = "urltest"; example = "urltest";
}; };
@@ -72,10 +71,9 @@ in
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
description = '' description = ''
Outbound tags selection never picks on its own: hops other outbounds chain through Outbound tags that selection never picks on its own, such as chain hops (`detour`) or
(`detour`), or exits only routing rules name. Subscription entries, `warp`, `ssh-proxy` exits meant only for routing rules. Any tag works, including subscription entries,
and AmneziaWG tags work too. A pin still reaches them, and so does a selector switched by `warp`, `ssh-proxy` and AmneziaWG. You can still pin or select them by hand.
hand.
''; '';
example = [ example = [
"ru-vps" "ru-vps"
@@ -87,21 +85,21 @@ in
url = mkOption { url = mkOption {
type = types.str; type = types.str;
default = "https://www.gstatic.com/generate_204"; default = "https://www.gstatic.com/generate_204";
description = "URL fetched through each outbound to rank them. Pick one blocked in your region."; description = "URL used to test outbounds. Pick one that is blocked in your region.";
example = "https://telegram.org"; example = "https://telegram.org";
}; };
interval = mkOption { interval = mkOption {
type = types.str; type = types.str;
default = "3m"; default = "3m";
description = "How often outbounds are re-tested (Go duration)."; description = "How often outbounds are tested (Go duration).";
example = "1m"; example = "1m";
}; };
tolerance = mkOption { tolerance = mkOption {
type = types.int; type = types.int;
default = 50; default = 50;
description = "Milliseconds a faster outbound must win by to replace the current one (sing-box only)."; description = "How many milliseconds faster an outbound must be to replace the current one (sing-box only).";
example = 100; example = 100;
}; };
}; };
+25 -26
View File
@@ -13,48 +13,48 @@ in
"direct" "direct"
]; ];
default = "proxy"; default = "proxy";
description = "Where traffic no routing rule matches goes."; description = "Where traffic goes when no rule matches.";
example = "direct"; example = "direct";
}; };
directRu = mkOption { directRu = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
description = ''Send geosite "category-ru" and geoip "ru" direct.''; description = ''Send Russian sites and IPs (geosite "category-ru", geoip "ru") direct.'';
}; };
proxy = { proxy = {
domains = list "Domain suffixes sent through the proxy." [ "youtube.com" ]; domains = list "Domains, with their subdomains, sent through the proxy." [ "youtube.com" ];
ips = list "IP CIDRs sent through the proxy." [ "1.1.1.0/24" ]; ips = list "IP ranges (CIDR) sent through the proxy." [ "1.1.1.0/24" ];
geosites = list "Geosite names sent through the proxy." [ "netflix" ]; geosites = list "Geosite categories sent through the proxy." [ "netflix" ];
geoips = list "Geoip names sent through the proxy." [ "us" ]; geoips = list "Geoip codes sent through the proxy." [ "us" ];
ruleSets = list "Names from ruleSets sent through the proxy." [ "antifilter" ]; ruleSets = list "Rule sets from `ruleSets` sent through the proxy." [ "antifilter" ];
}; };
direct = { direct = {
domains = domains =
list "Domain suffixes sent direct. zapret hostlists join them when zapret.directSync.enable is on." list "Domains, with their subdomains, sent direct. `zapret.directSync` adds zapret's domains."
[ [
"internal.example" "internal.example"
]; ];
ips = list "IP CIDRs sent direct." [ "10.10.0.0/16" ]; ips = list "IP ranges (CIDR) sent direct." [ "10.10.0.0/16" ];
geosites = list "Geosite names sent direct." [ "category-ru" ]; geosites = list "Geosite categories sent direct." [ "category-ru" ];
geoips = list "Geoip names sent direct." [ "ru" ]; geoips = list "Geoip codes sent direct." [ "ru" ];
ruleSets = list "Names from ruleSets sent direct." [ "ru-services" ]; ruleSets = list "Rule sets from `ruleSets` sent direct." [ "ru-services" ];
}; };
block = { block = {
domains = list "Domain suffixes blocked." [ "ads.example.com" ]; domains = list "Domains, with their subdomains, to block." [ "ads.example.com" ];
ips = list "IP CIDRs blocked." [ "203.0.113.0/24" ]; ips = list "IP ranges (CIDR) to block." [ "203.0.113.0/24" ];
geosites = list "Geosite names blocked." [ "category-ads-all" ]; geosites = list "Geosite categories to block." [ "category-ads-all" ];
geoips = list "Geoip names blocked." [ "cn" ]; geoips = list "Geoip codes to block." [ "cn" ];
ruleSets = list "Names from ruleSets blocked." [ "ads" ]; ruleSets = list "Rule sets from `ruleSets` to block." [ "ads" ];
}; };
rules = mkOption { rules = mkOption {
type = types.listOf t.routingRuleType; type = types.listOf t.routingRuleType;
default = [ ]; default = [ ];
description = "Rules checked before the proxy/direct/block lists, in order; the first match wins."; description = "Rules checked in order before the proxy, direct and block lists. The first match wins.";
example = [ example = [
{ {
outbound = "vps-de"; outbound = "vps-de";
@@ -73,7 +73,7 @@ in
options = { options = {
url = mkOption { url = mkOption {
type = types.strMatching "https?://.+"; type = types.strMatching "https?://.+";
description = "Where the sing-box rule set is downloaded from."; description = "URL of the sing-box rule set.";
example = "https://example.com/antifilter.srs"; example = "https://example.com/antifilter.srs";
}; };
format = mkOption { format = mkOption {
@@ -84,7 +84,7 @@ in
] ]
); );
default = null; default = null;
description = ''"binary" (.srs) or "source" (JSON). Null goes by the URL: .srs is binary.''; description = ''"binary" (.srs) or "source" (JSON). `null`: guess from the URL.'';
}; };
detour = mkOption { detour = mkOption {
type = types.enum [ type = types.enum [
@@ -92,17 +92,16 @@ in
"direct" "direct"
]; ];
default = "proxy"; default = "proxy";
description = "Downloaded through the local proxy, or directly."; description = "Download through the proxy or directly.";
}; };
}; };
} }
); );
default = { }; default = { };
description = '' description = ''
sing-box rule sets kept up to date at runtime, for the ruleSets of proxy, direct, block, Named sing-box rule sets, usable in any `ruleSets` list. They are downloaded every
rules and an outbound's routing. They are fetched every ruleSetUpdateInterval and on `ruleSetUpdateInterval` or on `proxy-ctl proxy rulesets update`, without a restart. A rule
`proxy-ctl proxy rulesets update`, and sing-box picks up a new file without a restart; set matches nothing until its first download. Not available with the "xray" backend.
until the first fetch one matches nothing. Not for backend = "xray".
''; '';
example = { example = {
antifilter.url = "https://example.com/antifilter.srs"; antifilter.url = "https://example.com/antifilter.srs";
@@ -112,7 +111,7 @@ in
ruleSetUpdateInterval = mkOption { ruleSetUpdateInterval = mkOption {
type = types.str; type = types.str;
default = "1d"; default = "1d";
description = "How often ruleSets are downloaded again (systemd time span)."; description = "How often rule sets are refreshed (systemd time span).";
example = "6h"; example = "6h";
}; };
}; };
+9 -9
View File
@@ -5,36 +5,36 @@ let
in in
{ {
options.services.proxy-suite.proxy.tproxy = { options.services.proxy-suite.proxy.tproxy = {
enable = mkEnableOption "global TProxy mode (proxy-suite-tproxy)"; enable = mkEnableOption "global TProxy mode";
port = mkOption { port = mkOption {
type = types.port; type = types.port;
default = 1085; default = 1085;
description = "Port of the TProxy inbound."; description = "Local port that intercepted traffic is redirected to.";
}; };
fwmark = mkOption { fwmark = mkOption {
type = types.int; type = types.int;
default = 1; default = 1;
description = "Mark of intercepted packets, routed through routeTable."; description = "Firewall mark for intercepted packets.";
}; };
proxyMark = mkOption { proxyMark = mkOption {
type = types.int; type = types.int;
default = 2; default = 2;
description = "Mark of the backend's own traffic, so it is not intercepted again."; description = "Firewall mark for the proxy's own traffic, so it is not intercepted again.";
}; };
routeTable = mkOption { routeTable = mkOption {
type = types.int; type = types.int;
default = 100; default = 100;
description = "Policy-routing table for intercepted traffic."; description = "Routing table for intercepted traffic.";
}; };
localSubnets = mkOption { localSubnets = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ "192.168.0.0/16" ]; default = [ "192.168.0.0/16" ];
description = "Subnets that bypass interception (DNS excepted): your LAN, VM bridges. IPv6 CIDRs work too."; description = "Subnets that skip the proxy, such as your LAN and VM bridges (DNS still goes through it). IPv6 works too.";
example = [ example = [
"192.168.0.0/16" "192.168.0.0/16"
"10.0.0.0/8" "10.0.0.0/8"
@@ -46,9 +46,9 @@ in
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
description = '' description = ''
Interfaces whose forwarded TCP and UDP is taken through the proxy too: devices on them LAN interfaces whose devices use this host as their gateway. Their TCP and UDP goes through the
that use this host as their gateway. Turns on IP forwarding for the rest (ping, the LAN proxy; everything else is forwarded as usual. Turns on IP forwarding. Needs the nftables
itself), which is routed as it is. Needs the nftables firewall on NixOS. firewall on NixOS.
''; '';
example = [ "br0" ]; example = [ "br0" ];
}; };
+1 -1
View File
@@ -5,7 +5,7 @@ let
in in
{ {
options.services.proxy-suite.proxy.tun = { options.services.proxy-suite.proxy.tun = {
enable = mkEnableOption "global TUN mode (proxy-suite-tun)"; enable = mkEnableOption "global TUN mode";
interface = mkOption { interface = mkOption {
type = types.str; type = types.str;
+28 -33
View File
@@ -26,8 +26,7 @@ in
]; ];
default = "sing-box"; default = "sing-box";
description = '' description = ''
Proxy backend. "hybrid" runs sing-box in front and hands XRay-only outbounds Proxy engine. "hybrid" runs sing-box and hands XRay-only outbounds (XHTTP, ECH) to XRay.
(XHTTP, ECH) to XRay.
''; '';
example = "hybrid"; example = "hybrid";
}; };
@@ -41,8 +40,8 @@ in
); );
default = null; default = null;
description = '' description = ''
Transparent mode started at boot, or null for neither. The mode named here must Transparent mode to start at boot, or `null` for none. That mode must also be enabled
also be enabled (proxy.tun.enable or proxy.tproxy.enable). (`proxy.tun.enable` or `proxy.tproxy.enable`).
''; '';
example = "tun"; example = "tun";
}; };
@@ -52,11 +51,9 @@ in
default = config.services.proxy-suite.host.enableIPv6; default = config.services.proxy-suite.host.enableIPv6;
defaultText = literalExpression "config.networking.enableIPv6"; defaultText = literalExpression "config.networking.enableIPv6";
description = '' description = ''
Carry IPv6 in the transparent modes: TProxy through a second listener on ::1, the TUNs Route IPv6 through TUN and TProxy too. When off, TProxy ignores IPv6 and the TUNs block
(global and per-app) through an IPv6 address of their own. Off, TProxy leaves IPv6 it, so apps fall back to IPv4. If the uplink has no IPv6, also set
alone and the TUNs block it, so apps fall back to IPv4. On an uplink without IPv6, `proxy.dns.strategy = "ipv4_only"`, or direct IPv6 connections hang instead of falling back.
set proxy.dns.strategy = "ipv4_only" too: a direct IPv6 destination would otherwise
fail after the connection seems open, instead of falling back to IPv4.
''; '';
}; };
@@ -64,7 +61,7 @@ in
address = mkOption { address = mkOption {
type = types.str; type = types.str;
default = "127.0.0.1"; default = "127.0.0.1";
description = ''Bind address of the local SOCKS5/HTTP proxy. Use "0.0.0.0" only to expose it to the network.''; description = ''Address of the local SOCKS5/HTTP proxy. Use "0.0.0.0" only to expose it to the network.'';
}; };
port = mkOption { port = mkOption {
@@ -77,14 +74,14 @@ in
username = mkOption { username = mkOption {
type = types.nullOr (types.strMatching "[^[:space:]]+"); type = types.nullOr (types.strMatching "[^[:space:]]+");
default = null; default = null;
description = "Username the local proxy requires. Set together with password or passwordFile."; description = "Username for the local proxy. Needs `password` or `passwordFile`.";
example = "proxy-user"; example = "proxy-user";
}; };
password = mkOption { password = mkOption {
type = types.nullOr (types.strMatching "[^[:space:]]+"); type = types.nullOr (types.strMatching "[^[:space:]]+");
default = null; default = null;
description = "Inline local proxy password. Ends up in the Nix store; prefer passwordFile."; description = "Password for the local proxy. Ends up in the Nix store; prefer `passwordFile`.";
example = "change-me"; example = "change-me";
}; };
@@ -92,8 +89,8 @@ in
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = '' description = ''
Runtime path to the local proxy password. With perAppRouting.proxychains it must be a File with the local proxy password. With `perAppRouting.proxychains` it must be a single
single token, and it is readable by userControl.group through the proxychains config. word, and `userControl.group` can read it through the proxychains config.
''; '';
example = "/run/secrets/proxy-suite-local-proxy-password"; example = "/run/secrets/proxy-suite-local-proxy-password";
}; };
@@ -103,32 +100,31 @@ in
autoProxy = { autoProxy = {
enable = mkEnableOption "autoProxy" // { enable = mkEnableOption "autoProxy" // {
description = '' description = ''
Probe each exit for the destinations clients dial, and route each one through the first Find out which destinations are blocked and route each one through the first exit that
exit that reaches it for as long as it keeps working (`proxy-ctl proxy auto probe` shows a reaches it. Blocks that zapret can fix stay direct. Needs the sing-box backend. This host
verdict). Censor-side failures stay direct for zapret. Needs the sing-box backend, and fetches every new destination itself to test it; `proxy-ctl proxy auto probe` shows the result.
makes this host fetch every new destination itself.
''; '';
}; };
interval = mkOption { interval = mkOption {
type = types.str; type = types.str;
default = "10m"; default = "10m";
description = "Time between probe runs. `proxy-ctl proxy auto learn` does not wait for it."; description = "Time between probe runs. `proxy-ctl proxy auto learn` probes right away.";
example = "30m"; example = "30m";
}; };
probesPerRun = mkOption { probesPerRun = mkOption {
type = types.ints.positive; type = types.ints.positive;
default = 200; default = 200;
description = "Most destinations probed per run; the rest wait in a backlog, most-dialled first."; description = "Maximum destinations probed per run. The rest wait for the next run, most-used first.";
}; };
maxExits = mkOption { maxExits = mkOption {
type = types.ints.positive; type = types.ints.positive;
default = 12; default = 12;
description = '' description = ''
Most exits probed, direct included. The first round tries one exit per network (AS), a Maximum exits tried per destination, direct included. One exit per network is tried
second round the rest. first, then the rest.
''; '';
}; };
@@ -136,9 +132,8 @@ in
type = types.ints.positive; type = types.ints.positive;
default = 30; default = 30;
description = '' description = ''
Days a verdict stands, routed destinations included: a route is re-probed once this long Days before a result is probed again. Everything is probed again when this host's public
has passed. Everything is relearned when this host's public address changes, and address changes.
`proxy-ctl proxy auto learn <domain>` re-probes one destination right away.
''; '';
}; };
@@ -146,8 +141,8 @@ in
type = types.ints.unsigned; type = types.ints.unsigned;
default = 150; default = 150;
description = '' description = ''
Also route destinations that work directly but crawl: at least 300 KiB in a 10 s sample, Also route destinations that work directly but stay slower than this, in KiB/s. 0 disables.
never faster than this. 0 disables. Needs `selection` other than "first". Needs `selection` other than "first".
''; '';
example = 0; example = 0;
}; };
@@ -155,7 +150,7 @@ in
exclude = mkOption { exclude = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
description = "Domain suffixes never probed or auto-routed."; description = "Domains (with subdomains) never probed or routed by autoProxy.";
example = [ "internal.example" ]; example = [ "internal.example" ];
}; };
@@ -163,8 +158,8 @@ in
type = types.port; type = types.port;
default = 18540; default = 18540;
description = '' description = ''
First loopback port of the per-exit probe listeners (one per exit, maxExits in total). First of `maxExits` loopback ports used for probing, one per exit. They have no
They are unauthenticated even when proxy.listener.auth is set. authentication, even with `proxy.listener.auth` set.
''; '';
}; };
}; };
@@ -175,13 +170,13 @@ in
default = proxySuiteUpstream.sing-box; default = proxySuiteUpstream.sing-box;
defaultText = literalMD "`sing-box` from proxy-suite's own `nixpkgs` input"; defaultText = literalMD "`sing-box` from proxy-suite's own `nixpkgs` input";
example = literalExpression "pkgs.sing-box"; example = literalExpression "pkgs.sing-box";
description = ''sing-box package, used when backend is "sing-box" or "hybrid".''; description = ''sing-box package, for the "sing-box" and "hybrid" backends.'';
}; };
clashApiPort = mkOption { clashApiPort = mkOption {
type = types.port; type = types.port;
default = 9090; default = 9090;
description = "Loopback port of sing-box's Clash API, which switches and tests outbounds."; description = "Loopback port of the sing-box Clash API, used to switch and test outbounds.";
}; };
}; };
@@ -191,7 +186,7 @@ in
default = proxySuiteUpstream.xray; default = proxySuiteUpstream.xray;
defaultText = literalMD "proxy-suite's `xray` (`pkgs/xray.nix`)"; defaultText = literalMD "proxy-suite's `xray` (`pkgs/xray.nix`)";
example = literalExpression "pkgs.xray"; example = literalExpression "pkgs.xray";
description = ''XRay package, used when backend is "xray" or "hybrid".''; description = ''XRay package, for the "xray" and "hybrid" backends.'';
}; };
}; };
}; };
+10 -9
View File
@@ -7,7 +7,7 @@ let
in in
{ {
options.services.proxy-suite.sshProxy = { options.services.proxy-suite.sshProxy = {
enable = mkEnableOption "an SSH dynamic SOCKS5 tunnel"; enable = mkEnableOption "an SSH SOCKS5 tunnel";
# Where the tunnel goes. # Where the tunnel goes.
server = { server = {
@@ -36,24 +36,25 @@ in
type = types.bool; type = types.bool;
default = false; default = false;
description = '' description = ''
Add the tunnel as an outbound tagged "ssh-proxy". sing-box dials SSH itself; XRay goes Add the tunnel as an outbound tagged "ssh-proxy". On sing-box and hybrid, sing-box connects
through the OpenSSH unit's SOCKS listener. over SSH itself and needs `hostKey` or `hostKeyFile`. Otherwise OpenSSH runs a SOCKS listener, set up
by `listener`, `knownHostsFile`, `strictHostKeyChecking`, `serviceUser` and `extraArgs`.
''; '';
}; };
identityFile = path "Runtime path to the private key; it may stay root-only, as the daemons get a copy they can read. Null uses the agent or OpenSSH defaults." "/run/secrets/proxy-suite-ssh-key"; identityFile = path "File with the SSH private key. It can stay root-only. `null`: the agent or OpenSSH defaults." "/run/secrets/proxy-suite-ssh-key";
hostKey = mkOption { hostKey = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
description = '' description = ''
Accepted host keys (sing-box). List every key `ssh-keyscan` prints: the algorithm is Accepted host keys, for sing-box. List every key `ssh-keyscan` prints, since the key type
negotiated. Empty accepts any key. is negotiated.
''; '';
example = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI..." ]; example = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI..." ];
}; };
hostKeyFile = path "Known-hosts file to read hostKey from at runtime (sing-box). Wins over hostKey." "/root/.ssh/known_hosts"; hostKeyFile = path "Known-hosts file to read host keys from (sing-box). Takes priority over `hostKey`." "/root/.ssh/known_hosts";
# The rest only apply to the OpenSSH unit (XRay, or asOutbound = false). # The rest only apply to the OpenSSH unit (XRay, or asOutbound = false).
knownHostsFile = path "Known-hosts file for OpenSSH." "/run/secrets/proxy-suite-ssh-known-hosts"; knownHostsFile = path "Known-hosts file for OpenSSH." "/run/secrets/proxy-suite-ssh-known-hosts";
@@ -87,7 +88,7 @@ in
serviceUser = mkOption { serviceUser = mkOption {
type = token; type = token;
default = "proxy-suite-daemon"; default = "proxy-suite-daemon";
description = "Unix user running the OpenSSH unit. The default, proxy-suite-daemon, runs sandboxed and keeps accepted host keys in /var/lib/proxy-suite/ssh; null runs it as root."; description = "User that runs OpenSSH. The default is sandboxed; `null` runs it as root.";
example = "proxy"; example = "proxy";
}; };
@@ -111,7 +112,7 @@ in
] ]
); );
default = null; default = null;
description = "Resolve destinations locally before the tunnel (XRay only). Can break geo-steered CDNs."; description = "Resolve names locally instead of on the server (XRay only). Can make CDNs pick distant servers.";
example = "prefer_ipv4"; example = "prefer_ipv4";
}; };
}; };
+17 -17
View File
@@ -6,40 +6,40 @@ let
in in
{ {
options.services.proxy-suite.tgWsProxy = { options.services.proxy-suite.tgWsProxy = {
enable = mkEnableOption "the Telegram MTProto WebSocket proxy"; enable = mkEnableOption "the Telegram WebSocket proxy (MTProto)";
listener = { listener = {
address = mkOption { address = mkOption {
type = types.str; type = types.str;
default = "127.0.0.1"; default = "127.0.0.1";
description = "Bind address."; description = "Listening address.";
}; };
port = mkOption { port = mkOption {
type = types.port; type = types.port;
default = 1443; default = 1443;
description = "Listen port."; description = "Listening port.";
}; };
}; };
secret = mkOption { secret = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = "Inline MTProto secret (`openssl rand -hex 16`). Ends up in the Nix store; prefer secretFile."; description = "MTProto secret (`openssl rand -hex 16`). Ends up in the Nix store; prefer `secretFile`.";
example = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; example = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
}; };
secretFile = mkOption { secretFile = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = "Runtime path to the MTProto secret."; description = "File with the MTProto secret.";
example = "/run/secrets/tg-ws-proxy-secret"; example = "/run/secrets/tg-ws-proxy-secret";
}; };
dcIps = mkOption { dcIps = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
default = { }; default = { };
description = "Relay IP per Telegram DC ID."; description = "Relay IP for each Telegram DC ID.";
example = { example = {
"2" = "149.154.167.220"; "2" = "149.154.167.220";
}; };
@@ -48,25 +48,25 @@ in
fakeTlsDomain = mkOption { fakeTlsDomain = mkOption {
type = types.nullOr (types.strMatching ".+"); type = types.nullOr (types.strMatching ".+");
default = null; default = null;
description = "SNI for Fake TLS masking (ee-secret links)."; description = "Domain to disguise traffic as, with Fake TLS (ee-secret links).";
example = "www.example.com"; example = "www.example.com";
}; };
cloudflare = { cloudflare = {
domains = domains "Cloudflare-proxied domains for WebSocket fallback." [ "cdn.example.com" ]; domains = domains "Domains behind Cloudflare to fall back to." [ "cdn.example.com" ];
workerDomains = domains "Cloudflare Worker domains, tried first." [ "worker.example.com" ]; workerDomains = domains "Cloudflare Worker domains, tried first." [ "worker.example.com" ];
fallback = mkOption { fallback = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
description = "Fall back to Cloudflare when direct WebSocket fails."; description = "Fall back to Cloudflare when a direct WebSocket fails.";
}; };
}; };
poolSize = mkOption { poolSize = mkOption {
type = types.ints.unsigned; type = types.ints.unsigned;
default = 4; default = 4;
description = "WebSocket pool size per DC; 0 disables pooling."; description = "Idle WebSockets kept open per DC. 0 disables.";
}; };
bufferKiB = mkOption { bufferKiB = mkOption {
@@ -78,45 +78,45 @@ in
proxyProtocol = mkOption { proxyProtocol = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = "Accept a PROXY protocol v1 header from a fronting reverse proxy."; description = "Accept a PROXY protocol v1 header from a reverse proxy in front.";
}; };
bypassTransparentProxy = mkOption { bypassTransparentProxy = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
description = "Keep the relay's own connections out of TUN/TProxy, which would otherwise loop them."; description = "Keep the relay's own connections out of TUN and TProxy, so they do not loop.";
}; };
fwmark = mkOption { fwmark = mkOption {
type = types.int; type = types.int;
default = 4; default = 4;
description = "Packet mark bypassTransparentProxy uses."; description = "Firewall mark for `bypassTransparentProxy`.";
}; };
log = { log = {
verbose = mkOption { verbose = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = "Debug logging."; description = "Log debug messages.";
}; };
file = mkOption { file = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = "Rotating log file, written as the proxy-suite-daemon user; /var/log/proxy-suite-tg-ws-proxy is created for it. Null logs to stderr."; description = "Log file, rotated. `null`: log to the journal.";
example = "/var/log/proxy-suite-tg-ws-proxy/tg-ws-proxy.log"; example = "/var/log/proxy-suite-tg-ws-proxy/tg-ws-proxy.log";
}; };
maxSizeMiB = mkOption { maxSizeMiB = mkOption {
type = types.numbers.positive; type = types.numbers.positive;
default = 5.0; default = 5.0;
description = "Log size before rotation, in MiB."; description = "Rotate the log at this size, in MiB.";
}; };
keep = mkOption { keep = mkOption {
type = types.ints.positive; type = types.ints.positive;
default = 1; default = 1;
description = "Rotated logs kept."; description = "Number of rotated logs to keep.";
}; };
}; };
}; };
+27 -31
View File
@@ -18,21 +18,23 @@ let
in in
{ {
options.services.proxy-suite.tor = { options.services.proxy-suite.tor = {
enable = mkEnableOption "the Tor daemon (proxy-suite-tor)"; enable = mkEnableOption "Tor" // {
description = "Run Tor. Also turn on `asOutbound`, `onionService.enable`, or both.";
};
package = package "tor" "Tor package."; package = package "tor" "Tor package.";
lyrebirdPackage = package "lyrebird" "Pluggable transport for obfs4, webtunnel and meek_lite bridges."; lyrebirdPackage = package "lyrebird" "Bridge transport for obfs4, webtunnel and meek_lite.";
snowflakePackage = package "snowflake" "Pluggable transport for snowflake bridges."; snowflakePackage = package "snowflake" "Bridge transport for snowflake.";
asOutbound = mkOption { asOutbound = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = '' description = ''
Add Tor as an outbound tagged "tor": a SOCKS hop to proxy-suite-tor on 127.0.0.1:socksPort, Add Tor as an outbound tagged "tor". Selection and autoProxy skip it unless it is the only
which receives names unresolved. proxy.selection and autoProxy leave it alone unless it is the outbound; send traffic to it with `proxy.routing.rules` or use it as a `detour`.
only outbound; route to it with proxy.routing.rules or name it as a detour. Requires proxy.enable. Needs `proxy.enable`.
''; '';
}; };
@@ -40,10 +42,8 @@ in
type = types.bool; type = types.bool;
default = true; default = true;
description = '' description = ''
Send .onion names to the "tor" outbound in every route mode, and keep them away from DNS: Send .onion names to the "tor" outbound in every route mode, and never resolve them with
in TUN and TProxy modes sing-box answers them with a fake address it maps back to the name, DNS. Inbound clients' .onion names go there too. Needs `asOutbound`.
and XRay drops the lookup. Inbound clients' .onion names go the same way, through the local
proxy, whatever their listener's via (except "block"). Applies with asOutbound.
''; '';
}; };
@@ -51,9 +51,8 @@ in
type = types.bool; type = types.bool;
default = true; default = true;
description = '' description = ''
Keep Tor a client (ClientOnly 1): never a relay, exit, bridge or directory server, even when Keep Tor a client, never a relay, even if `extraConfig` sets an ORPort. The onion service
extraConfig sets an ORPort. The onion service works either way. Turn off only to run a relay works either way. Turn off only to run a relay through `extraConfig`.
through extraConfig.
''; '';
}; };
@@ -64,17 +63,17 @@ in
]; ];
default = "direct"; default = "direct";
description = '' description = ''
How Tor reaches its relays or bridges. How Tor reaches the network.
- "direct": from the uplink, past TUN and TProxy (it runs as proxy-suite-daemon). - "direct": straight from the uplink, bypassing TUN and TProxy.
- "proxy": through the local proxy listener (proxy.listener, with its auth), for a network - "proxy": through the local proxy, for networks that block Tor. Works with obfs4,
that blocks Tor. obfs4, webtunnel and meek_lite bridges follow it; snowflake cannot. webtunnel and meek_lite bridges, but not snowflake.
''; '';
}; };
socksPort = mkOption { socksPort = mkOption {
type = types.port; type = types.port;
default = 18530; default = 18530;
description = "Loopback SOCKS port of proxy-suite-tor, which the tor outbound dials."; description = "Loopback SOCKS port of Tor.";
}; };
bridges = { bridges = {
@@ -82,9 +81,8 @@ in
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
description = '' description = ''
Bridge lines, as https://bridges.torproject.org hands them out, without the leading Bridge lines from https://bridges.torproject.org, without the leading "Bridge". Setting
"Bridge". Any given turns on UseBridges; obfs4, webtunnel, meek_lite and snowflake any turns bridges on.
transports are run as needed.
''; '';
example = [ example = [
"obfs4 192.0.2.1:443 0123456789ABCDEF0123456789ABCDEF01234567 cert=... iat-mode=0" "obfs4 192.0.2.1:443 0123456789ABCDEF0123456789ABCDEF01234567 cert=... iat-mode=0"
@@ -94,24 +92,23 @@ in
file = mkOption { file = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = "Runtime path to more bridge lines, one per line; blank lines and # comments are skipped."; description = "File with more bridge lines, one per line. Blank lines and # comments are skipped.";
example = "/run/secrets/tor-bridges"; example = "/run/secrets/tor-bridges";
}; };
}; };
onionService = { onionService = {
enable = mkEnableOption "an onion service in front of inbounds.listeners"; enable = mkEnableOption "an onion service for the server inbounds";
listeners = mkOption { listeners = mkOption {
type = types.nullOr (types.listOf types.str); type = types.nullOr (types.listOf types.str);
default = null; default = null;
description = '' description = ''
inbounds.listeners served at the onion address, each on its share port. Null takes every Listeners reachable through the onion address. `null`: every TCP listener (not
listener a TCP-only onion can carry: not amneziawg, h3-only xhttp or raw JSON. amneziawg, h3-only xhttp or raw JSON).
Share links for them (`proxy-ctl inbounds link TAG --onion`, and subscriptions) dial the Get their links with `proxy-ctl inbounds link TAG --onion`; subscriptions include them.
.onion address and keep the listener's TLS and REALITY names. Clients reach XRay from Onion clients do not show up in `proxy-ctl inbounds online`.
127.0.0.1, so `proxy-ctl inbounds online` does not list them.
''; '';
example = [ "vless-reality" ]; example = [ "vless-reality" ];
}; };
@@ -120,8 +117,7 @@ in
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = '' description = ''
Runtime path to an hs_ed25519_secret_key, to keep an onion address. Null lets Tor create File with an hs_ed25519_secret_key, to keep a fixed onion address. `null`: Tor creates one.
one in /var/lib/proxy-suite/tor/onion.
''; '';
example = "/run/secrets/tor-hs_ed25519_secret_key"; example = "/run/secrets/tor-hs_ed25519_secret_key";
}; };
@@ -130,7 +126,7 @@ in
extraConfig = mkOption { extraConfig = mkOption {
type = types.lines; type = types.lines;
default = ""; default = "";
description = "Lines appended to the generated torrc."; description = "Extra torrc lines.";
example = '' example = ''
ExitNodes {de},{nl} ExitNodes {de},{nl}
StrictNodes 1 StrictNodes 1
+1 -3
View File
@@ -1,8 +1,6 @@
{ lib, ... }: { lib, ... }:
{ {
options.services.proxy-suite.tui.enable = options.services.proxy-suite.tui.enable = lib.mkEnableOption "proxy-tui, a terminal UI" // {
lib.mkEnableOption "proxy-tui, an interactive terminal UI for everything proxy-ctl controls at runtime"
// {
default = true; default = true;
}; };
} }
+16 -12
View File
@@ -4,15 +4,19 @@ let
inherit (lib) mkOption types; inherit (lib) mkOption types;
inherit (import ./lib.nix { inherit lib; }) list; inherit (import ./lib.nix { inherit lib; }) list;
routingFields = { # `what` ends each description, saying where the matches go.
domains = list "Domain suffixes to match." [ "youtube.com" ]; routingFields = what: {
ips = list "IP CIDRs to match." [ "1.1.1.0/24" ]; domains = list "Domains, with their subdomains, ${what}." [ "youtube.com" ];
geosites = list "Geosite names to match (see geodata)." [ "netflix" ]; ips = list "IP ranges (CIDR) ${what}." [ "1.1.1.0/24" ];
geoips = list "Geoip names to match (see geodata; the defaults are country codes only)." [ "us" ]; geosites = list "Geosite categories ${what} (see `geodata`)." [ "netflix" ];
geoips = list "Geoip codes ${what}; countries by default (see `geodata`)." [ "us" ];
}; };
# The client's routing also matches downloaded rule sets, which XRay cannot read. # The client's routing also matches downloaded rule sets, which XRay cannot read.
clientRoutingFields = routingFields // { clientRoutingFields =
ruleSets = list "Names from proxy.routing.ruleSets to match (sing-box and hybrid backends)." [ what:
routingFields what
// {
ruleSets = list "Rule sets from `proxy.routing.ruleSets` ${what} (sing-box and hybrid only)." [
"antifilter" "antifilter"
]; ];
}; };
@@ -21,11 +25,11 @@ let
options = { options = {
outbound = mkOption { outbound = mkOption {
type = types.str; type = types.str;
description = ''Outbound tag, or "proxy", "direct", "block".''; description = ''Outbound tag, or "proxy", "direct" or "block".'';
example = "vps-de"; example = "vps-de";
}; };
} }
// clientRoutingFields; // clientRoutingFields "that this rule matches";
}; };
dnsUpstreamType = types.submodule { dnsUpstreamType = types.submodule {
@@ -58,7 +62,7 @@ let
options = { options = {
name = mkOption { name = mkOption {
type = types.strMatching "^[a-z0-9][a-z0-9-]*$"; type = types.strMatching "^[a-z0-9][a-z0-9-]*$";
description = "Profile name, unique."; description = "Unique profile name.";
example = "steam-browser"; example = "steam-browser";
}; };
@@ -72,8 +76,8 @@ let
]; ];
default = "proxychains"; default = "proxychains";
description = '' description = ''
Backend: "direct" (unchanged), "proxychains", or the per-app "tun", "tproxy" or "zapret" How the app is routed: "direct" (untouched), "proxychains", or the per-app "tun",
backend of perAppRouting. "tproxy" or "zapret".
''; '';
}; };
}; };
@@ -16,21 +16,21 @@ let
options = { options = {
publicKey = mkOption { publicKey = mkOption {
type = types.strMatching "[^[:space:]]+"; type = types.strMatching "[^[:space:]]+";
description = "AmneziaWG peer public key."; description = "Peer public key.";
}; };
presharedKey = mkOption { presharedKey = mkOption {
type = optionalString; type = optionalString;
default = null; default = null;
description = "Inline peer preshared key. Prefer presharedKeyFile for secrets."; description = "Peer preshared key. Ends up in the Nix store; prefer `presharedKeyFile`.";
}; };
presharedKeyFile = mkOption { presharedKeyFile = mkOption {
type = optionalString; type = optionalString;
default = null; default = null;
description = "Runtime path containing the peer preshared key."; description = "File with the peer preshared key.";
}; };
allowedIPs = mkOption { allowedIPs = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
description = "IP prefixes routed to and accepted from this peer."; description = "IP ranges routed to and accepted from this peer.";
example = [ example = [
"0.0.0.0/0" "0.0.0.0/0"
"::/0" "::/0"
@@ -40,17 +40,17 @@ let
type = optionalString; type = optionalString;
default = null; default = null;
example = "vpn.example.com:51820"; example = "vpn.example.com:51820";
description = "Optional peer endpoint in host:port form."; description = "Peer address, as host:port.";
}; };
persistentKeepalive = mkOption { persistentKeepalive = mkOption {
type = optionalRange; type = optionalRange;
default = null; default = null;
description = "Persistent keepalive seconds, optionally expressed as an AWG 3 range."; description = "Keepalive interval in seconds, or an AWG 3 range.";
}; };
advancedSecurity = mkOption { advancedSecurity = mkOption {
type = types.nullOr types.bool; type = types.nullOr types.bool;
default = null; default = null;
description = "Optional AWG peer AdvancedSecurity setting."; description = "AWG AdvancedSecurity setting.";
}; };
}; };
}; };
@@ -92,8 +92,8 @@ let
i3 = "Third custom signature packet (I3)."; i3 = "Third custom signature packet (I3).";
i4 = "Fourth custom signature packet (I4)."; i4 = "Fourth custom signature packet (I4).";
i5 = "Fifth custom signature packet (I5)."; i5 = "Fifth custom signature packet (I5).";
headerProtectionKey = "Inline AWG 3 header-protection key. Prefer headerProtectionKeyFile."; headerProtectionKey = "AWG 3 header-protection key. Ends up in the Nix store; prefer `headerProtectionKeyFile`.";
headerProtectionKeyFile = "Runtime path containing the AWG 3 header-protection key."; headerProtectionKeyFile = "File with the AWG 3 header-protection key.";
} }
// lib.mapAttrs (_: optional (types.nullOr types.bool)) { // lib.mapAttrs (_: optional (types.nullOr types.bool)) {
randomTrailers = "AWG 3 random transport trailers (RandomTrailers)."; randomTrailers = "AWG 3 random transport trailers (RandomTrailers).";
@@ -106,38 +106,38 @@ let
addresses = mkOption { addresses = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
description = "IP prefixes assigned to the AWG interface."; description = "Interface addresses.";
example = [ "10.8.0.2/32" ]; example = [ "10.8.0.2/32" ];
}; };
dns = mkOption { dns = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
description = "DNS servers installed while this profile is active."; description = "DNS servers used while this profile is active.";
}; };
privateKey = mkOption { privateKey = mkOption {
type = optionalString; type = optionalString;
default = null; default = null;
description = "Inline client private key. Prefer privateKeyFile."; description = "Client private key. Ends up in the Nix store; prefer `privateKeyFile`.";
}; };
privateKeyFile = mkOption { privateKeyFile = mkOption {
type = optionalString; type = optionalString;
default = null; default = null;
description = "Runtime path containing the client private key."; description = "File with the client private key.";
}; };
listenPort = mkOption { listenPort = mkOption {
type = types.nullOr types.port; type = types.nullOr types.port;
default = null; default = null;
description = "Optional local UDP listen port."; description = "Local UDP port.";
}; };
mtu = mkOption { mtu = mkOption {
type = optionalUnsigned; type = optionalUnsigned;
default = null; default = null;
description = "Optional interface MTU."; description = "Interface MTU.";
}; };
table = mkOption { table = mkOption {
type = optionalString; type = optionalString;
default = null; default = null;
description = "wg-quick routing table name/number, auto, or off."; description = "Routing table: a name or number, \"auto\" or \"off\".";
}; };
obfuscation = mkOption { obfuscation = mkOption {
type = obfuscationType; type = obfuscationType;
@@ -149,14 +149,10 @@ let
default = null; default = null;
example = "/run/secrets/awg-obfuscation.json"; example = "/run/secrets/awg-obfuscation.json";
description = '' description = ''
Runtime path to a partial JSON object using the same field names and File with secret obfuscation settings as JSON, using the same fields as `obfuscation`
value types as obfuscation, excluding headerProtectionKeyFile. (except `headerProtectionKeyFile`). It is merged with `obfuscation` at startup and never
Values are combined with public obfuscation settings at service startup enters the Nix store. A field set in both places is an error. Restart the profile after
without putting the file contents in the Nix store. Omitted or null changing the file.
fields are unset; duplicate JSON keys and fields set in both sources
are rejected. A file-provided headerProtectionKey also conflicts with
obfuscation.headerProtectionKeyFile. Private and preshared keys use
their existing file options. Restart the profile after secret rotation.
''; '';
}; };
peers = mkOption { peers = mkOption {
@@ -174,12 +170,12 @@ let
interfaceName = mkOption { interfaceName = mkOption {
type = types.strMatching "^[A-Za-z0-9_.-]{1,15}$"; type = types.strMatching "^[A-Za-z0-9_.-]{1,15}$";
default = "awg-${name}"; default = "awg-${name}";
description = "Linux interface name. It must fit Linux's 15-character limit."; description = "Interface name, at most 15 characters.";
}; };
autostart = mkOption { autostart = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = "Whether to start this profile at boot. At most one profile may autostart."; description = "Start this profile at boot. Only one profile can autostart.";
}; };
asOutbound = mkOption { asOutbound = mkOption {
type = types.nullOr ( type = types.nullOr (
@@ -191,52 +187,46 @@ let
); );
default = null; default = null;
description = '' description = ''
Make the profile a proxy outbound tagged with its name instead of a global profile. It then Use the profile as a proxy outbound, tagged with its name, instead of a global VPN. It
always runs, leaves the host's routes and resolver alone, and is not listed by then always runs and leaves the host's routes and DNS alone. Needs `proxy.enable`.
`proxy-ctl awg`. Requires proxy.enable. - "singBox": plain WireGuard in sing-box. AmneziaWG obfuscation is dropped, with a warning.
- "singBox": a WireGuard endpoint in its own sing-box process, reached as a loopback SOCKS - "userspace": wireproxy with AmneziaWG obfuscation. Needs no root, so it is the only
hop. sing-box speaks plain WireGuard: AmneziaWG obfuscation is dropped with a warning. mode on home-manager and Nix-on-Droid. Its endpoint is resolved by the system
- "userspace": the same hop served by wireproxy on AmneziaWG's userspace implementation, so resolver, so use an IP if that resolver cannot reach the name.
obfuscation works. It needs no interface or root: the only AmneziaWG mode on - "interface": a real AmneziaWG interface without routes, which the outbound binds to.
home-manager and nix-on-droid. A declared or profile ListenPort is used as is. An On sing-box, its DNS also goes through the tunnel.
Endpoint hostname resolves through the system resolver: give an address where that
resolver cannot reach the name.
- "interface": the AmneziaWG interface comes up without routes (Table = off), and the
outbound binds to it, so obfuscation works. With the sing-box backend its DNS goes
through the interface too (proxy.dns.remote); XRay resolves as usual.
Either way the tunnel itself reaches the peer over the uplink, past TUN and TProxy.
''; '';
}; };
endpoint = endpoint "host:port (IPv6 in brackets) that replaces the first peer's Endpoint when the profile is prepared."; endpoint = endpoint "host:port (IPv6 in brackets) that replaces the first peer's endpoint.";
allowConfigHooks = mkOption { allowConfigHooks = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = "Allow trusted imported configs to execute wg-quick hooks or use SaveConfig."; description = "Let imported configs run wg-quick hooks (PostUp etc.) or use SaveConfig. Only for trusted configs.";
}; };
vpnContainer = mkOption { vpnContainer = mkOption {
type = optionalString; type = optionalString;
default = null; default = null;
description = "AWG container/protocol identifier to select when a vpn:// bundle is ambiguous."; description = "Which container to take from a vpn:// export that holds several.";
}; };
configFile = mkOption { configFile = mkOption {
type = optionalString; type = optionalString;
default = null; default = null;
description = "Runtime path to an AmneziaWG .conf file."; description = "File with an AmneziaWG .conf.";
}; };
vpnFile = mkOption { vpnFile = mkOption {
type = optionalString; type = optionalString;
default = null; default = null;
description = "Runtime path containing a self-contained vpn:// export."; description = "File with a vpn:// export.";
}; };
vpn = mkOption { vpn = mkOption {
type = optionalString; type = optionalString;
default = null; default = null;
description = "Inline self-contained vpn:// export. This value is stored in the Nix store."; description = "A vpn:// export. Ends up in the Nix store; prefer `vpnFile`.";
}; };
settings = mkOption { settings = mkOption {
type = types.nullOr settingsType; type = types.nullOr settingsType;
default = null; default = null;
description = "Typed declarative AmneziaWG client configuration."; description = "The client config written in Nix, instead of a file.";
}; };
}; };
} }
+82 -88
View File
@@ -10,23 +10,23 @@ let
name = mkOption { name = mkOption {
type = types.str; type = types.str;
default = ""; default = "";
description = "Account label: the share link's name, and what subscriptions and stats group by."; description = "User name, shown in share links, subscriptions and stats.";
example = "phone"; example = "phone";
}; };
uuid = nullStr "UUID (vless, vmess). Ends up in the Nix store; prefer uuidFile." "b831381d-6324-4d53-ad4f-8cda48b30811"; uuid = nullStr "UUID (vless, vmess). Ends up in the Nix store; prefer `uuidFile`." "b831381d-6324-4d53-ad4f-8cda48b30811";
uuidFile = nullStr "Runtime path to the UUID." "/run/secrets/proxy-inbound-uuid"; uuidFile = nullStr "File with the UUID." "/run/secrets/proxy-inbound-uuid";
password = nullStr "Password (trojan, shadowsocks, socks, http). Ends up in the Nix store; prefer passwordFile." "hunter2"; password = nullStr "Password (trojan, shadowsocks, socks, http). Ends up in the Nix store; prefer `passwordFile`." "hunter2";
passwordFile = nullStr "Runtime path to the password." "/run/secrets/proxy-inbound-password"; passwordFile = nullStr "File with the password." "/run/secrets/proxy-inbound-password";
publicKey = nullStr '' publicKey = nullStr ''
AmneziaWG public key of a peer that keeps its private key to itself. It gets no client AmneziaWG public key, for a client that keeps its own private key (no config or link is
config or link. Null generates a key pair, kept in the state directory. generated for it). `null`: generate a key pair.
'' "jNXH..."; '' "jNXH...";
privateKeyFile = nullStr "Runtime path to the AmneziaWG client private key, instead of a generated one." "/run/secrets/awg-phone-key"; privateKeyFile = nullStr "File with the AmneziaWG client private key, instead of a generated one." "/run/secrets/awg-phone-key";
presharedKeyFile = nullStr "Runtime path to the AmneziaWG preshared key, instead of a generated one." "/run/secrets/awg-phone-psk"; presharedKeyFile = nullStr "File with the AmneziaWG preshared key, instead of a generated one." "/run/secrets/awg-phone-psk";
address = nullStr '' address = nullStr ''
AmneziaWG tunnel IPv4 address, inside amneziaWg.subnet. Null takes the lowest free one, which AmneziaWG tunnel IPv4 address, inside `amneziaWg.subnet`. `null`: the lowest free one,
the user keeps for as long as it exists. kept for as long as the user exists.
'' "10.66.0.10"; '' "10.66.0.10";
}; };
}; };
@@ -43,11 +43,10 @@ let
]; ];
default = "proxy"; default = "proxy";
description = '' description = ''
What clients reach besides the internet, which they reach the listener's `via` way either way: What clients can reach besides the internet, which always goes through the listener's `via`:
- "proxy": nothing else. This host, its private networks and the other peers are cut off. - "proxy": nothing else. This host, its LAN and other peers are cut off.
- "lan": also this host, its private networks and the other peers, directly (masqueraded - "lan": also this host, its LAN and other peers, directly. Turns on IP forwarding.
behind this host), not through `via`. It turns on IP forwarding. Only TCP and UDP reach the internet; ping and other protocols are dropped.
Only TCP and UDP can follow `via`: anything else to the internet (ping) is dropped.
''; '';
}; };
@@ -55,31 +54,31 @@ let
type = types.strMatching "^[A-Za-z0-9_.-]+$"; type = types.strMatching "^[A-Za-z0-9_.-]+$";
default = "awgi-${tag}"; default = "awgi-${tag}";
defaultText = lib.literalExpression ''"awgi-<tag>"''; defaultText = lib.literalExpression ''"awgi-<tag>"'';
description = "Linux interface name. It must fit Linux's 15-character limit."; description = "Interface name, at most 15 characters.";
}; };
subnet = mkOption { subnet = mkOption {
type = types.strMatching "[0-9.]+/[0-9]+"; type = types.strMatching "[0-9.]+/[0-9]+";
default = "10.66.0.0/24"; default = "10.66.0.0/24";
description = '' description = ''
Tunnel IPv4 subnet, private and unused elsewhere. This host takes the first address, clients Tunnel IPv4 subnet, private and unused elsewhere. This host takes the first address,
the rest. clients the rest.
''; '';
}; };
subnet6 = nullStr '' subnet6 = nullStr ''
Tunnel IPv6 subnet (ULA), laid out as subnet. Null keeps the tunnel IPv4-only. With mode = "lan" Tunnel IPv6 subnet (ULA). `null`: IPv4 only. With `mode = "lan"` it turns on IPv6
it turns on IPv6 forwarding, which stops this host configuring itself from router advertisements. forwarding, which stops this host from configuring itself from router advertisements.
'' "fd66:66::/64"; '' "fd66:66::/64";
privateKeyFile = nullStr "Runtime path to the server private key, instead of a generated one." "/run/secrets/awg-server-key"; privateKeyFile = nullStr "File with the server private key, instead of a generated one." "/run/secrets/awg-server-key";
obfuscation = mkOption { obfuscation = mkOption {
type = obfuscationType; type = obfuscationType;
default = { }; default = { };
description = '' description = ''
Obfuscation parameters, shared with every client. Jc, Jmin, Jmax, S1, S2 and H1-H4 left Obfuscation parameters, shared with every client. Jc, Jmin, Jmax, S1, S2 and H1-H4 are
null are generated once and kept in the state directory; the rest stay unset. generated once if left `null`; the rest stay unset.
''; '';
}; };
@@ -89,19 +88,19 @@ let
"1.1.1.1" "1.1.1.1"
"1.0.0.1" "1.0.0.1"
]; ];
description = "DNS servers in client configs. Queries leave like any other traffic."; description = "DNS servers in client configs. Queries exit like any other traffic.";
}; };
mtu = mkOption { mtu = mkOption {
type = types.nullOr types.ints.unsigned; type = types.nullOr types.ints.unsigned;
default = null; default = null;
description = "Interface MTU, on both ends. Null leaves awg-quick's (1280 with AWG 3 fields)."; description = "Interface MTU on both ends. `null`: awg-quick's default (1280 with AWG 3 fields).";
}; };
persistentKeepalive = mkOption { persistentKeepalive = mkOption {
type = types.nullOr types.ints.unsigned; type = types.nullOr types.ints.unsigned;
default = 25; default = 25;
description = "PersistentKeepalive in client configs, which keeps NAT mappings open."; description = "PersistentKeepalive in client configs, which keeps NAT open.";
}; };
clientAllowedIPs = mkOption { clientAllowedIPs = mkOption {
@@ -126,7 +125,7 @@ let
"xhttp" "xhttp"
]; ];
default = "raw"; default = "raw";
description = ''Stream transport. "raw" is plain TCP, the usual choice for REALITY.''; description = ''Stream transport. "raw" is plain TCP, the usual pick for REALITY.'';
example = "ws"; example = "ws";
}; };
@@ -137,7 +136,7 @@ let
example = "/download"; example = "/download";
}; };
host = nullStr "Expected Host header (ws, httpupgrade, xhttp). Null accepts any." "cdn.example.com"; host = nullStr "Expected Host header (ws, httpupgrade, xhttp). `null`: any." "cdn.example.com";
mode = mkOption { mode = mkOption {
type = types.nullOr ( type = types.nullOr (
@@ -149,7 +148,7 @@ let
] ]
); );
default = null; default = null;
description = ''xhttp mode. Null lets the client choose; behind an HTTP/1.1 proxy use "packet-up".''; description = ''xhttp mode. `null`: the client chooses. Behind an HTTP/1.1 proxy, use "packet-up".'';
example = "packet-up"; example = "packet-up";
}; };
@@ -164,15 +163,13 @@ let
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
description = '' description = ''
Header names that mark a request as coming from the web server in front (ws, httpupgrade, Headers that mark a request as coming from your web server (ws, httpupgrade, xhttp,
xhttp, grpc). When one of them is present, XRay takes the client address from grpc). If one is present, XRay takes the client address from "X-Forwarded-For". Needed
"X-Forwarded-For" instead of the socket. Needed for a listener on a loopback `address`: behind a web server on loopback, or `proxy-ctl inbounds online` and the stats show no
XRay otherwise sees 127.0.0.1, which it refuses to record, so `proxy-ctl inbounds online` client addresses.
shows every user as never seen and the stats keep no last-seen time.
Set it only when the web server in front sets both the named header and "X-Forwarded-For" Only set it if the web server overwrites both headers on every request. Otherwise any
on every request it forwards, overwriting whatever the client sent: any client that can client that reaches the listener directly can fake its address.
reach the listener directly could otherwise claim any address.
''; '';
example = [ "X-Real-IP" ]; example = [ "X-Real-IP" ];
}; };
@@ -184,11 +181,11 @@ let
enable = mkOption { enable = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = "Terminate TLS (always on for trojan). Exclusive with reality."; description = "Terminate TLS (always on for trojan). Cannot be used with `reality`.";
}; };
certificateFile = nullStr "Runtime path to the PEM certificate chain." "/var/lib/acme/example.com/fullchain.pem"; certificateFile = nullStr "File with the PEM certificate chain." "/var/lib/acme/example.com/fullchain.pem";
keyFile = nullStr "Runtime path to the PEM private key." "/var/lib/acme/example.com/key.pem"; keyFile = nullStr "File with the PEM private key." "/var/lib/acme/example.com/key.pem";
serverName = nullStr "SNI in share links. Defaults to inbounds.serverAddress." "example.com"; serverName = nullStr "SNI in share links. Defaults to `inbounds.serverAddress`." "example.com";
alpn = mkOption { alpn = mkOption {
type = types.nullOr ( type = types.nullOr (
@@ -202,8 +199,8 @@ let
); );
default = null; default = null;
description = '' description = ''
ALPN offered and put in share links. [ "h3" ] alone makes an xhttp listener UDP-only, so ALPN offered and put in share links. `[ "h3" ]` alone makes an xhttp listener UDP-only,
a web server can keep the TCP port. leaving the TCP port to a web server.
''; '';
example = [ "h3" ]; example = [ "h3" ];
}; };
@@ -215,25 +212,25 @@ let
enable = mkOption { enable = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = "Enable REALITY. Exclusive with tls."; description = "Enable REALITY. Cannot be used with `tls`.";
}; };
dest = mkOption { dest = mkOption {
type = types.str; type = types.str;
default = "www.microsoft.com:443"; default = "www.microsoft.com:443";
description = "TLS 1.3 + HTTP/2 server that unauthenticated probes are forwarded to."; description = "Real TLS 1.3 + HTTP/2 site that non-client connections are forwarded to.";
}; };
serverNames = mkOption { serverNames = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
description = "Accepted SNIs, served by dest. The first goes into share links."; description = "Accepted SNIs, served by `dest`. The first goes into share links.";
example = [ "www.microsoft.com" ]; example = [ "www.microsoft.com" ];
}; };
privateKeyFile = nullStr "Runtime path to the x25519 private key (`xray x25519`)." "/run/secrets/proxy-inbound-reality-key"; privateKeyFile = nullStr "File with the x25519 private key (from `xray x25519`)." "/run/secrets/proxy-inbound-reality-key";
privateKey = nullStr "x25519 private key. Ends up in the Nix store; prefer privateKeyFile." "gG1Yz..."; privateKey = nullStr "x25519 private key. Ends up in the Nix store; prefer `privateKeyFile`." "gG1Yz...";
publicKey = nullStr "x25519 public key, required for share links." "jNXH..."; publicKey = nullStr "x25519 public key, needed for share links." "jNXH...";
shortIds = mkOption { shortIds = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
@@ -246,7 +243,7 @@ let
fallbackType = types.submodule { fallbackType = types.submodule {
options = { options = {
name = nullStr "SNI to match. Null matches any." "www.example.com"; name = nullStr "SNI to match. `null`: any." "www.example.com";
alpn = mkOption { alpn = mkOption {
type = types.nullOr ( type = types.nullOr (
@@ -256,29 +253,27 @@ let
] ]
); );
default = null; default = null;
description = "Negotiated ALPN to match. Null matches any."; description = "ALPN to match. `null`: any.";
example = "h2"; example = "h2";
}; };
path = nullStr '' path = nullStr ''
Request path to match. Null matches any. XRay reads it from HTTP/1.1 only, so a `listener` Request path to match. `null`: any. Works for HTTP/1.1 only, so the target `listener` must
must be on ws or httpupgrade, with this as its transport.path; xhttp and grpc clients speak h2 use ws or httpupgrade with this as its `transport.path`. For xhttp and grpc (h2), match
and go by alpn = "h2" or a catch-all instead. `alpn = "h2"` or use a catch-all.
'' "/ws"; '' "/ws";
dest = mkOption { dest = mkOption {
type = types.nullOr (types.either types.port types.str); type = types.nullOr (types.either types.port types.str);
default = null; default = null;
description = "Where matching connections go: a port, host:port, or a unix socket path. Exclusive with listener."; description = "Where matching connections go: a port, host:port or unix socket path. Cannot be used with `listener`.";
example = "127.0.0.1:8080"; example = "127.0.0.1:8080";
}; };
listener = nullStr '' listener = nullStr ''
Tag of another listener that matching connections go to, instead of dest. It must be a Another listener to hand matching connections to, instead of `dest`. It must be a vless
vless listener without tls or reality, on a loopback address: it gets the connection listener on loopback, without tls or reality. It gets decrypted traffic, and its share
decrypted, with the client address in PROXY protocol, and its share links advertise this links use this listener's port and TLS or REALITY. Behind REALITY it must use xhttp or grpc.
listener's port and TLS or REALITY. Behind REALITY it must be xhttp or grpc, the only
transports REALITY clients run besides raw.
'' "ws-in"; '' "ws-in";
xver = mkOption { xver = mkOption {
@@ -288,7 +283,7 @@ let
2 2
]; ];
default = 0; default = 0;
description = "PROXY protocol version sent to dest; 0 sends none. A listener always gets 2."; description = "PROXY protocol version sent to `dest`, or 0 for none. A `listener` always gets 2.";
}; };
}; };
}; };
@@ -312,10 +307,10 @@ let
); );
default = null; default = null;
description = '' description = ''
Protocol. Set exactly one of type, xrayJson, or jsonFile. "amneziawg" is an AmneziaWG Protocol. Set exactly one of `type`, `xrayJson` or `jsonFile`.
server on UDP port, with its own interface (see amneziaWg); its traffic is handed to XRay - "amneziawg": an AmneziaWG server on a UDP port (see `amneziaWg`). Its traffic exits
and leaves like any other listener's. "hysteria2" is QUIC on UDP port: it needs tls (a like any other listener's.
certificate) and takes passwords, and no transport, reality or flow. - "hysteria2": QUIC on a UDP port. Needs `tls` and passwords; no transport, reality or flow.
''; '';
example = "vless"; example = "vless";
}; };
@@ -323,76 +318,75 @@ let
port = mkOption { port = mkOption {
type = types.port; type = types.port;
default = 443; default = 443;
description = "Bound port. A raw-JSON listener's port must match it: the firewall and the port checks go by this one."; description = "Listening port. For raw JSON listeners it must match the JSON; the firewall uses this one.";
}; };
sharePort = mkOption { sharePort = mkOption {
type = types.nullOr types.port; type = types.nullOr types.port;
default = null; default = null;
description = "Port share links advertise, when something in front owns the public port. Null uses port."; description = "Port in share links, if something in front owns the public port. `null`: `port`.";
example = 443; example = 443;
}; };
address = mkOption { address = mkOption {
type = types.strMatching "[^[:space:]]+"; type = types.strMatching "[^[:space:]]+";
default = "::"; default = "::";
description = "Bound address. A loopback address keeps the port closed in the firewall."; description = "Listening address. A loopback address keeps the port closed in the firewall.";
example = "127.0.0.1"; example = "127.0.0.1";
}; };
via = nullStr "Egress, as in inbounds.routing.via. Null inherits it." "nl-vps"; via = nullStr "Where this listener's traffic exits, as in `inbounds.routing.via`. `null`: use that default." "nl-vps";
users = mkOption { users = mkOption {
type = types.listOf userType; type = types.listOf userType;
default = [ ]; default = [ ];
description = "Accepted accounts."; description = "Accepted users.";
example = [ { uuidFile = "/run/secrets/proxy-inbound-uuid"; } ]; example = [ { uuidFile = "/run/secrets/proxy-inbound-uuid"; } ];
}; };
flow = mkOption { flow = mkOption {
type = types.nullOr (types.enum [ "xtls-rprx-vision" ]); type = types.nullOr (types.enum [ "xtls-rprx-vision" ]);
default = null; default = null;
description = "VLESS flow; raw transport only."; description = "VLESS flow. Raw transport only.";
example = "xtls-rprx-vision"; example = "xtls-rprx-vision";
}; };
method = mkOption { method = mkOption {
type = types.str; type = types.str;
default = "2022-blake3-aes-128-gcm"; default = "2022-blake3-aes-128-gcm";
description = "Shadowsocks cipher. 2022 ciphers take a base64 key of matching length as password; more than one user needs a 2022-blake3-aes cipher and serverPassword."; description = "Shadowsocks cipher. 2022 ciphers take a base64 key of matching length as the password. Multiple users need a 2022-blake3-aes cipher and `serverPassword`.";
example = "aes-128-gcm"; example = "aes-128-gcm";
}; };
serverPassword = nullStr "Server key of a multi-user shadowsocks 2022 listener, shared by its users. Ends up in the Nix store; prefer serverPasswordFile." "c2VydmVyLWtleS0xNmJ5dGU="; serverPassword = nullStr "Shared server key of a multi-user shadowsocks 2022 listener. Ends up in the Nix store; prefer `serverPasswordFile`." "c2VydmVyLWtleS0xNmJ5dGU=";
serverPasswordFile = nullStr "Runtime path to the server key." "/run/secrets/proxy-inbound-ss-server-key"; serverPasswordFile = nullStr "File with the server key." "/run/secrets/proxy-inbound-ss-server-key";
transport = mkOption { transport = mkOption {
type = transportType; type = transportType;
default = { }; default = { };
description = "Stream transport."; description = "Transport settings.";
}; };
tls = mkOption { tls = mkOption {
type = tlsType; type = tlsType;
default = { }; default = { };
description = "TLS termination."; description = "TLS settings.";
}; };
reality = mkOption { reality = mkOption {
type = realityType; type = realityType;
default = { }; default = { };
description = "REALITY."; description = "REALITY settings.";
}; };
fallbacks = mkOption { fallbacks = mkOption {
type = types.listOf fallbackType; type = types.listOf fallbackType;
default = [ ]; default = [ ];
description = '' description = ''
Where XRay sends connections that are not this listener's protocol, so several share Where to send connections that are not this listener's protocol, so several services
one port (vless or trojan on the raw transport). Matched in order on SNI, ALPN and path; share one port (vless or trojan on raw transport). Entries match in order by SNI, ALPN
the first entry without any is the catch-all, such as a decoy web server. Browsers and path; one with none of these is the catch-all, such as a decoy site. Browsers use h2
negotiate h2 unless tls.alpn says otherwise, so a dest that speaks only HTTP/1.1 needs by default, so an HTTP/1.1-only `dest` needs `tls.alpn = [ "http/1.1" ]`.
tls.alpn = [ "http/1.1" ], or an alpn = "h2" entry to one that speaks h2c.
''; '';
example = lib.literalExpression '' example = lib.literalExpression ''
[ [
@@ -405,24 +399,24 @@ let
xrayJson = mkOption { xrayJson = mkOption {
type = types.nullOr types.attrs; type = types.nullOr types.attrs;
default = null; default = null;
description = "Raw XRay inbound, built into the store; tag is overridden and port, if left out, filled in."; description = "Raw XRay inbound JSON (ends up in the Nix store). Its tag is replaced; a missing port is filled in.";
example = { example = {
protocol = "dokodemo-door"; protocol = "dokodemo-door";
settings.port = 8080; settings.port = 8080;
}; };
}; };
jsonFile = nullStr "Runtime path to a raw XRay inbound (no share link); tag is overridden and port, if left out, filled in." "/run/secrets/proxy-inbound-vless.json"; jsonFile = nullStr "File with a raw XRay inbound JSON (no share link). Its tag is replaced; a missing port is filled in." "/run/secrets/proxy-inbound-vless.json";
hysteria.masquerade = nullStr '' hysteria.masquerade = nullStr ''
Site that a hysteria2 listener serves, reverse-proxied, to anything that is not a client Site shown to anything that is not a hysteria2 client, such as browsers and probes.
(a browser, a prober). Null answers them with 404. `null`: answer 404.
'' "https://www.example.com"; '' "https://www.example.com";
amneziaWg = mkOption { amneziaWg = mkOption {
type = mkAmneziaWgType name; type = mkAmneziaWgType name;
default = { }; default = { };
description = ''The AmneziaWG server of a type = "amneziawg" listener.''; description = ''AmneziaWG server settings, for `type = "amneziawg"`.'';
}; };
}; };
} }
+20 -17
View File
@@ -17,10 +17,10 @@ let
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = '' description = ''
Tag of the outbound ${what} connects through: a proxy chain. Any outbound can be the hop, Tag of an outbound that ${what} connects through (a proxy chain). Any outbound works,
subscription entries, `warp`, `ssh-proxy` and AmneziaWG ones included. On hybrid, an including subscription entries, `warp`, `ssh-proxy` and AmneziaWG. On hybrid, an XRay
outbound that runs on XRay can only chain through another XRay one. ShadowTLS works this outbound can only chain through another XRay one. For ShadowTLS, put a `shadowtls`
way too: a `shadowtls` outbound in singBoxJson, and the shadowsocks one with detour naming it. outbound in `singBoxJson` and point the shadowsocks outbound's `detour` at it.
''; '';
example = "ru-vps"; example = "ru-vps";
}; };
@@ -29,11 +29,11 @@ let
options = { options = {
tag = mkOption { tag = mkOption {
type = types.strMatching "^[A-Za-z0-9][A-Za-z0-9._-]*$"; type = types.strMatching "^[A-Za-z0-9][A-Za-z0-9._-]*$";
description = "Unique name; prefixes the tags of its outbounds and names its cache file."; description = "Unique name, used as a prefix for the tags of its outbounds.";
example = "community-list"; example = "community-list";
}; };
url = nullStr "Subscription URL. Ends up in the Nix store; prefer urlFile." "https://example.com/sub/token123"; url = nullStr "Subscription URL. Ends up in the Nix store; prefer `urlFile`." "https://example.com/sub/token123";
urlFile = nullStr "Runtime path to the subscription URL." "/run/secrets/proxy-subscription-url"; urlFile = nullStr "File with the subscription URL." "/run/secrets/proxy-subscription-url";
detour = detourOption "every entry of this subscription"; detour = detourOption "every entry of this subscription";
}; };
}; };
@@ -42,21 +42,25 @@ let
options = { options = {
tag = mkOption { tag = mkOption {
type = types.str; type = types.str;
description = "Outbound tag, for routing rules and selection."; description = "Unique name, used in routing rules, `detour` and `proxy-ctl`. Not \"proxy\", \"direct\" or \"block\".";
example = "vps-de"; example = "vps-de";
}; };
url = nullStr "Proxy URL. Ends up in the Nix store; prefer urlFile." "hy2://password@example.com:443?sni=example.com"; url = nullStr "Proxy link. Ends up in the Nix store; prefer `urlFile`." "hy2://password@example.com:443?sni=example.com";
urlFile = nullStr "Runtime path to the proxy URL." "/run/secrets/my-proxy-url"; urlFile = nullStr "File with the proxy link." "/run/secrets/my-proxy-url";
detour = detourOption "this one"; detour = detourOption "this outbound";
singBoxJson = nullAttrs "Raw sing-box outbound (sing-box backend); tag is overridden." { singBoxJson =
nullAttrs "Raw sing-box outbound JSON, instead of `url` (sing-box backend). Its tag is replaced."
{
type = "vless"; type = "vless";
server = "example.com"; server = "example.com";
server_port = 443; server_port = 443;
}; };
xrayJson = nullAttrs "Raw XRay outbound (XRay backend); tag is overridden." { xrayJson =
nullAttrs "Raw XRay outbound JSON, instead of `url` (XRay backend). Its tag is replaced."
{
protocol = "vless"; protocol = "vless";
settings.address = "example.com"; settings.address = "example.com";
}; };
@@ -69,14 +73,13 @@ let
]; ];
default = "auto"; default = "auto";
description = '' description = ''
Backend for this outbound when both run. "auto" prefers sing-box and falls back to XRay Which engine runs this outbound on the hybrid backend. "auto" uses sing-box, or XRay for
for XRay-only transports (XHTTP, ECH). XRay-only transports (XHTTP, ECH).
''; '';
example = "xray"; example = "xray";
}; };
# Destinations sent to this outbound, whatever the selection. routing = routingFields "always sent to this outbound, whatever the selection";
routing = routingFields;
}; };
}; };
in in
+10 -10
View File
@@ -27,14 +27,14 @@ let
options = { options = {
name = mkOption { name = mkOption {
type = types.strMatching "^[a-z0-9][a-z0-9-]*$"; type = types.strMatching "^[a-z0-9][a-z0-9-]*$";
description = "Hostlist name (hostlists/list-<name>.txt)."; description = "List name.";
example = "cloudflare"; example = "cloudflare";
}; };
domains = mkOption { domains = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
description = "Domains in this hostlist."; description = "Domains in this list.";
example = [ "example.com" ]; example = [ "example.com" ];
}; };
@@ -42,8 +42,8 @@ let
type = types.listOf zapretDefaultDomainType; type = types.listOf zapretDefaultDomainType;
default = [ ]; default = [ ];
description = '' description = ''
Upstream lists to include ("discord" = "general", "youtube" = "google"). Without preset, Upstream lists to include ("discord" is "general", "youtube" is "google"). Without
use one per rule so the strategy family can be inferred. `preset`, use only one, so the strategy can be inferred from it.
''; '';
example = [ "google" ]; example = [ "google" ];
}; };
@@ -51,42 +51,42 @@ let
ips = mkOption { ips = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
description = "IPs/CIDRs in this rule's ipset."; description = "IPs or CIDRs in this list.";
example = [ "203.0.113.0/24" ]; example = [ "203.0.113.0/24" ];
}; };
defaultIps = mkOption { defaultIps = mkOption {
type = types.listOf zapretDefaultIpType; type = types.listOf zapretDefaultIpType;
default = [ ]; default = [ ];
description = ''Upstream ipsets to include ("all" is ipset-all.txt).''; description = "Upstream IP lists to include.";
example = [ "all" ]; example = [ "all" ];
}; };
preset = mkOption { preset = mkOption {
type = types.nullOr zapretPresetType; type = types.nullOr zapretPresetType;
default = null; default = null;
description = "Strategy family to clone, from configName or the active config."; description = "Strategy to copy, from `configName` or the active config.";
example = "google"; example = "google";
}; };
configName = mkOption { configName = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = "Config to clone strategies from. Exclusive with nfqwsArgs."; description = "Config to copy the strategy from. Cannot be used with `nfqwsArgs`.";
example = "general(ALT9)"; example = "general(ALT9)";
}; };
nfqwsArgs = mkOption { nfqwsArgs = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [ ];
description = "Raw NFQWS arguments; --hostlist and --new are added. Exclusive with configName."; description = "Raw nfqws arguments; `--hostlist` and `--new` are added. Cannot be used with `configName`.";
example = [ "--filter-tcp=443 --dpi-desync=fake,multisplit" ]; example = [ "--filter-tcp=443 --dpi-desync=fake,multisplit" ];
}; };
enableDirectSync = mkOption { enableDirectSync = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
description = "Include these domains in zapret.directSync."; description = "Include these domains in `zapret.directSync`.";
}; };
}; };
}; };
+10 -10
View File
@@ -5,12 +5,12 @@ let
in in
{ {
options.services.proxy-suite.userControl = { options.services.proxy-suite.userControl = {
enable = lib.mkEnableOption "passwordless `proxy-ctl` control for the members of userControl.group"; enable = lib.mkEnableOption "`proxy-ctl` without root for members of `userControl.group`";
group = mkOption { group = mkOption {
type = types.strMatching "^[a-z_][a-z0-9_-]*$"; type = types.strMatching "^[a-z_][a-z0-9_-]*$";
default = "proxy-suite"; default = "proxy-suite";
description = "Group whose members may run privileged `proxy-ctl` commands without a password."; description = "Group whose members can run privileged `proxy-ctl` commands.";
}; };
scopes = mkOption { scopes = mkOption {
@@ -29,16 +29,16 @@ in
); );
default = [ ]; default = [ ];
description = '' description = ''
What userControl.group may do; empty allows every scope. What the group may do. Empty allows everything.
- "services": turn the proxy-suite units on and off (proxy, tun, tproxy, zapret, ssh, warp, tor, tg, awg, inbounds), `restart`, and `tor status|newnym` on Tor's control socket. - "services": start, stop and restart services, and `tor newnym`.
- "perApp": the per-app backend units used by `proxy-ctl apps run`. - "perApp": `proxy-ctl apps run`.
- "routing": `proxy pin`, `proxy unpin` and `proxy mode`. - "routing": `proxy pin`, `proxy unpin` and `proxy mode`.
- "outbounds": add and remove runtime outbounds and subscriptions, disable and enable outbounds, and update subscriptions. - "outbounds": add, remove, enable and disable outbounds and subscriptions.
- "secrets": read share links, subscription URLs and the running configs. - "secrets": read share links, subscription URLs and running configs.
- "autoProxy": read what autoProxy learned, and `proxy auto learn|forget|relearn|clear`. - "autoProxy": see and change what autoProxy learned.
- "zapret": edit zapret2's learned hosts, and `zapret cutoff probe`. - "zapret": change zapret2's learned sites, and `zapret cutoff probe`.
- "stats": `inbounds stats`. - "stats": `inbounds stats`.
- "whitelistBypass": the whitelist-bypass creators and joiners: `wl on|off|toggle|restart`, their calls (`wl link`), and their logins and links (`wl auth|join|new`). - "whitelistBypass": everything under `proxy-ctl wl`.
''; '';
example = [ example = [
"services" "services"
+19 -25
View File
@@ -6,19 +6,19 @@ let
in in
{ {
options.services.proxy-suite.warp = { options.services.proxy-suite.warp = {
enable = mkEnableOption "Cloudflare WARP"; enable = mkEnableOption "Cloudflare WARP" // {
description = "Run Cloudflare WARP. Also set `asOutbound` or `asAmneziaWg`.";
};
configFile = mkOption { configFile = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = '' description = ''
Runtime path to a WireGuard profile for WARP, as written by `wgcf register && wgcf generate`. File with a WARP WireGuard profile, from `wgcf register && wgcf generate`. AmneziaWG
AmneziaWG lines (Jc, S1-S4, H1-H4, I1-I5, AWG 3 timing) are honoured by the AmneziaWG profile fields in it only take effect in the AmneziaWG modes.
(asAmneziaWg, asOutbound = "interface") only.
When null, proxy-suite-warp registers a device with wgcf (accepting Cloudflare's terms) `null`: register a new device with wgcf on first start (accepting Cloudflare's terms),
into /var/lib/proxy-suite/warp, through the local proxy when proxy.enable is set, and through the local proxy if enabled. WARP does not work until that succeeds.
retries until it succeeds. Until then warp connections fail.
''; '';
example = "/run/secrets/wgcf-profile.conf"; example = "/run/secrets/wgcf-profile.conf";
}; };
@@ -27,20 +27,18 @@ in
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = '' description = ''
HTTPS URL of a WARP profile generator, fetched directly when wgcf registration fails URL of a WARP profile generator, used if wgcf registration fails (for example, when the
(e.g. the Cloudflare API is blocked and there is no local proxy). It must return a Cloudflare API is blocked). It must return a WireGuard profile, or JSON with the base64
WireGuard profile, or JSON with the base64 profile in `.content`. profile in `.content`.
The generator registers the device, so its operator sees the private key. Its operator sees your private key.
''; '';
example = "https://valokda-amnezia.vercel.app/api/warp?mode=awg2"; example = "https://valokda-amnezia.vercel.app/api/warp?mode=awg2";
}; };
endpoint = endpoint '' endpoint = endpoint ''
host:port that replaces the profile's Endpoint (IPv6 in brackets), for when the default host:port (IPv6 in brackets) to use instead of the profile's endpoint, if the default one
engage.cloudflareclient.com:2408 is blocked: another Cloudflare address, another port WARP is blocked: another Cloudflare address, another WARP port (500, 1701, 4500, …), or a relay.
answers on (500, 1701, 4500, ...), or a relay. Applied in every mode when the tunnel or
AmneziaWG profile starts; the profile file itself is left as is.
''; '';
asOutbound = mkOption { asOutbound = mkOption {
@@ -54,14 +52,10 @@ in
default = null; default = null;
description = '' description = ''
Add WARP as an outbound tagged "warp". Add WARP as an outbound tagged "warp".
- "singBox": a SOCKS hop to proxy-suite-warp-tunnel, which runs WARP as a sing-box WireGuard - "singBox": plain WireGuard in sing-box, ignoring AmneziaWG fields. Restarts itself when
endpoint on 127.0.0.1:18538, as the proxy-suite-daemon user. The tunnel starts again on a WARP stops answering.
new source port when WARP does not answer within 15 seconds of a start, or misses three - "userspace": an AmneziaWG profile, without root. Needs `amneziaWg.enable`.
probes later on, unless the uplink itself is down. - "interface": an AmneziaWG profile with its own interface. Needs `amneziaWg.enable`.
- "userspace": an AmneziaWG profile named "warp" with asOutbound = "userspace", which honours
the AmneziaWG lines of the profile without an interface or root. Requires amneziaWg.enable.
- "interface": an AmneziaWG profile named "warp" with asOutbound = "interface", which honours
the AmneziaWG lines of the profile. Requires amneziaWg.enable.
''; '';
}; };
@@ -69,8 +63,8 @@ in
type = types.bool; type = types.bool;
default = false; default = false;
description = '' description = ''
Add an AmneziaWG profile named "warp" (`proxy-ctl awg on warp`). Requires amneziaWg.enable, Add a global AmneziaWG profile named "warp" (`proxy-ctl awg on warp`). Needs
and excludes asOutbound: both would use the same WARP key. `amneziaWg.enable`. Cannot be used with `asOutbound`.
''; '';
}; };
}; };
@@ -12,7 +12,7 @@ let
"dion" "dion"
"bitrix" "bitrix"
]; ];
description = "Call platform the creator on the other end uses. VK has no Linux joiner."; description = "Call platform the creator uses. VK has no joiner here.";
example = "wbstream"; example = "wbstream";
}; };
@@ -20,10 +20,8 @@ let
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = '' description = ''
Runtime path to the call link the creator printed (or wrote to its state directory): File with the call link from the creator's log. `proxy-ctl wl join <name> <link>` sets
a WB Stream room id, a Telemost link, a DION event slug or a Bitrix conference link. one at runtime and takes priority. `null`: the joiner waits for that.
`proxy-ctl wl join <name> <link>` sets one at runtime, which wins over this. Null
leaves the joiner off until then.
''; '';
example = "/run/secrets/whitelist-bypass-link"; example = "/run/secrets/whitelist-bypass-link";
}; };
@@ -41,8 +39,7 @@ let
"vk" "vk"
]; ];
description = '' description = ''
Call platform. Every one needs an account: "vk" only serves the upstream Android app, Call platform. Each needs an account. "vk" only serves the upstream Android joiner app.
the rest a joiner of this module too.
''; '';
example = "wbstream"; example = "wbstream";
}; };
@@ -51,11 +48,10 @@ let
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = '' description = ''
Runtime path to the platform's cookies, as the upstream desktop Creator exports them. File with the platform's cookies, as exported by the upstream desktop Creator. Read on
Copied into the state directory on first start only: DION and Bitrix rotate their first start only, since the login refreshes itself afterwards. `proxy-ctl wl auth
refresh token into that copy, and a stale one would kill the session. <name>` replaces it at runtime (or asks for email and password on DION and Bitrix).
`proxy-ctl wl auth <name>` replaces that copy at runtime, with a new export or, for `null`: the creator waits for that.
DION and Bitrix, an email and password. Null leaves the creator off until then.
''; '';
example = "/run/secrets/whitelist-bypass-cookies-wbstream.json"; example = "/run/secrets/whitelist-bypass-cookies-wbstream.json";
}; };
@@ -64,10 +60,9 @@ let
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = '' description = ''
Runtime path to the call to rejoin. Null rejoins the last call written to File with a call link to rejoin. `null`: create a call once and keep reusing it, so
`<stateDir>/whitelist-bypass/<name>.link`, and creates one on first start: the link the joiner needs the link only once. `proxy-ctl wl new <name>` starts a new call if the
stays the same across restarts, so the joiner needs it only once. `proxy-ctl wl new platform closed the old one.
<name>` drops it for a new call, when the platform has closed the old one.
''; '';
example = "/run/secrets/whitelist-bypass-link"; example = "/run/secrets/whitelist-bypass-link";
}; };
@@ -79,10 +74,9 @@ let
]; ];
default = "direct"; default = "direct";
description = '' description = ''
Where the joiner's traffic leaves. Where the traffic from this creator's joiner exits.
- "direct": from this host, past TUN and TProxy (it runs as proxy-suite-daemon). - "direct": straight from this host, bypassing TUN and TProxy.
- "proxy": through the local proxy listener (proxy.listener, with its auth), and so - "proxy": through the local proxy and its routing.
its outbounds and routing.
''; '';
}; };
@@ -93,31 +87,34 @@ let
"unlimited" "unlimited"
]; ];
default = "moderate"; default = "moderate";
description = "Buffer sizes and Go memory limit: 64, 128 or 256 MB."; description = "Memory budget: 64, 128 or 256 MB.";
}; };
}; };
}; };
in in
{ {
options.services.proxy-suite.whitelistBypass = { options.services.proxy-suite.whitelistBypass = {
enable = mkEnableOption '' enable = mkEnableOption "whitelist-bypass" // {
tunnels through the media servers of video calls, which mobile internet whitelists let description = ''
through ([whitelist-bypass](https://github.com/kulikov0/whitelist-bypass)). A creator on a Tunnel through video-call servers, which mobile internet whitelists let through
free host serves exactly one joiner on a censored one''; ([whitelist-bypass](https://github.com/kulikov0/whitelist-bypass)). A creator on a free
host serves one joiner on a censored one.
'';
};
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = proxySuiteUpstream.whitelist-bypass; default = proxySuiteUpstream.whitelist-bypass;
defaultText = lib.literalMD "proxy-suite's `whitelist-bypass` (`pkgs/whitelist-bypass.nix`)"; defaultText = lib.literalMD "proxy-suite's `whitelist-bypass` (`pkgs/whitelist-bypass.nix`)";
description = "whitelist-bypass package with the headless creators and joiners."; description = "whitelist-bypass package.";
}; };
joiners = mkOption { joiners = mkOption {
type = types.attrsOf joinerType; type = types.attrsOf joinerType;
default = { }; default = { };
description = '' description = ''
Joiners, each an outbound tagged with its name: a loopback SOCKS5 listener that tunnels Joiners, each an outbound tagged with its name that tunnels through the call. Needs
through the call. Needs proxy.enable. `proxy.enable`.
''; '';
example = { example = {
wl = { wl = {
@@ -130,7 +127,7 @@ in
creators = mkOption { creators = mkOption {
type = types.attrsOf creatorType; type = types.attrsOf creatorType;
default = { }; default = { };
description = "Creators, one per joiner device. The link each uses is in its log."; description = "Creators, one per joiner device. Each logs the call link its joiner needs (also `proxy-ctl wl link`).";
example = { example = {
phone = { phone = {
platform = "wbstream"; platform = "wbstream";
+16 -15
View File
@@ -16,30 +16,31 @@ in
]; ];
default = "zapret-discord-youtube"; default = "zapret-discord-youtube";
description = '' description = ''
"zapret-discord-youtube": nfqws with curated presets and static hostlists (zapret.zapret-discord-youtube). Which zapret to run:
"zapret2": nfqws2, which learns blocked hosts at runtime (zapret.zapret2). - "zapret-discord-youtube": ready-made presets and fixed site lists.
- "zapret2": learns blocked sites at runtime.
''; '';
example = "zapret2"; example = "zapret2";
}; };
# What zapret feeds back into the client routing table. # What zapret feeds back into the client routing table.
directSync = { directSync = {
enable = bool true "Add zapret's domain hostlists to proxy.routing.direct."; enable = bool true "Send zapret's domains direct in the proxy routing, so zapret handles them.";
upstreamIps = bool false "Add zapret's upstream ipsets to proxy.routing.direct."; upstreamIps = bool false "Also send zapret's upstream IP lists direct.";
userIps = bool true "Add zapret-discord-youtube.ips, minus zapret-discord-youtube.excludeIps, to proxy.routing.direct."; userIps = bool true "Also send `zapret-discord-youtube.ips` (minus `excludeIps`) direct.";
}; };
# Shared by both engines: a netfilter-level bypass, not an engine-specific concept. # Shared by both engines: a netfilter-level bypass, not an engine-specific concept.
cidrExemption = { cidrExemption = {
enable = mkEnableOption "exempting subnets from zapret, e.g. NATed VMs whose traffic it would break"; enable = mkEnableOption "skipping zapret for some subnets, such as NATed VMs it would break";
cidrs = list "Exempted subnets." [ "192.168.123.0/24" ]; cidrs = list "Subnets zapret skips." [ "192.168.123.0/24" ];
}; };
zapret-discord-youtube = { zapret-discord-youtube = {
configName = mkOption { configName = mkOption {
type = types.str; type = types.str;
default = "general(ALT)"; default = "general(ALT)";
description = "Upstream strategy preset. Names that differ only in whitespace match."; description = "Strategy preset name (spaces are ignored).";
example = "general (ALT9)"; example = "general (ALT9)";
}; };
@@ -51,14 +52,14 @@ in
"null" "null"
]; ];
default = "null"; default = "null";
description = ''Game traffic filter, or "null" for off.''; description = ''Which game traffic to handle, or "null" for none.'';
example = "all"; example = "all";
}; };
domains = list "Extra domains to bypass." [ "youtube.com" ]; domains = list "Extra domains to unblock." [ "youtube.com" ];
excludeDomains = list "Domains never bypassed." [ "music.youtube.com" ]; excludeDomains = list "Domains zapret never touches." [ "music.youtube.com" ];
ips = list "Extra IPs/CIDRs to bypass." [ "203.0.113.0/24" ]; ips = list "Extra IPs or CIDRs to unblock." [ "203.0.113.0/24" ];
excludeIps = list "IPs/CIDRs never bypassed." [ "203.0.113.10/32" ]; excludeIps = list "IPs or CIDRs zapret never touches." [ "203.0.113.10/32" ];
includeExtraUpstreamLists = bool false "Also use the upstream instagram, soundcloud and twitter lists."; includeExtraUpstreamLists = bool false "Also use the upstream instagram, soundcloud and twitter lists.";
@@ -66,8 +67,8 @@ in
type = types.listOf t.zapretHostlistRuleType; type = types.listOf t.zapretHostlistRuleType;
default = [ ]; default = [ ];
description = '' description = ''
Extra named hostlists, each with its own strategy: cloned from a preset or configName, Extra site lists, each with its own strategy: copied from a `preset` or `configName`,
or given as nfqwsArgs. or given as raw `nfqwsArgs`.
''; '';
example = [ example = [
{ {
+31 -41
View File
@@ -3,7 +3,7 @@
let let
inherit (lib) mkEnableOption mkOption types; inherit (lib) mkEnableOption mkOption types;
int = (import ./lib.nix { inherit lib; }).positiveInt; int = (import ./lib.nix { inherit lib; }).positiveInt;
fromSource = what: "null uses the ${what} of strategySource."; fromSource = what: "`null`: use the ${what} from `strategySource`.";
in in
{ {
options.services.proxy-suite.zapret.zapret2 = { options.services.proxy-suite.zapret.zapret2 = {
@@ -14,14 +14,11 @@ in
]; ];
default = "nfqws2-keenetic"; default = "nfqws2-keenetic";
description = '' description = ''
Where profiles, blobs and ports come from; both are pinned flake inputs. Where the strategies, blobs and ports come from.
"nfqws2-keenetic": its nfqws2.conf strategies with its user and exclude lists. - "nfqws2-keenetic": its strategies and site lists.
"z2k": z2k's own config generator, run at build time: per-category rotation pools - "z2k": z2k's strategies, which rotate per category (YouTube, Discord, QUIC, …), with
(general, YouTube, googlevideo, QUIC, Discord), its failure detectors and fake-TTL its site lists, including the full RKN list (more memory).
hook, its blobs, whitelist and hostlists, including the ~125k-domain RKN list Either way, each site's working strategy is remembered across restarts.
(about 15 MB more RSS per nfqws2 process).
Either way each host's working strategy is remembered across restarts in
/var/lib/proxy-suite/zapret2/circular/state.tsv.
''; '';
example = "z2k"; example = "z2k";
}; };
@@ -30,9 +27,9 @@ in
type = types.nullOr (types.listOf types.str); type = types.nullOr (types.listOf types.str);
default = null; default = null;
description = '' description = ''
nfqws2 profiles replacing those of strategySource, joined with --new; first match wins. Your own nfqws2 profiles, instead of those from `strategySource`. The first match wins.
<HOSTLIST> expands to the hostlist arguments, <HOSTLIST_NOAUTO> to the same without `<HOSTLIST>` expands to the site list arguments, `<HOSTLIST_NOAUTO>` to the same without
learning. --qnum, --fwmark and --lua-init are added automatically. ${fromSource "profiles"} learning. `--qnum`, `--fwmark` and `--lua-init` are added for you. ${fromSource "profiles"}
''; '';
example = [ example = [
"--filter-tcp=443 --filter-l7=tls <HOSTLIST> --payload=tls_client_hello --lua-desync=multisplit:pos=1,midsld" "--filter-tcp=443 --filter-l7=tls <HOSTLIST> --payload=tls_client_hello --lua-desync=multisplit:pos=1,midsld"
@@ -42,7 +39,7 @@ in
blobs = mkOption { blobs = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
default = { }; default = { };
description = "Fake payloads by name (blob=<name>) on top of those of strategySource: a file in zapret2's files/fake, or an absolute path."; description = "Extra fake payloads by name (blob=<name>): a file in zapret2's files/fake, or an absolute path.";
example = { example = {
tls_clienthello = "/etc/proxy-suite/my_clienthello.bin"; tls_clienthello = "/etc/proxy-suite/my_clienthello.bin";
}; };
@@ -66,14 +63,14 @@ in
tcp = mkOption { tcp = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = "TCP ports sent to NFQUEUE. Must cover every port a profile filters on. ${fromSource "ports"}"; description = "TCP ports zapret2 handles. Must include every port a profile uses. ${fromSource "ports"}";
example = "80,443"; example = "80,443";
}; };
udp = mkOption { udp = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
default = null; default = null;
description = "UDP ports sent to NFQUEUE. Must cover every port a profile filters on. ${fromSource "ports"}"; description = "UDP ports zapret2 handles. Must include every port a profile uses. ${fromSource "ports"}";
example = "443"; example = "443";
}; };
}; };
@@ -81,40 +78,37 @@ in
ipv6 = mkOption { ipv6 = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = "Intercept IPv6 as well as IPv4."; description = "Handle IPv6 too.";
}; };
autoHostlist = { autoHostlist = {
enable = mkEnableOption "learning blocked hosts at runtime" // { enable = mkEnableOption "learning blocked hosts at runtime" // {
default = true; default = true;
description = '' description = ''
Learn blocked hosts: after failThreshold failures (retransmissions, early RST, DPI Learn blocked sites: after `failThreshold` failed connections, a site is treated as
redirect, one-sided UDP) a host joins /var/lib/proxy-suite/zapret2/zapret-hosts-auto.txt. blocked. When off, only `zapret2.domains` and `proxy-ctl zapret auto add` are used.
Off, only zapret2.domains and `proxy-ctl zapret auto add` are acted on.
The thresholds below also fill whichever of them a profile's strategy rotation
(circular) leaves unset; its own fails and time are kept.
''; '';
}; };
failThreshold = int 3 "Failures before a host is learned."; failThreshold = int 3 "Failures before a site is learned.";
failTime = int 300 "Seconds allowed between two failures before the count resets."; failTime = int 300 "Seconds without a failure before the count resets.";
retransThreshold = int 3 "Retransmissions of the first request that count as one failure."; retransThreshold = int 3 "Retransmissions of the first request that count as a failure.";
retransReset = mkOption { retransReset = mkOption {
type = types.bool; type = types.bool;
default = true; default = true;
description = "RST a stalled client once retransThreshold is hit, so failures are counted fast."; description = "Reset a stalled connection at `retransThreshold`, so failures are counted faster.";
}; };
retransMaxseq = int 32768 "Outgoing sequence number past which failure detection stops."; retransMaxseq = int 32768 "Stop watching a connection for failures after this many bytes sent.";
incomingMaxseq = int 4096 "Incoming sequence number past which an RST or redirect is not a failure."; incomingMaxseq = int 4096 "After this many bytes received, a reset or redirect is not a failure.";
udpOut = int 4 "Outgoing UDP packets before a one-sided exchange counts as a failure."; udpOut = int 4 "UDP packets sent, with at most `udpIn` replies, that count as a failure.";
udpIn = int 1 "Incoming UDP packets at or below which an exchange is one-sided."; udpIn = int 1 "Most UDP replies that still count as no answer (see `udpOut`).";
debugLog = mkOption { debugLog = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = "Log why hosts are or are not learned to zapret-hosts-auto-debug.log."; description = "Log why sites are or are not learned.";
}; };
}; };
@@ -122,13 +116,10 @@ in
enable = mkEnableOption "the 16 KB cutoff probe" // { enable = mkEnableOption "the 16 KB cutoff probe" // {
default = true; default = true;
description = '' description = ''
Some lines let TLS to certain hosting networks handshake and then cut it at 12-34 KB, Work around ISPs that cut TLS to some hosting networks after about 16 KB, which no
which no strategy fixes. z2k's probe checks this line against ~110 known targets when strategy fixes. A daily probe finds the affected networks and a whitelisted name that
its network changes and once a day, and for each cut-off network searches a whitelisted gets through for each. Only with `strategySource = "z2k"`. Each run makes thousands of
name that nfqws2 then puts into a fake ClientHello (strategySource "z2k" only; ahead of short direct connections. `proxy-ctl zapret cutoff` shows the results.
the nfqws2-keenetic strategies it breaks them): thousands of short TLS connections to
foreign hosting IPs per full run, sent directly and never touched by zapret2. State and
maps live in /var/lib/proxy-suite/zapret2/cutoff; `proxy-ctl zapret cutoff` shows them.
''; '';
}; };
@@ -136,10 +127,9 @@ in
type = types.bool; type = types.bool;
default = true; default = true;
description = '' description = ''
Route the cut-off networks no name fixes through the proxy outbound. Needs the sing-box Send cut-off networks that no name fixes through the proxy. Needs the sing-box backend,
backend with an outbound and a route mode other than all-bypass, and only applies to an outbound, and a route mode other than all-bypass. Only works for traffic the proxy
traffic the backend sees by address (TUN, TProxy, per-app routing, clients that dial IPs); sees by IP (TUN, TProxy, per-app routing). Explicit direct rules still win.
explicit direct rules still win.
''; '';
}; };
}; };
+1 -1
View File
@@ -36,7 +36,7 @@ let
generatedOptionsDoc generatedOptionsDoc
generatedReadmeDoc generatedReadmeDoc
; ;
inherit (checkLib) rg; inherit (checkLib) rg evalProxySuite;
readmeDocSource = builtins.readFile ../nix/readme-doc.nix; readmeDocSource = builtins.readFile ../nix/readme-doc.nix;
tgWsProxyModuleSource = builtins.readFile ../modules/proxy-suite/tg-ws-proxy.nix; tgWsProxyModuleSource = builtins.readFile ../modules/proxy-suite/tg-ws-proxy.nix;
controlModuleSource = builtins.readFile ../modules/proxy-suite/service/control.nix; controlModuleSource = builtins.readFile ../modules/proxy-suite/service/control.nix;
+107
View File
@@ -1,6 +1,7 @@
{ {
pkgs, pkgs,
rg, rg,
evalProxySuite,
generatedOptionsDoc, generatedOptionsDoc,
generatedReadmeDoc, generatedReadmeDoc,
readmeDocSource, readmeDocSource,
@@ -57,6 +58,112 @@ in
touch "$out" touch "$out"
''; '';
# The usage guides are hand-written; what can go stale in them is checked here. Every
# ```nix block that sets services.proxy-suite (in the guides and the README) must
# evaluate, with no proxy-suite assertion or warning; a block fenced ```nix no-check is
# skipped. Every relative link must reach a file, and its #anchor an <a id> there.
usage-docs =
let
inherit (pkgs) lib;
usageDir = ../../docs/usage;
guides = builtins.filter (lib.hasSuffix ".md") (builtins.attrNames (builtins.readDir usageDir));
readmeText = builtins.readFile ../../README.md;
guideText = name: builtins.readFile (usageDir + "/${name}");
snippets =
text:
builtins.filter (lib.hasInfix "services.proxy-suite") (
map (chunk: builtins.head (lib.splitString "\n```" chunk)) (
builtins.tail (lib.splitString "```nix\n" text)
)
);
# Every visible option's value, so a wrong type fails too. Packages are skipped:
# forcing one evaluates its whole build graph. Removed options throw when read.
plain =
value:
if lib.isDerivation value then
null
else if builtins.isAttrs value then
lib.mapAttrs (_: plain) value
else if builtins.isList value then
map plain value
else
value;
visibleValues =
opts: cfg:
lib.mapAttrs (
name: opt: if lib.isOption opt then plain cfg.${name} else visibleValues opt cfg.${name}
) (lib.filterAttrs (name: opt: name != "_module" && (opt.visible or true) != false) opts);
snippetProblems =
where: snippet:
let
module = import (
builtins.toFile "snippet.nix" ''
{ config, lib, pkgs, ... }:
{
system.stateVersion = "26.05";
${snippet}
}
''
);
eval = evalProxySuite [ module ];
inherit (eval) config;
failed = map (a: a.message) (builtins.filter (a: !a.assertion) config.assertions);
own = builtins.filter (lib.hasPrefix "proxy-suite:") (failed ++ config.warnings);
in
builtins.addErrorContext "while evaluating ${where}" (
builtins.deepSeq (visibleValues eval.options.services.proxy-suite config.services.proxy-suite) (
map (message: "${where}: ${message}") own
)
);
textProblems =
file: text:
lib.concatLists (
lib.imap1 (index: snippetProblems "${file}, nix block ${toString index}") (snippets text)
);
# [text](target) and [text](target#anchor), except absolute URLs.
links =
text:
builtins.filter (link: !lib.hasInfix "://" (builtins.head link)) (
builtins.filter builtins.isList (builtins.split "]\\(([^)#]*)(#[^)]*)?\\)" text)
);
linkProblems =
name:
lib.concatMap (
link:
let
target = builtins.head link;
anchor = builtins.elemAt link 1;
path = if target == "" then usageDir + "/${name}" else usageDir + "/${target}";
where = "docs/usage/${name}: ${target}${if anchor == null then "" else anchor}";
in
if !builtins.pathExists path then
[ "${where}: no such file" ]
else if
anchor != null && !lib.hasInfix "<a id=\"${lib.removePrefix "#" anchor}\">" (builtins.readFile path)
then
[ "${where}: no such anchor" ]
else
[ ]
) (links (guideText name));
problems =
textProblems "README.md" readmeText
++ lib.concatMap (
name: textProblems "docs/usage/${name}" (guideText name) ++ linkProblems name
) guides;
in
pkgs.runCommand "proxy-suite-usage-docs-check" { } (
if problems == [ ] then
''touch "$out"''
else
''
printf '%s\n' ${lib.escapeShellArgs problems} >&2
exit 1
''
);
# The tree as `nix fmt` leaves it. # The tree as `nix fmt` leaves it.
nix-format = nix-format =
pkgs.runCommand "proxy-suite-nix-format-check" { nativeBuildInputs = [ pkgs.nixfmt ]; } pkgs.runCommand "proxy-suite-nix-format-check" { nativeBuildInputs = [ pkgs.nixfmt ]; }
+63
View File
@@ -46,6 +46,69 @@ let
in in
import ./options-doc/render-options-markdown.nix { import ./options-doc/render-options-markdown.nix {
inherit pkgs optionDocs; inherit pkgs optionDocs;
# The index lists the groups in this order.
groupSummaries = [
{
name = "proxy";
summary = "The local proxy: outbounds, subscriptions, selection, routing, DNS, TUN and TProxy.";
}
{
name = "killSwitch";
summary = "Block traffic outside the global tunnel.";
}
{
name = "perAppRouting";
summary = "Route single apps through proxychains, a per-app TUN or TProxy, or zapret.";
}
{
name = "zapret";
summary = "DPI bypass without a proxy: zapret-discord-youtube or zapret2.";
}
{
name = "amneziaWg";
summary = "AmneziaWG client profiles, as a global VPN or as outbounds.";
}
{
name = "warp";
summary = "Cloudflare WARP, as an outbound or an AmneziaWG profile.";
}
{
name = "tor";
summary = "Tor as an outbound, with bridges, and an onion service for the inbounds.";
}
{
name = "sshProxy";
summary = "An SSH SOCKS5 tunnel, optionally as an outbound.";
}
{
name = "tgWsProxy";
summary = "A Telegram MTProto proxy over WebSocket.";
}
{
name = "whitelistBypass";
summary = "Tunnels through video-call servers, past mobile internet whitelists.";
}
{
name = "inbounds";
summary = "Server side: listeners for remote clients, share links, subscriptions and stats.";
}
{
name = "geodata";
summary = "Geosite and geoip databases used by routing.";
}
{
name = "userControl";
summary = "Let a group use `proxy-ctl` without root.";
}
{
name = "gui";
summary = "The desktop app with a tray icon.";
}
{
name = "tui";
summary = "The `proxy-tui` terminal UI.";
}
];
defaultConfigText = lib.generators.toPretty { allowPrettyValues = true; } ( defaultConfigText = lib.generators.toPretty { allowPrettyValues = true; } (
visibleConfig eval.options.services.proxy-suite eval.config.services.proxy-suite visibleConfig eval.options.services.proxy-suite eval.config.services.proxy-suite
); );
+108 -8
View File
@@ -2,16 +2,105 @@
pkgs, pkgs,
optionDocs, optionDocs,
defaultConfigText, defaultConfigText,
groupSummaries,
}: }:
let
# Type, Default and Example as one short paragraph per option instead of three
# headed blocks each; short values inline, the rest as code after it.
compactFields = pkgs.writeText "compact-fields.py" ''
import re
import sys
from pathlib import Path
FIELD = re.compile(r"^\*(Type|Default|Example):\*$")
FENCE = re.compile(r"^`{3,}")
path = Path(sys.argv[1])
lines = path.read_text().split("\n")
out = []
option_type = None
para = []
i = 0
def flush():
# Hard line breaks, not a list: a list would merge with one that ends the
# description.
if para:
if out[-1] != "":
out.append("")
out.append("\\\n".join(para))
para.clear()
def flat(code):
# `[ "a" "b" ]` and `{ a = 1; }` read fine on one line; multi-line strings do not.
if any("'" * 2 in line or "`" in line for line in code):
return None
text = " ".join(line.strip() for line in code)
return text if len(text) <= 72 else None
while i < len(lines):
match = FIELD.match(lines[i])
if not match:
out.append(lines[i])
i += 1
continue
name = match.group(1)
i += 1
if lines[i] == "" and FENCE.match(lines[i + 1]):
fence = FENCE.match(lines[i + 1]).group(0)
end = lines.index(fence, i + 2)
code, text = lines[i + 2 : end], None
i = end + 1
else:
end = lines.index("", i)
code, text = None, " ".join(lines[i:end])
i = end
if name == "Type":
option_type = text
# mkEnableOption's example says nothing.
if not (name == "Example" and option_type == "boolean" and code == ["true"]):
label = f"**{name}:**"
if code is None:
para.append(f"{label} {text}")
elif flat(code) is not None:
para.append(f"{label} `{flat(code)}`")
else:
para.append(label)
flush()
out.extend(["", f"{fence}nix", *code, fence])
# Keep the fields of one option together.
after = i
while after < len(lines) and lines[after] == "":
after += 1
if after < len(lines) and FIELD.match(lines[after]):
i = after
else:
flush()
path.write_text("\n".join(out))
'';
summaryTsv = pkgs.writeText "group-summaries.tsv" (
pkgs.lib.concatMapStrings (group: "${group.name}\t${group.summary}\n") groupSummaries
);
in
# One file per top-level option group, plus an index. The single 6k-line page was # One file per top-level option group, plus an index. The single 6k-line page was
# not navigable. # not navigable.
pkgs.runCommand "proxy-suite-options-doc" { } '' pkgs.runCommand "proxy-suite-options-doc" { nativeBuildInputs = [ pkgs.python3 ]; } ''
mkdir -p "$out" "$TMPDIR/bodies" mkdir -p "$out" "$TMPDIR/bodies"
all="$TMPDIR/all.md" all="$TMPDIR/all.md"
index_tsv="$TMPDIR/sections-index.tsv" index_tsv="$TMPDIR/sections-index.tsv"
cat ${optionDocs.optionsCommonMark} >"$all" cat ${optionDocs.optionsCommonMark} >"$all"
python ${compactFields} "$all"
summary() { awk -F '\t' -v want="$1" '$1 == want { print $2 }' ${summaryTsv}; }
# Anchor every section and file it under its top-level group. Options directly # Anchor every section and file it under its top-level group. Options directly
# under services.proxy-suite (only `enable`) stay on the index. # under services.proxy-suite (only `enable`) stay on the index.
@@ -108,9 +197,17 @@ pkgs.runCommand "proxy-suite-options-doc" { } ''
' "$index_tsv" ' "$index_tsv"
} }
# Groups in the summary list's order, then any it misses.
ordered="$(
{ cut -f1 ${summaryTsv}; printf '%s\n' $groups; } \
| awk -v groups=" $(echo $groups) " 'index(groups, " " $0 " ") && !seen[$0]++'
)"
for group in $groups; do for group in $groups; do
{ {
printf '# services.proxy-suite.%s\n\n' "$group" printf '# services.proxy-suite.%s\n\n' "$group"
text="$(summary "$group")"
if [ -n "$text" ]; then printf '%s\n\n' "$text"; fi
printf 'Part of the [proxy-suite options reference](./index.md).\n\n' printf 'Part of the [proxy-suite options reference](./index.md).\n\n'
printf '## Options\n\n' printf '## Options\n\n'
mkToc "$group" mkToc "$group"
@@ -126,19 +223,22 @@ pkgs.runCommand "proxy-suite-options-doc" { } ''
printf 'Update the module option docs there instead of editing these files by hand.\n\n' printf 'Update the module option docs there instead of editing these files by hand.\n\n'
printf '## Option groups\n\n' printf '## Option groups\n\n'
for group in $groups; do printf '| Group | What it covers |\n|---|---|\n'
printf -- '- [%s](./%s.md)\n' "$group" "$group" for group in $ordered; do
printf '| [%s](./%s.md) | %s |\n' "$group" "$group" "$(summary "$group")"
done done
printf '\n' printf '\n'
printf '## Complete default config\n\n'
printf '```nix\n'
printf 'services.proxy-suite = %s;\n' ${pkgs.lib.escapeShellArg defaultConfigText}
printf '```\n\n'
if [ -f "$TMPDIR/bodies/index.md" ]; then if [ -f "$TMPDIR/bodies/index.md" ]; then
cat "$TMPDIR/bodies/index.md" cat "$TMPDIR/bodies/index.md"
printf '\n'
fi fi
printf '## Complete default config\n\n'
printf '<details>\n<summary>Every option at its default</summary>\n\n'
printf '```nix\n'
printf 'services.proxy-suite = %s;\n' ${pkgs.lib.escapeShellArg defaultConfigText}
printf '```\n\n</details>\n'
} >"$TMPDIR/index.out" } >"$TMPDIR/index.out"
# Collapse runs of blank lines, drop trailing ones. # Collapse runs of blank lines, drop trailing ones.
+47 -51
View File
@@ -50,93 +50,89 @@ RESTART_SERVICES = [
HELP = """\ HELP = """\
Usage: proxy-ctl <group> [verb] [args] Usage: proxy-ctl <group> [verb] [args]
A group without a verb shows its status or list. A group alone shows its status or list.
Every group with on|off also takes toggle (on if stopped, off if running) and restart. Groups with on|off also take toggle and restart.
Secrets and changes need root, or the userControl group. Changes and secrets need root or the userControl group.
status [--json] services and routing mode (--tray: deprecated key=value lines) status [--json] services and routing mode (--tray: deprecated)
restart restart active services restart restart running services
logs [unit] follow logs (default: every proxy-suite unit) logs [unit] follow logs (default: all proxy-suite units)
where <domain> how this host is routed right now where <domain> how a domain is routed right now
proxy [status|on|off] local proxy backend proxy [status|on|off] local proxy
proxy outbounds [list] outbounds, where each came from, and the pick proxy outbounds [list] outbounds, their source, and the current pick
proxy outbounds add [tag] <url|json|-> [--detour <tag>] proxy outbounds add [tag] <url|json|-> [--detour <tag>]
add an outbound at runtime: a URL, or sing-box/XRay JSON (-: stdin), add an outbound from a link or JSON (-: stdin);
chained through another outbound with --detour; the tag first, --detour: connect through another outbound
or left out to name it after the link
proxy outbounds chain <tag> <through-tag> [new tag] proxy outbounds chain <tag> <through-tag> [new tag]
add a copy of an existing outbound that dials through add a copy of an outbound that connects through another
another one; the original keeps dialing the way it did
proxy outbounds rm <tag> remove a runtime outbound proxy outbounds rm <tag> remove a runtime outbound
proxy outbounds disable|enable <tag> keep an outbound out of automatic use (selection, autoProxy, pins), proxy outbounds disable|enable <tag> exclude from automatic use (selection, autoProxy), or undo
or let it back in; declared ones too
proxy outbounds test [tag...] [--ping] [--delay] [--download] proxy outbounds test [tag...] [--ping] [--delay] [--download]
TCP ping, real delay, download speed (default: ping, delay) test ping, delay, download speed (default: ping, delay)
proxy outbounds link <tag> [--qr|--json|--config] proxy outbounds link <tag> [--qr|--json|--config]
its URL, QR code, backend JSON, or a client config for it its link, QR code, JSON, or client config
proxy pin [tag] always use this outbound (no tag: pick from a menu) proxy pin [tag] always use this outbound (no tag: pick from a menu)
proxy unpin let the configured selection pick again proxy unpin go back to automatic selection
proxy mode [default|whitelist|blacklist|all-proxy|all-bypass] proxy mode [default|whitelist|blacklist|all-proxy|all-bypass]
show or override the routing mode show or override the routing mode
proxy subs [list|update] subscription caches; update refetches them proxy subs [list|update] subscriptions; update refetches them
proxy subs add [tag] <url> add a subscription at runtime; no tag: named after its host proxy subs add [tag] <url> add a subscription (no tag: named after its host)
proxy subs rm <tag> remove a runtime subscription proxy subs rm <tag> remove a runtime subscription
proxy subs link <tag> [--qr] its URL proxy subs link <tag> [--qr] its URL
proxy rulesets [list|update] routing rule sets: when each was fetched; update fetches them now proxy rulesets [list|update] rule sets and when they were fetched; update refetches
proxy config [--raw] client config to import elsewhere; --raw: as running proxy config [--raw] client config to use elsewhere; --raw: as running
proxy tun [status|on|off] global TUN mode proxy tun [status|on|off] global TUN mode
proxy tproxy [status|on|off] global TProxy mode proxy tproxy [status|on|off] global TProxy mode
proxy auto [list] what autoProxy routed, and via which exit proxy auto [list] what autoProxy routed, and through which exit
proxy auto probe <domain>[/path] [--json] [--keep-going] [--exits a,b | --via tag] proxy auto probe <domain>[/path] [--json] [--keep-going] [--exits a,b | --via tag]
find an exit that reaches a domain find an exit that reaches a domain
proxy auto learn <domain> probe now and route it if an exit works proxy auto learn <domain> probe now, and route it if an exit works
proxy auto forget <domain> drop what was learned about it: direct until learned again proxy auto forget <domain> forget it (direct until learned again)
proxy auto relearn <domain> forget it, then probe the host it was learned from now proxy auto relearn <domain> forget it and probe again now
proxy auto clear forget every learned route and verdict proxy auto clear forget everything learned
proxy auto queue [count] destinations waiting to be probed proxy auto queue [count] destinations waiting to be probed
zapret [status|on|off] DPI bypass zapret [status|on|off] DPI bypass
zapret auto [list] hosts zapret2 learned as blocked zapret auto [list] sites zapret2 learned as blocked
zapret auto add|forget|exclude <domain> zapret auto add|forget|exclude <domain>
pin, forget, or never learn a host pin, forget, or never learn a site
zapret auto unpin|include <domain> undo add, or undo exclude zapret auto unpin|include <domain> undo add or exclude
zapret auto clear forget learned hosts and strategies zapret auto clear forget learned sites and strategies
zapret cutoff [status] networks this line cuts at 16 KB, and their names zapret cutoff [status] networks cut off at 16 KB, and names that pass
zapret cutoff probe probe this line again now zapret cutoff probe probe again now
awg [list] AmneziaWG profiles and their state awg [list] AmneziaWG profiles
awg on <profile> | off [profile] | toggle [profile] | restart [profile] awg on <profile> | off [profile] | toggle [profile] | restart [profile]
killswitch [status|on|off] reject traffic outside the global tunnel; up with killswitch [status|on|off] block traffic outside the global tunnel;
TUN, TProxy or AWG, lifted only by off here or on them stays on until turned off here or with the tunnel
ssh [status|on|off] SSH SOCKS5 tunnel ssh [status|on|off] SSH tunnel
warp [status|on|off] WARP tunnel behind the warp outbound warp [status|on|off] WARP tunnel
tor [status|on|off] Tor, behind the tor outbound and the onion service tor [status|on|off] Tor
tor newnym new circuits for new connections tor newnym new circuits for new connections
tg [status|on|off] Telegram WebSocket proxy tg [status|on|off] Telegram proxy
wl [list] whitelist-bypass creators and joiners wl [list] whitelist-bypass creators and joiners
wl link <creator> [--qr] the call link its joiner takes wl link <creator> [--qr] the call link for its joiner
wl auth <creator> [file|-] replace its login: cookies, or asked (DION, Bitrix) wl auth <creator> [file|-] replace its login: cookies, or prompt (DION, Bitrix)
wl join <joiner> <link|-> the call it joins, over its linkFile wl join <joiner> <link|-> set the call to join
wl new <creator> drop its call for a new one wl new <creator> start a new call
wl on|off|toggle|restart [name] one creator or joiner, or all of them wl on|off|toggle|restart [name] one creator or joiner, or all
apps [list] per-app routing profiles apps [list] per-app routing profiles
apps run <profile> -- <cmd> [args] run a command through a profile apps run <profile> -- <cmd> [args] run a command through a profile
inbounds [list] server inbounds inbounds [list] server inbounds
inbounds link <tag> [user] [--onion] [--qr|--json] inbounds link <tag> [user] [--onion] [--qr|--json]
client share link, or the client's outbound JSON; share link or client JSON; --onion: via the onion service
--onion: the one through the onion service
inbounds link <tag> [user] --config [--qr] inbounds link <tag> [user] --config [--qr]
an AmneziaWG client's .conf, or its QR code AmneziaWG client .conf or its QR code
inbounds link <tag> --server-json the server's inbound JSON inbounds link <tag> --server-json the server's inbound JSON
inbounds sub [user] [--qr] subscription users, or one user's URL inbounds sub [user] [--qr] subscription users, or one user's URL
inbounds stats [days] [--by user|inbound|outbound] inbounds stats [days] [--by user|inbound|outbound]
traffic per user, listener or exit traffic by user, listener or exit
inbounds online who is connected now, and when the rest were last seen inbounds online who is online, and when others were last seen
""" """
ROUTE_MODES = ["whitelist", "blacklist", "all-proxy", "all-bypass"] ROUTE_MODES = ["whitelist", "blacklist", "all-proxy", "all-bypass"]