fix: bug fixes
This commit is contained in:
31 files changed
+626
-121
No files matched your search
@@ -117,12 +117,12 @@ in
|
||||
)
|
||||
# "singBox": a tunnel unit behind a loopback SOCKS hop, fed the prepared profile.
|
||||
(
|
||||
assert hasInfix ''"server":"127.0.0.1","server_port":18542,"tag":"plain","type":"socks"''
|
||||
assert hasInfix ''"server":"127.0.0.1","server_port":18602,"tag":"plain","type":"socks"''
|
||||
singBoxStart;
|
||||
assert hasInfix "_proxy_suite_record_tag_source plain awg" singBoxStart;
|
||||
assert hasInfix "--output \"$profile\"" plainTunnel && !(hasInfix "--outbound-fwmark" plainTunnel);
|
||||
assert hasInfix "warp_outbound.py --tag plain --routing-mark 2" plainTunnel;
|
||||
assert hasInfix "listen_port: 18542" plainTunnel;
|
||||
assert hasInfix "listen_port: 18602" plainTunnel;
|
||||
assert hasInfix ''detour: "plain"'' plainTunnel;
|
||||
assert !(services ? proxy-suite-awg-plain-watchdog);
|
||||
true
|
||||
|
||||
@@ -568,6 +568,13 @@ let
|
||||
(assert !builtins.elem "proxy-suite-socks.service" (service exitFixture).after; true)
|
||||
# Not `requires`: direct-routed listeners keep serving if the client is down.
|
||||
(assert (service relayFixture).requires == [ ]; true)
|
||||
# A stop collects what XRay counted since the last timer run.
|
||||
(
|
||||
assert
|
||||
(service relayFixture).serviceConfig.ExecStop
|
||||
== relayFixture.config.systemd.services."proxy-suite-inbound-stats".serviceConfig.ExecStart;
|
||||
true
|
||||
)
|
||||
|
||||
# The collected stats are group-readable with userControl, root-only without.
|
||||
(
|
||||
|
||||
@@ -588,6 +588,41 @@
|
||||
touch "$out"
|
||||
'';
|
||||
|
||||
# A probe that exits 0 printing nothing: jq reads "" as no input at all, so the
|
||||
# "error" guard downstream saw "" instead of "error" and let it through to
|
||||
# `--argjson r ""`, which failed every autoProxy run until the state changed.
|
||||
# The helper is taken from the module, so it is the code the runner really uses.
|
||||
autoproxy-probe-json =
|
||||
pkgs.runCommand "proxy-suite-autoproxy-probe-json-check"
|
||||
{
|
||||
nativeBuildInputs = [
|
||||
pkgs.jq
|
||||
pkgs.gnused
|
||||
pkgs.coreutils
|
||||
];
|
||||
}
|
||||
''
|
||||
sed -n '/^ probe_json() {$/,/^ }$/p' ${../../modules/proxy-suite/autoproxy.nix} > helper.sh
|
||||
test -s helper.sh
|
||||
|
||||
mkdir -p stub
|
||||
printf '%s\n' '#!/bin/sh' 'exit 0' > stub/proxy-ctl
|
||||
chmod +x stub/proxy-ctl
|
||||
export PATH="$PWD/stub:$PATH"
|
||||
|
||||
set -euo pipefail
|
||||
. ./helper.sh
|
||||
# $out is the derivation's; the helper's own "out" is local to it.
|
||||
res=$(probe_json --exits direct example.test)
|
||||
test "$res" = '{}'
|
||||
# What the callers ask, and what used to come back empty.
|
||||
test "$(jq -r '.verdict // "error"' <<<"$res")" = error
|
||||
# And an update() built from it still runs.
|
||||
jq -e -n --argjson r "$res" '$r == {}' > /dev/null
|
||||
|
||||
touch "$out"
|
||||
'';
|
||||
|
||||
# Per-user inbound traffic collection; `proxy-ctl inbounds stats` is in proxy-ctl-unit.
|
||||
inbound-stats =
|
||||
pkgs.runCommand "proxy-suite-inbound-stats-check"
|
||||
|
||||
@@ -130,6 +130,8 @@ in
|
||||
reloadSvc = routeModeFixture.config.systemd.services."proxy-suite-outbound-reload";
|
||||
in
|
||||
assert pinSvc.serviceConfig.RemainAfterExit == false;
|
||||
# proxy-ctl escapes the tag into the instance name; the script needs it back.
|
||||
assert pkgs.lib.hasSuffix " %I" pinSvc.serviceConfig.ExecStart;
|
||||
assert
|
||||
routeModeFixture.config.systemd.services."proxy-suite-outbound-unpin".serviceConfig.ExecStart
|
||||
== "${routeModeControlScripts.pinOutboundScript}";
|
||||
|
||||
Reference in new issue
Block a user