feat: debug options
This commit is contained in:
33 files changed
+965
-77
No files matched your search
@@ -41,6 +41,33 @@ let
|
||||
cfg = perAppRoutingTproxyFixture.config.services.proxy-suite;
|
||||
}).perAppTproxyRulesFile;
|
||||
|
||||
debugFixture = evalProxySuite [
|
||||
baseModule
|
||||
{
|
||||
services.proxy-suite = {
|
||||
proxy.tun.enable = true;
|
||||
perAppRouting = {
|
||||
enable = true;
|
||||
tproxy.enable = true;
|
||||
tun.enable = true;
|
||||
};
|
||||
debug = {
|
||||
logLevel = "trace";
|
||||
perAppDns = true;
|
||||
connectionLog = {
|
||||
enable = true;
|
||||
hosts = [ "twimg.com" ];
|
||||
inbounds = [ "tproxy" ];
|
||||
stallAfter = 3;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
debugServices = debugFixture.config.systemd.services;
|
||||
dnsExecStart =
|
||||
fixture: fixture.config.systemd.services.proxy-suite-per-app-tproxy-dns.serviceConfig.ExecStart;
|
||||
|
||||
keepRunningFixture = evalProxySuite [
|
||||
baseModule
|
||||
{
|
||||
@@ -238,5 +265,48 @@ in
|
||||
assert pkgs.lib.hasInfix "rule del fwmark 17 table 102" perAppRoutingTproxyStopScript;
|
||||
true
|
||||
)
|
||||
|
||||
# -- debug: the forwarder logs lookups, the recorder runs, XRay follows the level --
|
||||
(
|
||||
assert pkgs.lib.hasInfix " --log " (dnsExecStart debugFixture);
|
||||
assert !pkgs.lib.hasInfix "--log" (dnsExecStart perAppRoutingTproxyFixture);
|
||||
assert !(perAppRoutingTproxyFixture.config.systemd.services ? proxy-suite-connection-log);
|
||||
assert pkgs.lib.hasInfix "/bin/proxy-ctl debug conns --backend socks --stall 3 --interval "
|
||||
debugServices.proxy-suite-connection-log.serviceConfig.ExecStart;
|
||||
assert pkgs.lib.hasSuffix " --host twimg.com --inbound tproxy"
|
||||
debugServices.proxy-suite-connection-log.serviceConfig.ExecStart;
|
||||
# One per sing-box instance, up with it, never keeping it up.
|
||||
assert builtins.all
|
||||
(
|
||||
{ name, backend }:
|
||||
let
|
||||
unit = debugServices."proxy-suite-connection-log${name}";
|
||||
service = "proxy-suite-${backend}.service";
|
||||
in
|
||||
pkgs.lib.hasInfix " --backend ${backend} " unit.serviceConfig.ExecStart
|
||||
&& unit.partOf == [ service ]
|
||||
&& unit.wantedBy == [ service ]
|
||||
&& unit.bindsTo or [ ] == [ ]
|
||||
)
|
||||
[
|
||||
{
|
||||
name = "";
|
||||
backend = "socks";
|
||||
}
|
||||
{
|
||||
name = "-tun";
|
||||
backend = "tun";
|
||||
}
|
||||
{
|
||||
name = "-per-app-tun";
|
||||
backend = "per-app-tun";
|
||||
}
|
||||
];
|
||||
# XRay has no "trace".
|
||||
assert pkgs.lib.hasInfix "\nXRAY_LOGLEVEL=debug\n" (
|
||||
generated.readDerivation debugServices.proxy-suite-socks.serviceConfig.ExecStart
|
||||
);
|
||||
true
|
||||
)
|
||||
];
|
||||
}
|
||||
@@ -32,7 +32,6 @@ let
|
||||
listener.port = 2443;
|
||||
listener.address = "0.0.0.0";
|
||||
secretFile = "/run/secrets/tg-ws-proxy";
|
||||
log.verbose = true;
|
||||
log.file = "/var/log/tg-ws-proxy.log";
|
||||
log.maxSizeMiB = 2.5;
|
||||
log.keep = 3;
|
||||
@@ -47,6 +46,7 @@ let
|
||||
fakeTlsDomain = "mask.example.com";
|
||||
proxyProtocol = true;
|
||||
};
|
||||
services.proxy-suite.debug.tgWsProxy = true;
|
||||
}
|
||||
];
|
||||
tgAllOptionsStartScript = unitScript tgAllOptions "proxy-suite-tg-ws-proxy";
|
||||
|
||||
@@ -4,17 +4,22 @@
|
||||
}:
|
||||
|
||||
let
|
||||
mkZapret2 =
|
||||
zapret:
|
||||
# `extra`: more of services.proxy-suite, beside zapret.
|
||||
mkZapret2With =
|
||||
extra: zapret:
|
||||
evalProxySuite [
|
||||
baseModule
|
||||
{
|
||||
services.proxy-suite.zapret = {
|
||||
engine = "zapret2";
|
||||
services.proxy-suite = {
|
||||
zapret = {
|
||||
engine = "zapret2";
|
||||
}
|
||||
// zapret;
|
||||
}
|
||||
// zapret;
|
||||
// extra;
|
||||
}
|
||||
];
|
||||
mkZapret2 = mkZapret2With { };
|
||||
in
|
||||
{
|
||||
zapretDiscordYoutubeGlobal = evalProxySuite [
|
||||
@@ -40,7 +45,7 @@ in
|
||||
}
|
||||
];
|
||||
|
||||
zapret2Tuned = mkZapret2 {
|
||||
zapret2Tuned = mkZapret2With { debug.zapret2.autoHostlist = true; } {
|
||||
enable = true;
|
||||
zapret2 = {
|
||||
domains = [ "pinned.example" ];
|
||||
@@ -56,7 +61,6 @@ in
|
||||
failThreshold = 5;
|
||||
failTime = 120;
|
||||
retransThreshold = 4;
|
||||
debugLog = true;
|
||||
extendedDetection = false;
|
||||
};
|
||||
};
|
||||
@@ -78,6 +82,7 @@ in
|
||||
strategySource = "z2k";
|
||||
ports.extraTcp = [ 8444 ];
|
||||
strategyLog = false;
|
||||
# The old name of debug.zapret2.packets: the alias must still reach nfqws2.
|
||||
debug = true;
|
||||
autoHostlist.extendedDetection = false;
|
||||
};
|
||||
|
||||
@@ -119,6 +119,10 @@ import ./options-doc/render-options-markdown.nix {
|
||||
name = "tools";
|
||||
summary = "Heavy helpers `proxy-ctl` can do without: lnav and curl-impersonate.";
|
||||
}
|
||||
{
|
||||
name = "debug";
|
||||
summary = "Troubleshooting: backend log levels, a connection recorder, DNS and zapret2 logs.";
|
||||
}
|
||||
];
|
||||
defaultConfigText = lib.generators.toPretty { allowPrettyValues = true; } (
|
||||
visibleConfig eval.options.services.proxy-suite eval.config.services.proxy-suite
|
||||
|
||||
Reference in new issue
Block a user