fix: zapret2 improvements

This commit is contained in:
FUFSoB committed 2026-10-04 17:07:45 +05:00
1 parent 65082aad88
commit 552bfd53b1
30 files changed
+872 -49

No files matched your search

+4
View File
@@ -405,14 +405,18 @@ services.proxy-suite = {
enable = true;
proxyFallback = true;
};
debug = false;
domains = [ ];
excludeDomains = [ ];
ipv6 = false;
ports = {
extraTcp = [ ];
extraUdp = [ ];
tcp = null;
udp = null;
};
profiles = null;
strategyLog = true;
strategySource = "nfqws2-keenetic";
};
};
+48 -3
View File
@@ -53,13 +53,17 @@ Part of the [proxy-suite options reference](./index.md).
- cutoff
- [enable](#services-proxy-suite-zapret-zapret2-cutoff-enable)
- [proxyFallback](#services-proxy-suite-zapret-zapret2-cutoff-proxyfallback)
- [debug](#services-proxy-suite-zapret-zapret2-debug)
- [domains](#services-proxy-suite-zapret-zapret2-domains)
- [excludeDomains](#services-proxy-suite-zapret-zapret2-excludedomains)
- [ipv6](#services-proxy-suite-zapret-zapret2-ipv6)
- ports
- [extraTcp](#services-proxy-suite-zapret-zapret2-ports-extratcp)
- [extraUdp](#services-proxy-suite-zapret-zapret2-ports-extraudp)
- [tcp](#services-proxy-suite-zapret-zapret2-ports-tcp)
- [udp](#services-proxy-suite-zapret-zapret2-ports-udp)
- [profiles](#services-proxy-suite-zapret-zapret2-profiles)
- [strategyLog](#services-proxy-suite-zapret-zapret2-strategylog)
- [strategySource](#services-proxy-suite-zapret-zapret2-strategysource)
<a id="services-proxy-suite-zapret-enable"></a>
@@ -90,7 +94,9 @@ Subnets zapret skips\.
<a id="services-proxy-suite-zapret-directsync-enable"></a>
## services\.proxy-suite\.zapret\.directSync\.enable
Send zapret’s domains direct in the proxy routing, so zapret handles them\.
Send zapret’s domains direct in the proxy routing, so zapret handles them\. With zapret2,
also the sites it pins and learns at runtime, after your own rules and autoProxy’s\.
The all-proxy and all-bypass route modes leave them out, like every direct list\.
**Type:** boolean\
**Default:** `true`
@@ -415,6 +421,14 @@ sees by IP (TUN, TProxy, per-app routing)\. Explicit direct rules still win\.
**Type:** boolean\
**Default:** `true`
<a id="services-proxy-suite-zapret-zapret2-debug"></a>
## services\.proxy-suite\.zapret\.zapret2\.debug
Log everything nfqws2 does to the journal, every packet included\. Very verbose: for troubleshooting\.
**Type:** boolean\
**Default:** `false`
<a id="services-proxy-suite-zapret-zapret2-domains"></a>
## services\.proxy-suite\.zapret\.zapret2\.domains
@@ -441,10 +455,32 @@ Handle IPv6 too\.
**Type:** boolean\
**Default:** `false`
<a id="services-proxy-suite-zapret-zapret2-ports-extratcp"></a>
## services\.proxy-suite\.zapret\.zapret2\.ports\.extraTcp
More TCP ports, handled like the profiles’ own: each profile that recognizes its traffic
(` --filter-l7 `, e\.g\. TLS) gets them too, so TLS to a blocked site on one of these ports
gets the same strategies\. A profile without ` --filter-l7 ` keeps its ports\.
**Type:** list of (16 bit unsigned integer; between 0 and 65535 (both inclusive) or string matching the pattern \[0-9]+(-\[0-9]+)?)\
**Default:** `[ ]`\
**Example:** `[ 8444 "9000-9010" ]`
<a id="services-proxy-suite-zapret-zapret2-ports-extraudp"></a>
## services\.proxy-suite\.zapret\.zapret2\.ports\.extraUdp
More UDP ports, handled like the profiles’ own: each profile that recognizes its traffic
(` --filter-l7 `, e\.g\. STUN, Discord, QUIC) gets them too, so a game’s or call app’s STUN
on these ports gets the same strategies as Discord’s\.
**Type:** list of (16 bit unsigned integer; between 0 and 65535 (both inclusive) or string matching the pattern \[0-9]+(-\[0-9]+)?)\
**Default:** `[ ]`\
**Example:** `[ "27015-27030" ]`
<a id="services-proxy-suite-zapret-zapret2-ports-tcp"></a>
## services\.proxy-suite\.zapret\.zapret2\.ports\.tcp
TCP ports zapret2 handles\. Must include every port a profile uses\. ` null `: use the ports from ` strategySource `\.
TCP ports zapret2 handles\. The ports the profiles filter on and ` extraTcp ` are always added\. ` null `: use the ports from ` strategySource `\.
**Type:** null or string\
**Default:** `null`\
@@ -453,7 +489,7 @@ TCP ports zapret2 handles\. Must include every port a profile uses\. ` null `: u
<a id="services-proxy-suite-zapret-zapret2-ports-udp"></a>
## services\.proxy-suite\.zapret\.zapret2\.ports\.udp
UDP ports zapret2 handles\. Must include every port a profile uses\. ` null `: use the ports from ` strategySource `\.
UDP ports zapret2 handles\. The ports the profiles filter on and ` extraUdp ` are always added\. ` null `: use the ports from ` strategySource `\.
**Type:** null or string\
**Default:** `null`\
@@ -476,6 +512,15 @@ learning\. ` --qnum `, ` --fwmark ` and ` --lua-init ` are added for you\. ` nul
]
```
<a id="services-proxy-suite-zapret-zapret2-strategylog"></a>
## services\.proxy-suite\.zapret\.zapret2\.strategyLog
Log each counted failure and strategy switch to the journal, per site
(` proxy-ctl logs proxy-suite-zapret `)\. Without it nfqws2 logs them only with ` debug `\.
**Type:** boolean\
**Default:** `true`
<a id="services-proxy-suite-zapret-zapret2-strategysource"></a>
## services\.proxy-suite\.zapret\.zapret2\.strategySource
+1 -12
View File
@@ -1,15 +1,4 @@
{ 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;
};
};
services.proxy-suite.zapret.zapret2.ports.extraUdp = [ "27015-27030" ];
}
+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;
};
};
}
+5 -2
View File
@@ -81,8 +81,11 @@ proxySuite = inputs.proxy-suite.lib.proxyHelpers {
## Reference
- `urls.http`, `urls.socks`: the proxy's URLs. A listener on `0.0.0.0` or `::` is reached on
loopback.
- `urls.http`, `urls.socks5h`, `urls.socks5`: the proxy's URLs. A listener on `0.0.0.0` or
`::` is reached on loopback. With `socks5h://` the proxy resolves names; `socks5://`
resolves them locally, for programs that do not accept `socks5h://`, such as Chromium and
Electron apps.
- `urls.socks`: the same as `urls.socks5h`.
- `env`: every proxy variable (`http_proxy`, `https_proxy`, `all_proxy`, their upper-case
forms, and `no_proxy`). `envFor "http"` or `envFor "socks"` gives one kind only.
- `wrapEnv { protocol ? "http"; programs ? null; } package`: the package, with its programs
+16 -2
View File
@@ -45,6 +45,17 @@ services.proxy-suite = {
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.
Each failure zapret2 counts and each strategy switch is logged, per site:
`proxy-ctl logs proxy-suite-zapret`. A site stays on its first strategy as long as that one
works.
Other ports, such as a game's, take the same strategies with `zapret2.ports.extraUdp` or
`extraTcp`:
```nix
services.proxy-suite.zapret.zapret2.ports.extraUdp = [ "27015-27030" ];
```
## Commands
```sh
@@ -60,8 +71,10 @@ 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).
handles are sent direct, so they skip the proxy and reach zapret. With zapret2 that includes
the sites it learns and the ones you pin with `proxy-ctl zapret auto add`, as soon as they
are added; your own rules and autoProxy still come first. Everything else follows your
[routing rules](./routing.md).
## Only for some apps
@@ -100,4 +113,5 @@ belong to the system-wide zapret, so they do nothing here. See
- [`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)
- [`zapret2.ports.extraUdp`](../options/zapret.md#services-proxy-suite-zapret-zapret2-ports-extraudp)
- [`zapret.directSync`](../options/zapret.md#services-proxy-suite-zapret-directsync-enable)