fix: behavior and docs fixes

This commit is contained in:
FUFSoB committed 2026-09-26 18:35:32 +05:00
1 parent e4458dcae8
commit 2255e1f9f0
42 files changed
+320 -161

No files matched your search

@@ -30,10 +30,10 @@ in
routing = {
# Unlisted sites leave directly, where zapret2 unblocks what DPI blocks.
default = "direct";
# Russian sites are routed by the last rule below instead.
# Russian sites go to WARP by the last rule below instead.
directRu = false;
# Checked in order; the first match wins.
# Checked in order, before the lists; the first match wins.
rules = [
{
outbound = "ssh-proxy";
@@ -43,7 +43,7 @@ in
outbound = "warp";
geosites = [ "youtube" ];
}
# To mask your IP from Russian services
# Russian services see WARP's address instead of this host's.
{
outbound = "warp";
geosites = [ "category-ru" ];
@@ -60,8 +60,8 @@ in
};
};
# For blocked sites no list names yet. YouTube is pinned to WARP above, so it
# is kept out of the probes.
# For blocked sites no list names yet. YouTube already has its rule, so its video
# hosts are not worth probing.
autoProxy = {
enable = true;
exclude = [ "googlevideo.com" "gvt1.com" ];
@@ -85,7 +85,8 @@ in
hostKeyFile = "/run/secrets/proxy-ssh-known-hosts";
};
# Tor through the proxy, since this network blocks Tor.
# .onion names go to Tor without a rule. Tor is blocked here, so it connects
# through the proxy.
tor = {
enable = true;
asOutbound = true;
@@ -18,8 +18,8 @@ in
listeners.vpn = {
type = "amneziawg";
port = 51820;
# Fixed addresses, so firewall rules and DNS can name each device. Keys are
# generated on first start.
# Fixed addresses, so firewall rules and DNS can name each device.
# Keys are generated on first start.
users = [
{ name = "laptop"; address = "10.77.77.2"; }
{ name = "phone"; address = "10.77.77.3"; }
@@ -25,8 +25,7 @@ let
sharePort = 443; # share links name nginx's port, not the listener's
transport = extra // {
inherit path;
# nginx sets this header, so XRay sees each client's real address (for
# `proxy-ctl inbounds online`). A client cannot forge it: nginx overwrites it.
# nginx sets this header, so XRay sees each client's real address (for `proxy-ctl inbounds online`). A client cannot forge it: nginx overwrites it.
trustedXForwardedFor = [ "X-Real-IP" ];
};
inherit tls;
@@ -8,6 +8,8 @@ in
proxy = {
enable = true;
# Support all available protocols by enabling hybrid backend.
backend = "hybrid";
# The server's subscription: every listener, each a separate outbound.
subscriptions = [ { tag = "home"; urlFile = "/run/secrets/proxy-home-sub"; } ];
# The fastest listener that gets through the current network.
@@ -16,7 +18,7 @@ in
routing.default = "direct";
autoProxy.enable = true;
tun.enable = true; # when everything should go through: proxy-ctl proxy tun on
tun.enable = true; # when everything should go through: `proxy-ctl proxy tun on`
};
zapret = {
+1 -1
View File
@@ -19,7 +19,7 @@
enable = true;
serverNames = [ "www.microsoft.com" ];
privateKeyFile = "/run/secrets/reality-private-key";
publicKey = "jNXH…"; # from the same `xray x25519` run
publicKey = "jNXH…"; # both keys from `xray x25519`
shortIds = [ "0123abcd" ];
};
};
+1 -1
View File
@@ -19,7 +19,7 @@ in
environment.systemPackages = [
(proxySuite.wrapEnv { } pkgs.yt-dlp)
(proxySuite.wrapProxychains { } pkgs.telegram-desktop)
(proxySuite.wrapProxychains { } pkgs.curl)
(proxySuite.wrapPerApp { profile = "tun"; } pkgs.firefox)
];
+15
View File
@@ -0,0 +1,15 @@
{ config, lib, pkgs, ... }:
{
services.proxy-suite = {
enable = true;
zapret = {
enable = true;
global.enable = false; # no system-wide zapret
};
perAppRouting = {
enable = true;
createDefaultProfiles = true; # adds a profile named "zapret"
zapret.enable = true;
};
};
}
-1
View File
@@ -64,7 +64,6 @@ 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
+37 -15
View File
@@ -1,8 +1,18 @@
# Example: several exits, picked per site
One host with four ways out: direct (with zapret2 for DPI), a VPS, WARP and an SSH server.
Each site goes to whichever works best for it, and autoProxy covers the sites nobody
listed. Everything runs in global TUN mode, so every app on the host follows these rules.
A host in Russia with five ways out: direct (with zapret2 for DPI), a VPS, WARP, an SSH
server and Tor. Each site goes to whichever works best for it, and autoProxy covers the
sites nobody listed. On a [relay server](./relay-server.md), its clients get the same
choice, with a few differences shown below.
| Exit | Tag | Gets |
|---|---|---|
| This host, with zapret2 | `direct` | Everything not listed below |
| The VPS | `primary`, as the selected `proxy` | AI services, Telegram, Netflix, WARP's registration |
| The SSH server | `ssh-proxy` | pixiv, Twitter |
| WARP | `warp` | YouTube, Russian sites |
| Tor | `tor` | `.onion` names |
| Whichever reaches it first | set by autoProxy | Blocked sites no list names |
```nix
{ ... }:
@@ -37,10 +47,10 @@ in
routing = {
# Unlisted sites leave directly, where zapret2 unblocks what DPI blocks.
default = "direct";
# Russian sites are routed by the last rule below instead.
# Russian sites go to WARP by the last rule below instead.
directRu = false;
# Checked in order; the first match wins.
# Checked in order, before the lists; the first match wins.
rules = [
{
outbound = "ssh-proxy";
@@ -50,7 +60,7 @@ in
outbound = "warp";
geosites = [ "youtube" ];
}
# To mask your IP from Russian services
# Russian services see WARP's address instead of this host's.
{
outbound = "warp";
geosites = [ "category-ru" ];
@@ -67,7 +77,8 @@ in
};
};
# For blocked sites no list names yet. YouTube is pinned to WARP above, so it is kept out of the probes.
# For blocked sites no list names yet. YouTube already has its rule, so its video
# hosts are not worth probing.
autoProxy = {
enable = true;
exclude = [ "googlevideo.com" "gvt1.com" ];
@@ -91,6 +102,14 @@ in
hostKeyFile = "/run/secrets/proxy-ssh-known-hosts";
};
# .onion names go to Tor without a rule. Tor is blocked here, so it connects
# through the proxy.
tor = {
enable = true;
asOutbound = true;
upstream = "proxy";
};
zapret = {
enable = true;
engine = "zapret2";
@@ -103,6 +122,7 @@ in
```sh
proxy-ctl where youtube.com # -> warp, by the rule for youtube
proxy-ctl where pixiv.net # -> ssh-proxy, by the first rule
proxy-ctl where chatgpt.com # -> proxy -> primary, by geosite openai
proxy-ctl proxy auto # what autoProxy routed, and through which exit
proxy-ctl zapret auto # what zapret2 learned
@@ -110,24 +130,25 @@ proxy-ctl zapret auto # what zapret2 learned
## With relay clients
On a [relay server](./relay-server.md) with `inbounds.routing.via = "proxy"`, clients follow
these rules too, with two exceptions. Russian sites are blocked for them (`blockRu`), and
sites on zapret's list go straight out, so this host's zapret handles them (`zapretDirect`).
Sites listed in `inbounds.routing.proxy` skip both exceptions and go to the rules above:
With `inbounds.routing.via = "proxy"`, relay clients go through the routing above. Two
checks come first by default: Russian sites are blocked for them (`blockRu`), and sites on
zapret's list leave directly, so this host's zapret handles them (`zapretDirect`). Sites in
`inbounds.routing.proxy` skip both and reach the rules above:
```nix no-check
services.proxy-suite.inbounds.routing = {
via = "proxy";
blockRu = false; # clients may reach Russian sites, through WARP by the rule above
blockRu = false; # clients reach Russian sites too, through WARP by the rule above
proxy = {
domains = youtubeDomains; # on zapret's list, but WARP works better here
# YouTube is on zapret's list, but WARP works better for it.
geosites = [ "youtube" "category-ru" ];
geoips = [ "ru" ];
};
};
```
The same list applies to listeners with their own `via`, including `"direct"` ones.
`inbounds.routing.proxy` covers listeners with their own `via` too, `"direct"` ones
included, so their YouTube and Russian sites also go through WARP.
## Notes
@@ -135,4 +156,5 @@ The same list applies to listeners with their own `via`, including `"direct"` on
country).
- Rules can name any outbound tag: yours, `warp`, `ssh-proxy`, `tor`, or an AmneziaWG
outbound.
- `.onion` names go to Tor without a rule.
- Selection and autoProxy skip `tor`; it gets only `.onion` names and what rules send to it.
- See [Chain proxies and add exits](../chains.md) for each kind of exit on its own.
+4 -6
View File
@@ -29,8 +29,8 @@ in
listeners.vpn = {
type = "amneziawg";
port = 51820;
# Fixed addresses, so firewall rules and DNS can name each device. Keys are
# generated on first start.
# Fixed addresses, so firewall rules and DNS can name each device.
# Keys are generated on first start.
users = [
{ name = "laptop"; address = "10.77.77.2"; }
{ name = "phone"; address = "10.77.77.3"; }
@@ -84,8 +84,6 @@ On a laptop that also runs proxy-suite, the `.conf` becomes a profile: see
## Notes
- `mode = "lan"` turns on IP forwarding. The default, `"proxy"`, gives devices the
internet only, like the other listeners.
- `mode = "lan"` turns on IP forwarding. The default, `"proxy"`, gives devices the internet only, like the other listeners.
- Only TCP and UDP reach the internet; ping and other protocols stop at the server.
- A device that keeps its own private key can be added with `users.*.publicKey` instead;
it gets no generated config.
- A device that keeps its own private key can be added with `users.*.publicKey` instead; it gets no generated config.
+1 -2
View File
@@ -45,8 +45,7 @@ let
sharePort = 443; # share links name nginx's port, not the listener's
transport = extra // {
inherit path;
# nginx sets this header, so XRay sees each client's real address (for
# `proxy-ctl inbounds online`). A client cannot forge it: nginx overwrites it.
# nginx sets this header, so XRay sees each client's real address (for `proxy-ctl inbounds online`). A client cannot forge it: nginx overwrites it.
trustedXForwardedFor = [ "X-Real-IP" ];
};
inherit tls;
+4 -2
View File
@@ -16,6 +16,8 @@ in
proxy = {
enable = true;
# Support all available protocols by enabling hybrid backend.
backend = "hybrid";
# The server's subscription: every listener, each a separate outbound.
subscriptions = [ { tag = "home"; urlFile = "/run/secrets/proxy-home-sub"; } ];
# The fastest listener that gets through the current network.
@@ -24,7 +26,7 @@ in
routing.default = "direct";
autoProxy.enable = true;
tun.enable = true; # when everything should go through: proxy-ctl proxy tun on
tun.enable = true; # when everything should go through: `proxy-ctl proxy tun on`
};
zapret = {
@@ -84,7 +86,7 @@ The tray app shows the same, and switches with a click.
do not know.
- The kill switch guards whichever global tunnel is on (TUN or the VPN), and does nothing
while both are off.
- Per-app `tun` profiles refuse to start while global TUN is on. Everything already goes
- While global TUN is on, per-app `tun` profiles run the app as it is. Everything already goes
through the proxy then.
- See [Wrap programs with the proxy](../wrap-apps.md) for the helpers, and
[Keep secrets out of the Nix store](../secrets.md) for the files under `/run/secrets`.
+3 -2
View File
@@ -38,7 +38,7 @@ Run it as yourself, not with sudo.
| `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. |
| `zapret` | What zapret handles | No proxy: runs a separate zapret for the app, to get past DPI. Needs `zapret.enable`; see [Unblock sites without a server](./zapret.md). |
`tun` works with any program. `proxychains` is handy for a quick command.
@@ -68,7 +68,8 @@ Then run `proxy-ctl apps run browser -- chromium`.
- `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.
- While a global TUN or TProxy is running, these three run the app without their route:
the global mode already carries its traffic. `proxy-ctl` prints a note when it does.
- 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.
+1 -1
View File
@@ -41,7 +41,7 @@ services.proxy-suite = {
enable = true;
serverNames = [ "www.microsoft.com" ];
privateKeyFile = "/run/secrets/reality-private-key";
publicKey = "jNXH…"; # from the same `xray x25519` run
publicKey = "jNXH…"; # both keys from `xray x25519`
shortIds = [ "0123abcd" ];
};
};
+2 -1
View File
@@ -50,7 +50,8 @@ proxy-ctl killswitch off # lift the kill switch without stopping the tunnel
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.
- While a global mode is on, per-app `tun`, `tproxy` and `zapret` profiles run the app
without their route, so wrapped programs still start.
## See also
+1 -1
View File
@@ -31,7 +31,7 @@ services.proxy-suite = {
};
```
The cookies come from the upstream desktop Creator app. They are read on first start, and
The cookies come from the upstream desktop Creator app or a browser. 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.
+1 -1
View File
@@ -35,7 +35,7 @@ in
environment.systemPackages = [
(proxySuite.wrapEnv { } pkgs.yt-dlp)
(proxySuite.wrapProxychains { } pkgs.telegram-desktop)
(proxySuite.wrapProxychains { } pkgs.curl)
(proxySuite.wrapPerApp { profile = "tun"; } pkgs.firefox)
];
+27 -3
View File
@@ -41,8 +41,8 @@ services.proxy-suite = {
};
```
`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
`zapret2.strategySource = "z2k"` switches to z2k's strategies and site lists, which includes
the full RKN list and uses more memory. It also turns on a workaround for ISPs that cut
TLS to some hosting networks after about 16 KB.
## Commands
@@ -63,7 +63,30 @@ zapret and the proxy work side by side. By default (`zapret.directSync`), the si
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).
## Only for some apps
To leave the rest of the system alone, turn the system-wide zapret off and run apps through
it one by one:
```nix
services.proxy-suite = {
enable = true;
zapret = {
enable = true;
global.enable = false; # no system-wide zapret
};
perAppRouting = {
enable = true;
createDefaultProfiles = true; # adds a profile named "zapret"
zapret.enable = true;
};
};
```
Then run `proxy-ctl apps run zapret -- firefox`. The app gets zapret's strategy for every
site, not only the listed ones. `directSync`, `cidrExemption` and the sites zapret2 learns
belong to the system-wide zapret, so they do nothing here. See
[Route a single app](./per-app.md) for more.
## Good to know
@@ -74,6 +97,7 @@ To use zapret for a single app only, see [Route a single app](./per-app.md).
## See also
- [`zapret.engine`](../options/zapret.md#services-proxy-suite-zapret-engine)
- [`zapret.global.enable`](../options/zapret.md#services-proxy-suite-zapret-global-enable)
- [`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)