feat: debug options
This commit is contained in:
33 files changed
+965
-77
No files matched your search
@@ -0,0 +1,125 @@
|
||||
# services.proxy-suite.debug
|
||||
|
||||
Troubleshooting: backend log levels, a connection recorder, DNS and zapret2 logs.
|
||||
|
||||
Part of the [proxy-suite options reference](./index.md).
|
||||
|
||||
## Options
|
||||
|
||||
- debug
|
||||
- connectionLog
|
||||
- [enable](#services-proxy-suite-debug-connectionlog-enable)
|
||||
- [hosts](#services-proxy-suite-debug-connectionlog-hosts)
|
||||
- [inbounds](#services-proxy-suite-debug-connectionlog-inbounds)
|
||||
- [interval](#services-proxy-suite-debug-connectionlog-interval)
|
||||
- [stallAfter](#services-proxy-suite-debug-connectionlog-stallafter)
|
||||
- [logLevel](#services-proxy-suite-debug-loglevel)
|
||||
- [perAppDns](#services-proxy-suite-debug-perappdns)
|
||||
- [tgWsProxy](#services-proxy-suite-debug-tgwsproxy)
|
||||
- zapret2
|
||||
- [autoHostlist](#services-proxy-suite-debug-zapret2-autohostlist)
|
||||
- [packets](#services-proxy-suite-debug-zapret2-packets)
|
||||
|
||||
<a id="services-proxy-suite-debug-connectionlog-enable"></a>
|
||||
## services\.proxy-suite\.debug\.connectionLog\.enable
|
||||
|
||||
Record the backends’ connections to the journal: each one as it opens, with its
|
||||
listener, site, rule and exit, and as it closes, with the bytes each way and how long
|
||||
it lasted\. For failures that come and go: look back at the time one happened\. A unit
|
||||
per backend, up while it is: proxy-suite-connection-log for the local proxy and
|
||||
global or per-app TProxy, proxy-suite-connection-log-tun for the global TUN and
|
||||
proxy-suite-connection-log-per-app-tun for per-app TUN, whose Clash APIs this turns
|
||||
on\. The same view live: ` proxy-ctl debug conns `\. Polls the Clash API, so it needs the
|
||||
sing-box or hybrid backend; a connection shorter than ` interval ` can be missed\.
|
||||
|
||||
**Type:** boolean\
|
||||
**Default:** `false`
|
||||
|
||||
<a id="services-proxy-suite-debug-connectionlog-hosts"></a>
|
||||
## services\.proxy-suite\.debug\.connectionLog\.hosts
|
||||
|
||||
Record only connections to these domains and their subdomains, or these addresses\.
|
||||
Empty: every connection\.
|
||||
|
||||
**Type:** list of string\
|
||||
**Default:** `[ ]`\
|
||||
**Example:** `[ "twimg.com" "x.com" ]`
|
||||
|
||||
<a id="services-proxy-suite-debug-connectionlog-inbounds"></a>
|
||||
## services\.proxy-suite\.debug\.connectionLog\.inbounds
|
||||
|
||||
Record only connections that came in on listeners whose tag starts with one of
|
||||
these: “tproxy” for global and per-app TProxy, “tun-in” for the global and per-app
|
||||
TUN, “per-app-pin” for apps run ` --via ` an outbound through TProxy, “mixed-in” for
|
||||
the local proxy\. Empty: every listener\.
|
||||
|
||||
**Type:** list of string\
|
||||
**Default:** `[ ]`\
|
||||
**Example:** `[ "tproxy" ]`
|
||||
|
||||
<a id="services-proxy-suite-debug-connectionlog-interval"></a>
|
||||
## services\.proxy-suite\.debug\.connectionLog\.interval
|
||||
|
||||
Seconds between looks at the connections\.
|
||||
|
||||
**Type:** positive integer or floating point number, meaning >0\
|
||||
**Default:** `0.5`
|
||||
|
||||
<a id="services-proxy-suite-debug-connectionlog-stallafter"></a>
|
||||
## services\.proxy-suite\.debug\.connectionLog\.stallAfter
|
||||
|
||||
Seconds a connection may wait on an answer: one that has sent since it last
|
||||
received, and received nothing for this long, is logged as stalled, and again
|
||||
when it resumes\. Several requests share a connection (HTTP/2), so a stall shows
|
||||
only when all of them wait\. 0: never\.
|
||||
|
||||
**Type:** unsigned integer, meaning >=0\
|
||||
**Default:** `10`
|
||||
|
||||
<a id="services-proxy-suite-debug-loglevel"></a>
|
||||
## services\.proxy-suite\.debug\.logLevel
|
||||
|
||||
How much the proxy backends log to the journal (` proxy-ctl logs proxy-suite-socks `):
|
||||
sing-box, and XRay where it runs (XRay has no “trace”: it logs at “debug” then)\.
|
||||
“info” logs every connection with its destination and the rule that routed it\.
|
||||
` /run/proxy-suite/xray-loglevel ` still overrides XRay’s level at the next start\.
|
||||
|
||||
**Type:** one of “warn”, “info”, “debug”, “trace”\
|
||||
**Default:** `"warn"`\
|
||||
**Example:** `"info"`
|
||||
|
||||
<a id="services-proxy-suite-debug-perappdns"></a>
|
||||
## services\.proxy-suite\.debug\.perAppDns
|
||||
|
||||
Log every lookup the per-app DNS forwarders send on (per-app TUN and TProxy, and apps
|
||||
run through an AmneziaWG interface): the name, its type, the answer’s code and how long
|
||||
it took, and the lookups that got no answer\. In the journals of
|
||||
proxy-suite-per-app-tun-dns, proxy-suite-per-app-tproxy-dns and
|
||||
proxy-suite-per-app-via@\.
|
||||
|
||||
**Type:** boolean\
|
||||
**Default:** `false`
|
||||
|
||||
<a id="services-proxy-suite-debug-tgwsproxy"></a>
|
||||
## services\.proxy-suite\.debug\.tgWsProxy
|
||||
|
||||
Log the Telegram proxy’s debug messages\.
|
||||
|
||||
**Type:** boolean\
|
||||
**Default:** `false`
|
||||
|
||||
<a id="services-proxy-suite-debug-zapret2-autohostlist"></a>
|
||||
## services\.proxy-suite\.debug\.zapret2\.autoHostlist
|
||||
|
||||
Log why sites are or are not learned (nfqws2’s own learner)\.
|
||||
|
||||
**Type:** boolean\
|
||||
**Default:** `false`
|
||||
|
||||
<a id="services-proxy-suite-debug-zapret2-packets"></a>
|
||||
## services\.proxy-suite\.debug\.zapret2\.packets
|
||||
|
||||
Log everything nfqws2 does to the journal, every packet included\. Very verbose\.
|
||||
|
||||
**Type:** boolean\
|
||||
**Default:** `false`
|
||||
+17
-3
@@ -24,6 +24,7 @@ Update the module option docs there instead of editing these files by hand.
|
||||
| [gui](./gui.md) | The desktop app with a tray icon. |
|
||||
| [tui](./tui.md) | The `proxy-tui` terminal UI. |
|
||||
| [tools](./tools.md) | Heavy helpers `proxy-ctl` can do without: lnav and curl-impersonate. |
|
||||
| [debug](./debug.md) | Troubleshooting: backend log levels, a connection recorder, DNS and zapret2 logs. |
|
||||
|
||||
<a id="services-proxy-suite-enable"></a>
|
||||
## services\.proxy-suite\.enable
|
||||
@@ -54,6 +55,22 @@ services.proxy-suite = {
|
||||
userspacePackage = ‹proxy-suite's patched amneziawg-go (pkgs/amneziawg.nix)›;
|
||||
wireproxyPackage = ‹proxy-suite's wireproxy-awg (pkgs/wireproxy-awg.nix)›;
|
||||
};
|
||||
debug = {
|
||||
connectionLog = {
|
||||
enable = false;
|
||||
hosts = [ ];
|
||||
inbounds = [ ];
|
||||
interval = 0.5;
|
||||
stallAfter = 10;
|
||||
};
|
||||
logLevel = "warn";
|
||||
perAppDns = false;
|
||||
tgWsProxy = false;
|
||||
zapret2 = {
|
||||
autoHostlist = false;
|
||||
packets = false;
|
||||
};
|
||||
};
|
||||
enable = false;
|
||||
geodata = {
|
||||
singBox = {
|
||||
@@ -319,7 +336,6 @@ services.proxy-suite = {
|
||||
file = null;
|
||||
keep = 1;
|
||||
maxSizeMiB = 5.0;
|
||||
verbose = false;
|
||||
};
|
||||
poolSize = 4;
|
||||
proxyProtocol = false;
|
||||
@@ -413,7 +429,6 @@ services.proxy-suite = {
|
||||
};
|
||||
zapret2 = {
|
||||
autoHostlist = {
|
||||
debugLog = false;
|
||||
enable = true;
|
||||
extendedDetection = true;
|
||||
failThreshold = 3;
|
||||
@@ -430,7 +445,6 @@ services.proxy-suite = {
|
||||
enable = true;
|
||||
proxyFallback = true;
|
||||
};
|
||||
debug = false;
|
||||
domains = [ ];
|
||||
excludeDomains = [ ];
|
||||
ipv6 = false;
|
||||
|
||||
@@ -24,7 +24,6 @@ Part of the [proxy-suite options reference](./index.md).
|
||||
- [file](#services-proxy-suite-tgwsproxy-log-file)
|
||||
- [keep](#services-proxy-suite-tgwsproxy-log-keep)
|
||||
- [maxSizeMiB](#services-proxy-suite-tgwsproxy-log-maxsizemib)
|
||||
- [verbose](#services-proxy-suite-tgwsproxy-log-verbose)
|
||||
- [poolSize](#services-proxy-suite-tgwsproxy-poolsize)
|
||||
- [proxyProtocol](#services-proxy-suite-tgwsproxy-proxyprotocol)
|
||||
- [secret](#services-proxy-suite-tgwsproxy-secret)
|
||||
@@ -147,14 +146,6 @@ Rotate the log at this size, in MiB\.
|
||||
**Type:** positive integer or floating point number, meaning >0\
|
||||
**Default:** `5.0`
|
||||
|
||||
<a id="services-proxy-suite-tgwsproxy-log-verbose"></a>
|
||||
## services\.proxy-suite\.tgWsProxy\.log\.verbose
|
||||
|
||||
Log debug messages\.
|
||||
|
||||
**Type:** boolean\
|
||||
**Default:** `false`
|
||||
|
||||
<a id="services-proxy-suite-tgwsproxy-poolsize"></a>
|
||||
## services\.proxy-suite\.tgWsProxy\.poolSize
|
||||
|
||||
|
||||
+2
-19
@@ -40,7 +40,6 @@ Part of the [proxy-suite options reference](./index.md).
|
||||
- zapret2
|
||||
- autoHostlist
|
||||
- [enable](#services-proxy-suite-zapret-zapret2-autohostlist-enable)
|
||||
- [debugLog](#services-proxy-suite-zapret-zapret2-autohostlist-debuglog)
|
||||
- [extendedDetection](#services-proxy-suite-zapret-zapret2-autohostlist-extendeddetection)
|
||||
- [failThreshold](#services-proxy-suite-zapret-zapret2-autohostlist-failthreshold)
|
||||
- [failTime](#services-proxy-suite-zapret-zapret2-autohostlist-failtime)
|
||||
@@ -54,7 +53,6 @@ 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)
|
||||
@@ -322,14 +320,6 @@ blocked\. When off, only ` zapret2.domains ` and ` proxy-ctl zapret auto add ` a
|
||||
**Type:** boolean\
|
||||
**Default:** `true`
|
||||
|
||||
<a id="services-proxy-suite-zapret-zapret2-autohostlist-debuglog"></a>
|
||||
## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.debugLog
|
||||
|
||||
Log why sites are or are not learned (nfqws2’s own learner)\.
|
||||
|
||||
**Type:** boolean\
|
||||
**Default:** `false`
|
||||
|
||||
<a id="services-proxy-suite-zapret-zapret2-autohostlist-extendeddetection"></a>
|
||||
## services\.proxy-suite\.zapret\.zapret2\.autoHostlist\.extendedDetection
|
||||
|
||||
@@ -436,14 +426,6 @@ 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
|
||||
|
||||
@@ -544,7 +526,8 @@ only where it sees the address)\. ` proxy-ctl zapret auto retry ` gives one anot
|
||||
## 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 `\.
|
||||
(` proxy-ctl logs proxy-suite-zapret `)\. Without it nfqws2 logs them only with
|
||||
` debug.zapret2.packets `\.
|
||||
|
||||
**Type:** boolean\
|
||||
**Default:** `true`
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||
};
|
||||
debug.connectionLog = {
|
||||
enable = true;
|
||||
hosts = [ "x.com" "twimg.com" ]; # leave empty for every site
|
||||
inbounds = [ "tproxy" ]; # global and per-app TProxy only
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||
};
|
||||
debug.logLevel = "info"; # every connection and the rule that routed it
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||
};
|
||||
perAppRouting = {
|
||||
enable = true;
|
||||
tproxy.enable = true;
|
||||
};
|
||||
debug.perAppDns = true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
# Track down a problem
|
||||
|
||||
Turn on more logging, and record connections, for a problem that comes and goes. Each of
|
||||
these logs to the journal; `proxy-ctl logs <unit>` follows it.
|
||||
|
||||
## Record connections
|
||||
|
||||
Pages that sometimes half load, or images left blank, are hard to catch on demand. Record
|
||||
the backend's connections and look back at the time it happened:
|
||||
|
||||
```nix
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||
};
|
||||
debug.connectionLog = {
|
||||
enable = true;
|
||||
hosts = [ "x.com" "twimg.com" ]; # leave empty for every site
|
||||
inbounds = [ "tproxy" ]; # global and per-app TProxy only
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
```sh
|
||||
journalctl -u 'proxy-suite-connection-log*' --since "10 min ago"
|
||||
```
|
||||
|
||||
There is a recorder per backend: `proxy-suite-connection-log` for the local proxy and TProxy,
|
||||
global or per-app, `proxy-suite-connection-log-tun` for the global TUN and
|
||||
`proxy-suite-connection-log-per-app-tun` for per-app TUN. Each runs while its backend does.
|
||||
TUN connections come in on `tun-in`: put that in `inbounds` too, or leave it empty.
|
||||
|
||||
Each connection gets a line as it opens, with its listener, site, rule and exit, and one as
|
||||
it closes, with the bytes each way. One that sent and got nothing back for
|
||||
`stallAfter` seconds is logged as `stalled`, and as `resumed` if the answer comes. A
|
||||
connection is looked at every `interval` seconds, so one shorter than that can be missed,
|
||||
and the byte counts are from the last look.
|
||||
|
||||
The same, live and without a rebuild:
|
||||
|
||||
```sh
|
||||
proxy-ctl debug conns --host twimg.com --inbound tproxy
|
||||
```
|
||||
|
||||
It needs root, or the `secrets` scope: connections show every site visited. `--backend tun`
|
||||
or `--backend per-app-tun` shows a TUN backend's, as root and with `debug.connectionLog` on,
|
||||
which gives those backends the API it reads.
|
||||
|
||||
## More from the backend
|
||||
|
||||
```nix
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||
};
|
||||
debug.logLevel = "info"; # every connection and the rule that routed it
|
||||
};
|
||||
```
|
||||
|
||||
"debug" and "trace" log more than that, including DNS. Follow it with
|
||||
`proxy-ctl logs proxy-suite-socks`.
|
||||
|
||||
## DNS of per-app routes
|
||||
|
||||
Apps run through per-app TUN or TProxy have their lookups sent on into the route. To see
|
||||
each lookup, its answer and how long it took, and the ones that got no answer:
|
||||
|
||||
```nix
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||
};
|
||||
perAppRouting = {
|
||||
enable = true;
|
||||
tproxy.enable = true;
|
||||
};
|
||||
debug.perAppDns = true;
|
||||
};
|
||||
```
|
||||
|
||||
```sh
|
||||
proxy-ctl logs proxy-suite-per-app-tproxy-dns
|
||||
```
|
||||
|
||||
## Good to know
|
||||
|
||||
- All of these can log every site visited, for anyone who can read the journal. Turn them
|
||||
off when done.
|
||||
- zapret2 has its own: `debug.zapret2.packets` logs every packet nfqws2 handles, and
|
||||
`debug.zapret2.autoHostlist` why sites are or are not learned.
|
||||
|
||||
## See also
|
||||
|
||||
- [`debug`](../options/debug.md): every option
|
||||
- [Control it day to day](./control.md): `proxy-ctl logs` and the rest
|
||||
@@ -20,6 +20,7 @@ examples follow below.
|
||||
| [Group outbounds and fail over](./groups.md) | Several exits for one job, moving off one that stops working |
|
||||
| [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 |
|
||||
| [Track down a problem](./debug.md) | Something fails now and then, and you want to see why |
|
||||
|
||||
## Complete examples
|
||||
|
||||
|
||||
Reference in new issue
Block a user