refactor: remove duplication

This commit is contained in:
FUFSoB committed 2026-09-18 21:39:18 +05:00
1 parent f7036f6075
commit 8a4ba2db6a
109 files changed
+2206 -3078

No files matched your search

+12 -15
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
mkBadProxySuiteFixture,
@@ -9,6 +10,7 @@
}:
let
inherit (checkLib) mkProxySuite;
generated = import ./read-generated.nix;
inherit (pkgs.lib) hasInfix;
@@ -57,21 +59,16 @@ let
plainTunnel = generated.readDerivation services.proxy-suite-awg-plain.serviceConfig.ExecStart;
dnsServer = dnsServerByTag (mkTProxyConfig singBox) "awg-dns-de";
warpInterface = evalProxySuite [
{
system.stateVersion = "26.05";
services.proxy-suite = {
enable = true;
proxy.enable = true;
amneziaWg.enable = true;
warp = {
enable = true;
configFile = "/run/secrets/wgcf-profile.conf";
asOutbound = "interface";
};
};
}
];
warpInterface = mkProxySuite {
enable = true;
proxy.enable = true;
amneziaWg.enable = true;
warp = {
enable = true;
configFile = "/run/secrets/wgcf-profile.conf";
asOutbound = "interface";
};
};
in
{
assertions = [
+28 -33
View File
@@ -1,25 +1,23 @@
{
checkLib,
pkgs,
evalProxySuite,
mkBadProxySuiteFixture,
mkFailingAssertions,
rejectsProxySuite,
mkProxyCtlDerived,
}:
let
inherit (checkLib) mkProxySuite;
generated = import ./read-generated.nix;
defaultPackages = evalProxySuite [
{
system.stateVersion = "26.05";
services.proxy-suite = {
enable = true;
amneziaWg = {
enable = true;
profiles.home.configFile = "/run/secrets/awg.conf";
};
};
}
];
defaultPackages = mkProxySuite {
enable = true;
amneziaWg = {
enable = true;
profiles.home.configFile = "/run/secrets/awg.conf";
};
};
awgOnly = evalProxySuite [
{
system.stateVersion = "26.05";
@@ -108,21 +106,16 @@ let
fakeKernelModule = pkgs.runCommand "fake-amneziawg-module" { } ''
mkdir -p "$out/lib/modules"
'';
overrideFixture = evalProxySuite [
{
system.stateVersion = "26.05";
services.proxy-suite = {
enable = true;
amneziaWg = {
enable = true;
toolsPackage = fakeTools;
userspacePackage = fakeUserspace;
kernelModulePackage = fakeKernelModule;
profiles.home.configFile = "/run/secrets/client.conf";
};
};
}
];
overrideFixture = mkProxySuite {
enable = true;
amneziaWg = {
enable = true;
toolsPackage = fakeTools;
userspacePackage = fakeUserspace;
kernelModulePackage = fakeKernelModule;
profiles.home.configFile = "/run/secrets/client.conf";
};
};
withGlobalTun = evalProxySuite [
{
@@ -340,7 +333,11 @@ in
};
};
}
{
]
# An AmneziaWG profile and a global proxy mode both autostarting. Message-matched: with
# `proxy.tun.autostart` (removed) this case used to fail on the option name instead.
++ [
(rejectsProxySuite "at most one AmneziaWG, TUN, or TProxy global mode may autostart" {
enable = true;
proxy = {
enable = true;
@@ -351,10 +348,8 @@ in
url = "http://proxy.example.com:8080";
}
];
tun = {
enable = true;
autostart = true;
};
tun.enable = true;
autostart = "tun";
};
amneziaWg = {
enable = true;
@@ -364,6 +359,6 @@ in
configFile = "/run/home.conf";
};
};
}
})
];
}
+2 -4
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
baseModule,
@@ -9,11 +10,8 @@
}:
let
inherit (checkLib) startScript;
generated = import ./read-generated.nix;
startScript =
fixture:
generated.readDerivation
fixture.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart;
chained = evalProxySuite [
baseModule
+4
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
baseModule,
@@ -12,6 +13,7 @@
let
fixtures = import ./core-proxy/fixtures.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -40,6 +42,7 @@ let
;
routingDnsChecks = import ./core-proxy/routing-dns.nix {
inherit checkLib;
inherit
hasRuleSet
dnsHasRuleSet
@@ -57,6 +60,7 @@ let
;
};
serviceDefaultChecks = import ./core-proxy/service-defaults.nix {
inherit checkLib;
inherit
pkgs
minimal
+4 -6
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
baseModule,
@@ -8,6 +9,7 @@
}:
let
inherit (checkLib) startScript;
generated = import ../read-generated.nix;
customSingBoxPackage = pkgs.writeShellScriptBin "sing-box" ''
@@ -20,9 +22,7 @@ let
}
];
customSingBoxPackageBin = "${builtins.unsafeDiscardStringContext (toString customSingBoxPackage)}/bin/sing-box";
customSingBoxPackageStartScript = generated.readDerivation (
customSingBoxPackageFixture.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
customSingBoxPackageStartScript = startScript customSingBoxPackageFixture;
routingOrFixture = evalProxySuite [
{
@@ -125,9 +125,7 @@ let
};
}
];
urlTestCustomStartScript = generated.readDerivation (
urlTestCustomFixture.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
urlTestCustomStartScript = startScript urlTestCustomFixture;
noProxyBackendDefaultFixture = evalProxySuite [
{
+17 -52
View File
@@ -1,4 +1,5 @@
{
checkLib,
hasRuleSet,
dnsHasRuleSet,
dnsServerByTag,
@@ -14,25 +15,16 @@
routingOrGeoIPRules,
}:
let
inherit (checkLib) ok;
in
{
assertions = [
# -- routing rule entries with domains and geoips preserve both matchers, and the named outbound --
(
assert builtins.length routingOrDomainRules == 1;
true
)
(
assert builtins.length routingOrGeoIPRules == 1;
true
)
(
assert (builtins.head routingOrDomainRules).outbound == "primary";
true
)
(
assert (builtins.head routingOrGeoIPRules).outbound == "primary";
true
)
(ok (builtins.length routingOrDomainRules == 1))
(ok (builtins.length routingOrGeoIPRules == 1))
(ok ((builtins.head routingOrDomainRules).outbound == "primary"))
(ok ((builtins.head routingOrGeoIPRules).outbound == "primary"))
# -- default RU direct route and DNS rules are generated --
(
@@ -50,34 +42,13 @@
assert remoteDns.detour == "proxy";
true
)
(
assert hasRuleSet ruDefaultRules "direct" "geosite-category-ru";
true
)
(
assert hasRuleSet ruDefaultRules "direct" "geoip-ru";
true
)
(
assert dnsHasRuleSet ruDefaultConfig.dns.rules "geosite-category-ru";
true
)
(
assert !(hasRuleSet ruDisabledRules "direct" "geosite-category-ru");
true
)
(
assert !(hasRuleSet ruDisabledRules "direct" "geoip-ru");
true
)
(
assert !(dnsHasRuleSet ruDisabledConfig.dns.rules "geosite-category-ru");
true
)
(
assert dnsHasRuleSet ruExplicitConfig.dns.rules "geosite-category-ru";
true
)
(ok (hasRuleSet ruDefaultRules "direct" "geosite-category-ru"))
(ok (hasRuleSet ruDefaultRules "direct" "geoip-ru"))
(ok (dnsHasRuleSet ruDefaultConfig.dns.rules "geosite-category-ru"))
(ok (!(hasRuleSet ruDisabledRules "direct" "geosite-category-ru")))
(ok (!(hasRuleSet ruDisabledRules "direct" "geoip-ru")))
(ok (!(dnsHasRuleSet ruDisabledConfig.dns.rules "geosite-category-ru")))
(ok (dnsHasRuleSet ruExplicitConfig.dns.rules "geosite-category-ru"))
# -- DNS overrides map to sing-box server entries --
(
@@ -102,13 +73,7 @@
)
# -- block route geosite and geoip sets are emitted --
(
assert hasRuleSet blockGeoRules "block" "geosite-category-ads-all";
true
)
(
assert hasRuleSet blockGeoRules "block" "geoip-cn";
true
)
(ok (hasRuleSet blockGeoRules "block" "geosite-category-ads-all"))
(ok (hasRuleSet blockGeoRules "block" "geoip-cn"))
];
}
+8 -16
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
minimal,
customSingBoxPackageBin,
@@ -9,27 +10,18 @@
noProxyBackendDefaultFixture,
}:
let
inherit (checkLib) ok;
in
{
assertions = [
# -- sing-box package override propagates into generated service scripts --
(
assert pkgs.lib.hasInfix customSingBoxPackageBin customSingBoxPackageStartScript;
true
)
(ok (pkgs.lib.hasInfix customSingBoxPackageBin customSingBoxPackageStartScript))
# -- proxy defaults and urltest settings are applied --
(
assert proxyDirectConfig.dns.final == "local";
true
)
(
assert ruDefaultConfig.dns.final == "remote";
true
)
(
assert ruDefaultConfig.route.default_domain_resolver == "local";
true
)
(ok (proxyDirectConfig.dns.final == "local"))
(ok (ruDefaultConfig.dns.final == "remote"))
(ok (ruDefaultConfig.route.default_domain_resolver == "local"))
(
assert builtins.match ".*telegram\\.org.*" urlTestCustomStartScript != null;
assert builtins.match ".*1m.*" urlTestCustomStartScript != null;
+5 -12
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
baseModule,
@@ -12,6 +13,7 @@
}:
let
inherit (checkLib) ok;
fixtures = import ./global-proxy-modes/fixtures.nix {
inherit
evalProxySuite
@@ -49,10 +51,7 @@ let
in
{
assertions = [
(
assert tproxyWithFirewall.config.networking.firewall.enable;
true
)
(ok (tproxyWithFirewall.config.networking.firewall.enable))
(
assert tproxyManualFixture.config.services.proxy-suite.proxy.autostart == null;
assert tproxyManualFixture.config.systemd.services."proxy-suite-tproxy".wantedBy == [ ];
@@ -140,10 +139,7 @@ in
assert tunDefaultConfig.route.auto_detect_interface == true;
true
)
(
assert tunManualFixture.config.networking.nftables.enable;
true
)
(ok (tunManualFixture.config.networking.nftables.enable))
(
assert tunServiceConfig.ExecStartPre == tunServiceConfig.ExecStopPost;
assert pkgs.lib.hasInfix "delete table inet sing-box" tunCleanupScript;
@@ -169,10 +165,7 @@ in
assert !(localDns ? detour);
true
)
(
assert tunDefaultConfig.route.default_domain_resolver == "local";
true
)
(ok (tunDefaultConfig.route.default_domain_resolver == "local"))
(
assert builtins.elem "network-online.target"
tunManualFixture.config.systemd.services."proxy-suite-tun".after;
+2
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
mkTProxyConfig,
@@ -9,6 +10,7 @@
let
fixtures = import ./hybrid-backend/fixtures.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
+8 -18
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
mkTProxyConfig,
@@ -7,6 +8,7 @@
}:
let
inherit (checkLib) startScript unitScript;
generated = import ../read-generated.nix;
hybridModule = {
@@ -36,15 +38,9 @@ let
hybridFixture = evalProxySuite [ hybridModule ];
hybridTproxyConfig = mkTProxyConfig hybridFixture;
hybridTunConfig = mkTunConfig hybridFixture;
hybridStartScript = generated.readDerivation (
hybridFixture.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
hybridTunStartScript = generated.readDerivation (
hybridFixture.config.systemd.services."proxy-suite-tun".serviceConfig.ExecStart
);
hybridPerAppTunStartScript = generated.readDerivation (
hybridFixture.config.systemd.services."proxy-suite-per-app-tun".serviceConfig.ExecStart
);
hybridStartScript = startScript hybridFixture;
hybridTunStartScript = unitScript hybridFixture "proxy-suite-tun";
hybridPerAppTunStartScript = unitScript hybridFixture "proxy-suite-per-app-tun";
hybridBackendJqFilter =
import ../../../modules/proxy-suite/service/script-blocks/backend-jq-filter.nix
{
@@ -75,9 +71,7 @@ let
};
}
];
hybridXrayRawStartScript = generated.readDerivation (
hybridXrayRawFixture.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
hybridXrayRawStartScript = startScript hybridXrayRawFixture;
hybridSubscriptionFixture = evalProxySuite [
{
@@ -98,12 +92,8 @@ let
};
}
];
hybridSubscriptionStartScript = generated.readDerivation (
hybridSubscriptionFixture.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
hybridSubscriptionUpdateScript = generated.readDerivation (
hybridSubscriptionFixture.config.systemd.services."proxy-suite-subscription-update".serviceConfig.ExecStart
);
hybridSubscriptionStartScript = startScript hybridSubscriptionFixture;
hybridSubscriptionUpdateScript = unitScript hybridSubscriptionFixture "proxy-suite-subscription-update";
in
{
inherit
+79 -71
View File
@@ -17,85 +17,54 @@ let
};
forceEval = value: builtins.tryEval (builtins.deepSeq value true);
rg = "${pkgs.ripgrep}/bin/rg";
mkRouting =
# The module's own wiring, so a check sees exactly what a running system generates.
mkAssembly =
fixture:
let
cfg = fixture.config.services.proxy-suite;
in
import ../../modules/proxy-suite/rules.nix {
import ../../modules/proxy-suite/assembly.nix {
lib = pkgs.lib;
inherit pkgs cfg zapret;
inherit pkgs zapret;
cfg = fixture.config.services.proxy-suite;
packages = import ../../pkgs/default.nix { inherit pkgs; };
};
mkRouting = fixture: (mkAssembly fixture).rules;
mkRoutingRules = fixture: (mkRouting fixture).routingRules;
mkRouteModeRules = fixture: (mkRouting fixture).routeModeRules;
mkProxyConfig =
fixture: configAttr:
let
cfg = fixture.config.services.proxy-suite;
rules = mkRouting fixture;
configs = import ../../modules/proxy-suite/config.nix {
lib = pkgs.lib;
inherit pkgs cfg rules;
};
in
builtins.fromJSON (
builtins.unsafeDiscardStringContext (generated.readDerivation configs.${configAttr})
builtins.unsafeDiscardStringContext (
generated.readDerivation (mkAssembly fixture).configs.${configAttr}
)
);
mkTProxyConfig = fixture: mkProxyConfig fixture "tproxyFile";
mkTunConfig = fixture: mkProxyConfig fixture "tunFile";
mkPerAppTunConfig = fixture: mkProxyConfig fixture "perAppTunFile";
mkInboundsConfig = fixture: mkProxyConfig fixture "proxyInboundsFile";
mkInboundsSpec = fixture: mkProxyConfig fixture "proxyInboundsSpecFile";
mkTProxyNftRules =
fixture:
let
cfg = fixture.config.services.proxy-suite;
nftr = import ../../modules/proxy-suite/nftables.nix {
lib = pkgs.lib;
inherit pkgs cfg;
};
in
generated.readDerivation nftr.nftablesRulesFile;
mkPerAppZapretNftRules =
fixture:
let
cfg = fixture.config.services.proxy-suite;
nftr = import ../../modules/proxy-suite/nftables.nix {
lib = pkgs.lib;
inherit pkgs cfg;
};
in
generated.readDerivation nftr.perAppZapretRulesFile;
mkPerAppUserRules =
fixture:
let
cfg = fixture.config.services.proxy-suite;
derived = import ../../modules/proxy-suite/derived.nix {
lib = pkgs.lib;
inherit cfg;
};
nftr = import ../../modules/proxy-suite/nftables.nix {
lib = pkgs.lib;
inherit pkgs cfg;
};
in
import ../../modules/proxy-suite/service/per-app-routing/user-rules.nix {
lib = pkgs.lib;
inherit pkgs;
inherit (derived)
perAppRoutingTun
perAppRoutingTproxy
perAppZapretCfg
;
perAppTunSliceName = "proxy-suite-per-app-tun.slice";
perAppTproxySliceName = "proxy-suite-per-app-tproxy.slice";
perAppZapretSliceName = "proxy-suite-per-app-zapret.slice";
inherit (nftr) nft;
awk = "${pkgs.gawk}/bin/awk";
grepBin = "${pkgs.gnugrep}/bin/grep";
findBin = "${pkgs.findutils}/bin/find";
headBin = "${pkgs.coreutils}/bin/head";
};
mkNftRules = fixture: attr: generated.readDerivation (mkAssembly fixture).nftr.${attr};
mkTProxyNftRules = fixture: mkNftRules fixture "nftablesRulesFile";
mkPerAppZapretNftRules = fixture: mkNftRules fixture "perAppZapretRulesFile";
mkPerAppUserRules = fixture: (mkAssembly fixture).context.perAppRouting;
# One assertion as a list element: `ok (x == y)` where the check lists want a true.
ok =
condition:
assert condition;
true;
# A fixture from nothing but proxy-suite settings, the shape most checks want.
mkProxySuite =
proxySuiteConfig:
evalProxySuite [
{
system.stateVersion = "26.05";
services.proxy-suite = proxySuiteConfig;
}
];
# The text of the program a unit starts, without import-from-derivation.
unitScript =
fixture: unit:
generated.readDerivation fixture.config.systemd.services.${unit}.serviceConfig.ExecStart;
# The local proxy's start script, which most checks read their expectations out of.
startScript = fixture: unitScript fixture "proxy-suite-socks";
hasDirectDomain =
rules: domain:
builtins.any (
@@ -143,11 +112,6 @@ let
builtins.head (
builtins.filter (line: pkgs.lib.hasPrefix prefix line) (pkgs.lib.splitString "\n" text)
);
lineContaining =
text: infix:
builtins.head (
builtins.filter (line: pkgs.lib.hasInfix infix line) (pkgs.lib.splitString "\n" text)
);
shellValueByPrefix =
text: prefix:
let
@@ -210,6 +174,42 @@ let
assert (evaluate case).success == false;
true
) cases;
# The messages of the assertions a config fails. Only the failing ones are forced, so an
# unrelated module's lazily-broken message (nixpkgs has some) never gets in the way. A
# fixture that does not evaluate at all reports that instead, so it cannot pass silently.
failedAssertions =
modules:
let
messages = map (a: a.message) (
builtins.filter (a: !a.assertion) (evalProxySuite modules).config.assertions
);
forced = builtins.tryEval (builtins.deepSeq messages messages);
in
if forced.success then forced.value else [ "the fixture does not evaluate" ];
# A bad config must fail *for the stated reason*: without the message, a case that stops
# evaluating for an unrelated reason (a renamed option, say) passes while testing nothing.
# Forcing the assertions rather than a whole system toplevel is also ~30x cheaper.
rejectsRaw =
expected: modules:
let
messages = failedAssertions modules;
in
if builtins.any (message: pkgs.lib.hasInfix expected message) messages then
true
else
throw (
"proxy-suite checks: expected a failure mentioning ${builtins.toJSON expected}, got: "
+ builtins.concatStringsSep " | " messages
);
rejects = expected: modules: rejectsRaw expected ([ baseModule ] ++ modules);
rejectsProxySuite =
expected: proxySuiteConfig:
rejectsRaw expected [
{
system.stateVersion = "26.05";
services.proxy-suite = proxySuiteConfig;
}
];
mkProxyCtlDerived =
fixture:
let
@@ -235,6 +235,7 @@ in
rg
evalProxySuite
forceEval
mkAssembly
mkRouting
mkRoutingRules
mkRouteModeRules
@@ -246,6 +247,10 @@ in
mkTProxyNftRules
mkPerAppZapretNftRules
mkPerAppUserRules
ok
mkProxySuite
unitScript
startScript
hasDirectDomain
hasDirectIP
hasRuleSet
@@ -256,13 +261,16 @@ in
packagePathMatches
packageByPattern
lineByPrefix
lineContaining
shellValueByPrefix
baseModule
mkBadFixture
mkBadFixtureRaw
mkBadProxySuiteFixture
mkFailingAssertions
failedAssertions
rejects
rejectsRaw
rejectsProxySuite
mkProxyCtlDerived
system
nixpkgs
+4 -6
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
baseModule,
@@ -10,6 +11,7 @@
}:
let
inherit (checkLib) startScript;
generated = import ./read-generated.nix;
localProxyAuthFixture = evalProxySuite [
@@ -21,9 +23,7 @@ let
};
}
];
localProxyAuthStartScript = generated.readDerivation (
localProxyAuthFixture.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
localProxyAuthStartScript = startScript localProxyAuthFixture;
localProxyAuthBackendJqFilter =
import ../../modules/proxy-suite/service/script-blocks/backend-jq-filter.nix
{
@@ -57,9 +57,7 @@ let
_localProxyAuthPasswordFile = mkProxyCtlDerived localProxyAuthPasswordFileFixture;
localProxyAuthPasswordFileWrapper = _localProxyAuthPasswordFile.wrapper;
localProxyAuthPasswordFileScript = _localProxyAuthPasswordFile.script;
localProxyAuthPasswordFileStartScript = generated.readDerivation (
localProxyAuthPasswordFileFixture.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
localProxyAuthPasswordFileStartScript = startScript localProxyAuthPasswordFileFixture;
invalidLocalProxyAuthAssertions = mkFailingAssertions mkBadFixture [
# Auth requires both username and a password source.
+23 -6
View File
@@ -5,6 +5,7 @@
let
inherit (checkLib)
ok
mkRouting
evalProxySuite
mkRoutingRules
@@ -25,13 +26,14 @@ let
mkZapretBaseFor
mkZapretBase
packagePathMatches
packageByPattern
shellValueByPrefix
baseModule
mkBadFixture
mkBadFixtureRaw
mkBadProxySuiteFixture
mkFailingAssertions
rejects
rejectsProxySuite
mkProxyCtlDerived
;
@@ -47,6 +49,7 @@ let
minimalSocksService = minimal.config.systemd.services."proxy-suite-socks";
coreProxyChecks = import ./core-proxy.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -62,6 +65,7 @@ let
inherit (coreProxyChecks) ruDefaultConfig;
routeModeChecks = import ./route-mode.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -74,6 +78,7 @@ let
};
subscriptionChecks = import ./subscriptions.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -93,6 +98,7 @@ let
};
localProxyAuthChecks = import ./local-proxy-auth.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -106,6 +112,7 @@ let
};
sshProxyChecks = import ./ssh-proxy.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -117,6 +124,7 @@ let
};
warpChecks = import ./warp.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -126,6 +134,7 @@ let
};
torChecks = import ./tor.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -141,6 +150,7 @@ let
};
proxyInboundsChecks = import ./proxy-inbounds.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -151,6 +161,7 @@ let
};
perAppRoutingChecks = import ./per-app-routing.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -164,6 +175,7 @@ let
mkZapretBaseFor
mkBadFixture
mkFailingAssertions
rejects
minimalProxyCtlScript
;
};
@@ -172,6 +184,7 @@ let
inherit mkBadProxySuiteFixture mkFailingAssertions;
};
chainingDnsChecks = import ./chaining-dns.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -184,7 +197,9 @@ let
};
amneziaWgChecks = import ./amnezia-wg.nix {
inherit checkLib;
inherit
rejectsProxySuite
pkgs
evalProxySuite
mkBadProxySuiteFixture
@@ -194,6 +209,7 @@ let
};
amneziaWgOutboundChecks = import ./amnezia-wg-outbound.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -206,6 +222,7 @@ let
};
globalProxyModeChecks = import ./global-proxy-modes.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -221,6 +238,7 @@ let
};
zapretChecks = import ./zapret.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -246,6 +264,7 @@ let
};
tgWsProxyChecks = import ./tg-ws-proxy.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -262,11 +281,12 @@ let
};
serverModuleChecks = import ./server-module.nix {
inherit pkgs mkInboundsSpec;
inherit checkLib pkgs mkInboundsSpec;
inherit (checkLib) system nixpkgs proxySuiteModule;
};
xrayBackendChecks = import ./xray-backends.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -283,10 +303,7 @@ let
validated = builtins.all (x: x) (
[
(
assert minimal.config.services.proxy-suite.proxy.listener.address == "127.0.0.1";
true
)
(ok (minimal.config.services.proxy-suite.proxy.listener.address == "127.0.0.1"))
]
++ coreProxyChecks.assertions
++ localProxyAuthChecks.assertions
-57
View File
@@ -1,57 +0,0 @@
{ pkgs }:
{
build-outbound-parser =
pkgs.runCommand "build-outbound-parser-check" { nativeBuildInputs = [ pkgs.python3 ]; }
''
export PYTHONDONTWRITEBYTECODE=1
export PYTHONPATH=${../../scripts}:$PYTHONPATH
python ${../../scripts/test-build-outbound.py}
touch "$out"
'';
build-inbound-renderer =
pkgs.runCommand "build-inbound-renderer-check" { nativeBuildInputs = [ pkgs.python3 ]; }
''
export PYTHONDONTWRITEBYTECODE=1
export PYTHONPATH=${../../scripts}:$PYTHONPATH
python ${../../scripts/test-build-inbound.py}
touch "$out"
'';
fetch-subscription-parser =
pkgs.runCommand "fetch-subscription-parser-check" { nativeBuildInputs = [ pkgs.python3 ]; }
''
export PYTHONDONTWRITEBYTECODE=1
export PYTHONPATH=${../../scripts}:$PYTHONPATH
python ${../../scripts/test-fetch-subscription.py}
touch "$out"
'';
warp-outbound-parser =
pkgs.runCommand "warp-outbound-parser-check" { nativeBuildInputs = [ pkgs.python3 ]; }
''
export PYTHONDONTWRITEBYTECODE=1
export PYTHONPATH=${../../scripts}:$PYTHONPATH
python ${../../scripts/test-warp-outbound.py}
touch "$out"
'';
amneziawg-config-parser =
pkgs.runCommand "amneziawg-config-parser-check" { nativeBuildInputs = [ pkgs.python3 ]; }
''
export PYTHONDONTWRITEBYTECODE=1
export PYTHONPATH=${../../scripts}:$PYTHONPATH
python ${../../scripts/test-amneziawg-config.py}
touch "$out"
'';
awg-inbound-state =
pkgs.runCommand "awg-inbound-state-check" { nativeBuildInputs = [ pkgs.python3 ]; }
''
export PYTHONDONTWRITEBYTECODE=1
export PYTHONPATH=${../../scripts}:$PYTHONPATH
python ${../../scripts/test-awg-inbound.py}
touch "$out"
'';
}
+7 -20
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
baseModule,
@@ -7,6 +8,7 @@
}:
let
inherit (checkLib) ok;
generated = import ./read-generated.nix;
perAppRoutingProxychainsFixture = evalProxySuite [
@@ -67,20 +69,14 @@ in
{
assertions = [
# -- perAppRouting: proxychains/direct profile config is accepted --
(
assert perAppRoutingProxychainsFixture.config.services.proxy-suite.perAppRouting.enable;
true
)
(ok (perAppRoutingProxychainsFixture.config.services.proxy-suite.perAppRouting.enable))
(
assert
builtins.length perAppRoutingProxychainsFixture.config.services.proxy-suite.perAppRouting.profiles
== 2;
true
)
(
assert builtins.length perAppRoutingProxychainsProfiles == 2;
true
)
(ok (builtins.length perAppRoutingProxychainsProfiles == 2))
# -- perAppRouting: createDefaultProfiles injects curated proxychains profile --
(
@@ -91,10 +87,7 @@ in
)
# -- perAppRouting: createDefaultProfiles = false injects no curated profiles --
(
assert builtins.length perAppRoutingNoDefaultProfiles == 0;
true
)
(ok (builtins.length perAppRoutingNoDefaultProfiles == 0))
# -- perAppRouting: proxy-ctl script embeds wrap/apps commands --
(
@@ -115,15 +108,9 @@ in
)
# -- proxy-ctl: restart skips services that are not present in zapret-only or tg-only builds --
(
assert pkgs.lib.hasInfix "proxy-suite-tg-ws-proxy" minimalProxyCtlScript;
true
)
(ok (pkgs.lib.hasInfix "proxy-suite-tg-ws-proxy" minimalProxyCtlScript))
# -- perAppRouting: generated proxy-ctl script dispatches through proxychains4 --
(
assert pkgs.lib.hasInfix "export PROXYCHAINS_QUIET_ARG=-q" perAppRoutingProxychainsScript;
true
)
(ok (pkgs.lib.hasInfix "export PROXYCHAINS_QUIET_ARG=-q" perAppRoutingProxychainsScript))
];
}
+3 -4
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
baseModule,
@@ -7,6 +8,7 @@
}:
let
inherit (checkLib) ok;
generated = import ./read-generated.nix;
perAppRoutingTproxyFixture = evalProxySuite [
@@ -51,10 +53,7 @@ in
)
# -- perAppRouting: generated proxy-ctl script dispatches tproxy profiles through systemd slices --
(
assert pkgs.lib.hasInfix "PER_APP_ROUTING_TPROXY_ENABLED" perAppRoutingTproxyScript;
true
)
(ok (pkgs.lib.hasInfix "PER_APP_ROUTING_TPROXY_ENABLED" perAppRoutingTproxyScript))
# -- perAppRouting: app TProxy service and helper units are created --
(
+9 -17
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
baseModule,
@@ -9,6 +10,7 @@
}:
let
inherit (checkLib) ok;
generated = import ./read-generated.nix;
perAppRoutingTunFixture = evalProxySuite [
@@ -79,10 +81,7 @@ in
)
# -- perAppRouting: generated proxy-ctl script dispatches tun profiles through systemd slices --
(
assert pkgs.lib.hasInfix "PER_APP_ROUTING_TUN_ENABLED" perAppRoutingTunScript;
true
)
(ok (pkgs.lib.hasInfix "PER_APP_ROUTING_TUN_ENABLED" perAppRoutingTunScript))
# -- perAppRouting: user mark script installs fwmark + conntrack mark rules --
(
@@ -122,10 +121,7 @@ in
)
# -- perAppRouting: app TUN uses local domain resolver and avoids global auto-routing --
(
assert perAppRoutingTunConfig.route.default_domain_resolver == "local";
true
)
(ok (perAppRoutingTunConfig.route.default_domain_resolver == "local"))
# -- perAppRouting: app TUN does not set outbound routing marks when TProxy is disabled --
(
@@ -165,12 +161,11 @@ in
# -- perAppRouting: wrapped apps' replies to incoming connections skip the mark (and the
# user rule appended after it), so they leave directly --
(
assert pkgs.lib.hasInfix "ct direction reply return" (
(ok (
pkgs.lib.hasInfix "ct direction reply return" (
builtins.head (pkgs.lib.splitString "ct mark 16 meta mark set 16" perAppRoutingTunNftRules)
);
true
)
)
))
# -- perAppRouting: wrapped apps' DNS reaches the app TUN even when the resolver sits on
# a local or reserved address, and their local IPv6 still leaves directly --
@@ -191,9 +186,6 @@ in
)
# -- perAppRouting: app TUN enables nftables --
(
assert perAppRoutingTunFixture.config.networking.nftables.enable;
true
)
(ok (perAppRoutingTunFixture.config.networking.nftables.enable))
];
}
@@ -1,102 +1,102 @@
{
mkBadFixture,
mkFailingAssertions,
}:
# Marks and route tables per-app routing must not share with the global backends. Each case
# names the assertion it expects, so a case that stops evaluating for another reason fails.
{ rejects }:
{
assertions = mkFailingAssertions mkBadFixture [
# app TUN fwmark must not collide with global TProxy proxyMark.
[
{
services.proxy-suite = {
proxy.tproxy.proxyMark = 7;
proxy.tun.perApp = {
enable = true;
fwmark = 7;
};
perAppRouting.enable = true;
};
}
]
# app TProxy fwmark must not collide with global TProxy proxyMark.
[
assertions = [
(rejects "perAppRouting.tun.fwmark must differ from proxy.tproxy.proxyMark" [
{
services.proxy-suite = {
proxy.tproxy = {
enable = true;
proxyMark = 7;
};
perAppRouting = {
enable = true;
tun = {
enable = true;
fwmark = 7;
};
};
};
}
])
(rejects "perAppRouting.tproxy.fwmark must differ from proxy.tproxy.proxyMark" [
{
services.proxy-suite = {
proxy.tproxy = {
enable = true;
proxyMark = 8;
perApp = {
};
perAppRouting = {
enable = true;
tproxy = {
enable = true;
fwmark = 8;
};
};
perAppRouting.enable = true;
};
}
]
# app TUN and TProxy backends must use distinct marks and route tables.
[
])
(rejects "perAppRouting.tun.fwmark and perAppRouting.tproxy.fwmark must differ" [
{
services.proxy-suite = {
proxy.tun.perApp = {
services.proxy-suite.perAppRouting = {
enable = true;
tun = {
enable = true;
fwmark = 11;
};
proxy.tproxy.perApp = {
tproxy = {
enable = true;
fwmark = 11;
};
perAppRouting.enable = true;
};
}
]
[
])
(rejects "perAppRouting.tun.routeTable and perAppRouting.tproxy.routeTable must differ" [
{
services.proxy-suite = {
proxy.tun.perApp = {
services.proxy-suite.perAppRouting = {
enable = true;
tun = {
enable = true;
routeTable = 100;
};
proxy.tproxy.perApp = {
tproxy = {
enable = true;
routeTable = 100;
};
perAppRouting.enable = true;
};
}
]
# per-app zapret marks must not collide with TUN/TProxy marks.
[
])
(rejects "perAppRouting.tun.fwmark and perAppRouting.zapret.filterMark must differ" [
{
services.proxy-suite = {
proxy.tun.perApp = {
services.proxy-suite.perAppRouting = {
enable = true;
tun = {
enable = true;
fwmark = 12;
};
zapret.perApp = {
zapret = {
enable = true;
filterMark = 12;
};
perAppRouting.enable = true;
};
}
]
[
])
(rejects "perAppRouting.tproxy.fwmark and perAppRouting.zapret.filterMark must differ" [
{
services.proxy-suite = {
proxy.tproxy.perApp = {
services.proxy-suite.perAppRouting = {
enable = true;
tproxy = {
enable = true;
fwmark = 13;
};
zapret.perApp = {
zapret = {
enable = true;
filterMark = 13;
};
perAppRouting.enable = true;
};
}
]
])
];
}
+3 -3
View File
@@ -1,15 +1,15 @@
{
checkLib,
mkBadFixture,
mkFailingAssertions,
rejects,
}:
let
profileChecks = import ./per-app-routing-validation-profiles.nix {
inherit mkBadFixture mkFailingAssertions;
};
resourceChecks = import ./per-app-routing-validation-resources.nix {
inherit mkBadFixture mkFailingAssertions;
};
resourceChecks = import ./per-app-routing-validation-resources.nix { inherit rejects; };
in
{
assertions = profileChecks.assertions ++ resourceChecks.assertions;
+4 -8
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
baseModule,
@@ -10,6 +11,7 @@
}:
let
inherit (checkLib) ok;
generated = import ./read-generated.nix;
perAppRoutingZapretFixture = evalProxySuite [
@@ -168,10 +170,7 @@ in
)
# -- perAppRouting: generated proxy-ctl script dispatches zapret profiles through systemd slices --
(
assert pkgs.lib.hasInfix "PER_APP_ROUTING_ZAPRET_ENABLED" perAppRoutingZapretScript;
true
)
(ok (pkgs.lib.hasInfix "PER_APP_ROUTING_ZAPRET_ENABLED" perAppRoutingZapretScript))
# -- perAppRouting: app zapret service and helper units are created --
(
@@ -213,10 +212,7 @@ in
)
# -- perAppRouting: app zapret startup installs nftables backend --
(
assert pkgs.lib.hasInfix "proxy_suite_per_app_zapret_mark" perAppRoutingZapretStartScript;
true
)
(ok (pkgs.lib.hasInfix "proxy_suite_per_app_zapret_mark" perAppRoutingZapretStartScript))
];
+9 -1
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
baseModule,
@@ -11,11 +12,13 @@
mkZapretBaseFor,
mkBadFixture,
mkFailingAssertions,
rejects,
minimalProxyCtlScript,
}:
let
tunChecks = import ./per-app-routing-tun.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -27,6 +30,7 @@ let
;
};
tproxyChecks = import ./per-app-routing-tproxy.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -36,6 +40,7 @@ let
;
};
zapretChecks = import ./per-app-routing-zapret.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -48,9 +53,11 @@ let
;
};
validationChecks = import ./per-app-routing-validation.nix {
inherit mkBadFixture mkFailingAssertions;
inherit checkLib;
inherit mkBadFixture mkFailingAssertions rejects;
};
userControlChecks = import ./user-control.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -58,6 +65,7 @@ let
;
};
proxychainsChecks = import ./per-app-routing-proxychains.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
+63 -237
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
baseModule,
@@ -7,6 +8,7 @@
}:
let
inherit (checkLib) ok;
inherit (pkgs) lib;
realityListener = {
@@ -515,29 +517,14 @@ let
assertions = [
# Listeners are rendered at start time.
(
assert relayConfig.inbounds == [ ];
true
)
(ok (relayConfig.inbounds == [ ]))
# AsIs when relayed through sing-box; IPOnDemand when XRay dials (see the template).
(
assert relayConfig.routing.domainStrategy == "AsIs";
true
)
(
assert exitConfig.routing.domainStrategy == "IPOnDemand";
true
)
(ok (relayConfig.routing.domainStrategy == "AsIs"))
(ok (exitConfig.routing.domainStrategy == "IPOnDemand"))
(
assert hasOutbound relayConfig "proxy";
true
)
(
assert (ruleByTag relayConfig "inbound-final").outboundTag == "proxy";
true
)
(ok (hasOutbound relayConfig "proxy"))
(ok ((ruleByTag relayConfig "inbound-final").outboundTag == "proxy"))
(
assert
(builtins.head (builtins.filter (ob: ob.tag == "proxy") relayConfig.outbounds)).protocol == "socks";
@@ -556,36 +543,15 @@ let
)
# A pure exit node needs no proxy outbound at all.
(
assert !hasOutbound exitConfig "proxy";
true
)
(
assert (ruleByTag exitConfig "inbound-final").outboundTag == "direct";
true
)
(ok (!hasOutbound exitConfig "proxy"))
(ok ((ruleByTag exitConfig "inbound-final").outboundTag == "direct"))
# Safety rules come first.
(
assert builtins.head (ruleTags relayConfig) == "inbound-block-private";
true
)
(
assert (ruleByTag relayConfig "inbound-block-private").outboundTag == "block";
true
)
(
assert (ruleByTag relayConfig "inbound-block-ru-domain").domain == [ "geosite:category-ru" ];
true
)
(
assert (ruleByTag relayConfig "inbound-block-ru-ip").ip == [ "geoip:ru" ];
true
)
(
assert !builtins.elem "inbound-block-private" (ruleTags unguardedConfig);
true
)
(ok (builtins.head (ruleTags relayConfig) == "inbound-block-private"))
(ok ((ruleByTag relayConfig "inbound-block-private").outboundTag == "block"))
(ok ((ruleByTag relayConfig "inbound-block-ru-domain").domain == [ "geosite:category-ru" ]))
(ok ((ruleByTag relayConfig "inbound-block-ru-ip").ip == [ "geoip:ru" ]))
(ok (!builtins.elem "inbound-block-private" (ruleTags unguardedConfig)))
# serverAddress is exempt after blockPrivate, before the country blocks.
(
assert
@@ -596,10 +562,7 @@ let
];
true
)
(
assert (ruleByTag namedConfig "inbound-server-address-direct").domain == [ "full:vpn.example.ru" ];
true
)
(ok ((ruleByTag namedConfig "inbound-server-address-direct").domain == [ "full:vpn.example.ru" ]))
# Names that resolve private are refused where XRay dials them itself.
(
assert
@@ -612,64 +575,25 @@ let
true
)
# Only the listener ports, not every service on this host.
(
assert (ruleByTag namedConfig "inbound-server-address-direct").port == "443";
true
)
(
assert (ruleByTag blockedConfig "inbound-proxy-domain").inboundTag == [ "open" ];
true
)
(
assert (ruleByTag blockedConfig "inbound-server-address-direct").inboundTag == [ "open" ];
true
)
(ok ((ruleByTag namedConfig "inbound-server-address-direct").port == "443"))
(ok ((ruleByTag blockedConfig "inbound-proxy-domain").inboundTag == [ "open" ]))
(ok ((ruleByTag blockedConfig "inbound-server-address-direct").inboundTag == [ "open" ]))
# No address to exempt when it is detected at runtime instead.
(
assert !builtins.elem "inbound-server-address-direct" (ruleTags relayConfig);
true
)
(
assert (ruleByTag ipNamedConfig "inbound-server-address-direct").ip == [ "82.146.44.102" ];
true
)
(
assert !builtins.elem "inbound-block-ru-domain" (ruleTags unguardedConfig);
true
)
(ok (!builtins.elem "inbound-server-address-direct" (ruleTags relayConfig)))
(ok ((ruleByTag ipNamedConfig "inbound-server-address-direct").ip == [ "82.146.44.102" ]))
(ok (!builtins.elem "inbound-block-ru-domain" (ruleTags unguardedConfig)))
# A per-listener via becomes its own rule; listeners on the default do not.
(
assert builtins.elem "inbound-via-local-exit" (ruleTags mixedConfig);
true
)
(
assert !builtins.elem "inbound-via-relayed" (ruleTags mixedConfig);
true
)
(
assert (ruleByTag mixedConfig "inbound-via-local-exit").inboundTag == [ "local-exit" ];
true
)
(
assert (ruleByTag mixedConfig "inbound-via-local-exit").outboundTag == "direct";
true
)
(ok (builtins.elem "inbound-via-local-exit" (ruleTags mixedConfig)))
(ok (!builtins.elem "inbound-via-relayed" (ruleTags mixedConfig)))
(ok ((ruleByTag mixedConfig "inbound-via-local-exit").inboundTag == [ "local-exit" ]))
(ok ((ruleByTag mixedConfig "inbound-via-local-exit").outboundTag == "direct"))
# The pinned listener gets its own rule; the default one rides the final rule.
(
assert (ruleByTag pinnedConfig "inbound-via-through-de").outboundTag == "de-vps";
true
)
(
assert (ruleByTag pinnedConfig "inbound-final").outboundTag == "nl-vps";
true
)
(ok ((ruleByTag pinnedConfig "inbound-via-through-de").outboundTag == "de-vps"))
(ok ((ruleByTag pinnedConfig "inbound-final").outboundTag == "nl-vps"))
# Pinned outbounds are injected at start and need no local proxy.
(
assert !hasOutbound pinnedConfig "proxy";
true
)
(ok (!hasOutbound pinnedConfig "proxy"))
(
assert
outboundTags pinnedConfig == [
@@ -690,46 +614,19 @@ let
)
# The final rule always comes last.
(
assert lib.last (ruleTags relayConfig) == "inbound-final";
true
)
(
assert lib.last (ruleTags mixedConfig) == "inbound-final";
true
)
(ok (lib.last (ruleTags relayConfig) == "inbound-final"))
(ok (lib.last (ruleTags mixedConfig) == "inbound-final"))
# Without zapret running there is nothing to route around it.
(
assert !builtins.elem "inbound-zapret-direct-domain" (ruleTags relayConfig);
true
)
(ok (!builtins.elem "inbound-zapret-direct-domain" (ruleTags relayConfig)))
# The spec carries secret paths, never their contents.
(
assert builtins.length relaySpec.listeners == 1;
true
)
(
assert (builtins.head relaySpec.listeners).tag == "vless-in";
true
)
(
assert (builtins.head relaySpec.listeners).listen == "::";
true
)
(
assert (builtins.head (builtins.head relaySpec.listeners).users).uuidFile == "/run/secrets/uuid";
true
)
(
assert (builtins.head relaySpec.listeners).reality.privateKeyFile == "/run/secrets/reality-key";
true
)
(
assert relaySpec.shareLinks;
true
)
(ok (builtins.length relaySpec.listeners == 1))
(ok ((builtins.head relaySpec.listeners).tag == "vless-in"))
(ok ((builtins.head relaySpec.listeners).listen == "::"))
(ok ((builtins.head (builtins.head relaySpec.listeners).users).uuidFile == "/run/secrets/uuid"))
(ok ((builtins.head relaySpec.listeners).reality.privateKeyFile == "/run/secrets/reality-key"))
(ok (relaySpec.shareLinks))
# Firewall: TCP for every listener, UDP only where the protocol uses it.
(
@@ -748,33 +645,15 @@ let
];
true
)
(
assert wsListener.port == 10002 && wsListener.sharePort == 443;
true
)
(
assert noFirewallFixture.config.networking.firewall.allowedTCPPorts == [ ];
true
)
(ok (wsListener.port == 10002 && wsListener.sharePort == 443))
(ok (noFirewallFixture.config.networking.firewall.allowedTCPPorts == [ ]))
# The unit exists, and only waits on the client stack when it relays.
(
assert (service relayFixture).wantedBy == [ "multi-user.target" ];
true
)
(
assert builtins.elem "proxy-suite-socks.service" (service relayFixture).after;
true
)
(
assert !builtins.elem "proxy-suite-socks.service" (service exitFixture).after;
true
)
(ok ((service relayFixture).wantedBy == [ "multi-user.target" ]))
(ok (builtins.elem "proxy-suite-socks.service" (service relayFixture).after))
(ok (!builtins.elem "proxy-suite-socks.service" (service exitFixture).after))
# Not `requires`: direct-routed listeners keep serving if the client is down.
(
assert (service relayFixture).requires == [ ];
true
)
(ok ((service relayFixture).requires == [ ]))
# A stop collects what XRay counted since the last timer run.
(
assert
@@ -793,44 +672,20 @@ let
)
# AmneziaWG: the spec carries each listener's loopback inbound, in listener order.
(
assert (awgSpecListener "home").amneziaWg.internalPort == 18700;
true
)
(
assert (awgSpecListener "roam").amneziaWg.internalPort == 18701;
true
)
(
assert (awgSpecListener "home").amneziaWg.internalListen == "::";
true
)
(
assert (awgSpecListener "roam").amneziaWg.internalListen == "127.0.0.1";
true
)
(
assert (awgSpecListener "home").amneziaWg.fwmark == 2;
true
)
(
assert (awgSpecListener "home").amneziaWg.interfaceName == "awgi-home";
true
)
(ok ((awgSpecListener "home").amneziaWg.internalPort == 18700))
(ok ((awgSpecListener "roam").amneziaWg.internalPort == 18701))
(ok ((awgSpecListener "home").amneziaWg.internalListen == "::"))
(ok ((awgSpecListener "roam").amneziaWg.internalListen == "127.0.0.1"))
(ok ((awgSpecListener "home").amneziaWg.fwmark == 2))
(ok ((awgSpecListener "home").amneziaWg.interfaceName == "awgi-home"))
(
assert
(awgSpecListener "roam").amneziaWg.stateFile == "/var/lib/proxy-suite/awg-inbounds/roam/state.json";
true
)
(
assert !((awgSpecListener "vless-in") ? amneziaWg);
true
)
(ok (!((awgSpecListener "vless-in") ? amneziaWg)))
# UDP only, and the interfaces past the host firewall.
(
assert awgFixture.config.networking.firewall.allowedTCPPorts == [ 443 ];
true
)
(ok (awgFixture.config.networking.firewall.allowedTCPPorts == [ 443 ]))
(
assert
lib.sort lib.lessThan awgFixture.config.networking.firewall.allowedUDPPorts == [
@@ -844,38 +699,21 @@ let
assert builtins.elem "awgi-roam" awgFixture.config.networking.firewall.trustedInterfaces;
true
)
(
assert lib.hasInfix ''iifname "awgi-home" accept''
awgFixture.config.networking.firewall.extraReversePathFilterRules;
true
)
(ok (
lib.hasInfix ''iifname "awgi-home" accept'' awgFixture.config.networking.firewall.extraReversePathFilterRules
))
# The interfaces come up before XRay renders their links.
(
assert builtins.elem "proxy-suite-inbounds-awg.service" (service awgFixture).after;
true
)
(
assert builtins.elem "proxy-suite-inbounds-awg.service" (service awgFixture).wants;
true
)
(
assert !(relayFixture.config.systemd.services ? "proxy-suite-inbounds-awg");
true
)
(ok (builtins.elem "proxy-suite-inbounds-awg.service" (service awgFixture).after))
(ok (builtins.elem "proxy-suite-inbounds-awg.service" (service awgFixture).wants))
(ok (!(relayFixture.config.systemd.services ? "proxy-suite-inbounds-awg")))
(
assert lib.hasInfix "rule add pref 8990 fwmark 20 table 103" (awgStartScript awgFixture);
assert lib.hasInfix "awg_inbound.py prepare" (awgStartScript awgFixture);
true
)
# IPv6 routing only where a listener has IPv6.
(
assert lib.hasInfix "-6 rule add pref 8990" (awgStartScript awgFixture);
true
)
(
assert !lib.hasInfix "-6 rule add pref 8990" (awgStartScript awgProxyFixture);
true
)
(ok (lib.hasInfix "-6 rule add pref 8990" (awgStartScript awgFixture)))
(ok (!lib.hasInfix "-6 rule add pref 8990" (awgStartScript awgProxyFixture)))
# Transparent sockets only where there is something to divert.
(
assert lib.hasInfix "net_admin" (readInboundsStart awgFixture);
@@ -883,18 +721,9 @@ let
true
)
# Forwarding only for "lan" listeners.
(
assert awgFixture.config.boot.kernel.sysctl."net.ipv4.ip_forward" == 1;
true
)
(
assert awgFixture.config.boot.kernel.sysctl."net.ipv6.conf.all.forwarding" == 1;
true
)
(
assert !(awgProxyFixture.config.services.proxy-suite.internal.sysctl ? "net.ipv4.ip_forward");
true
)
(ok (awgFixture.config.boot.kernel.sysctl."net.ipv4.ip_forward" == 1))
(ok (awgFixture.config.boot.kernel.sysctl."net.ipv6.conf.all.forwarding" == 1))
(ok (!(awgProxyFixture.config.services.proxy-suite.internal.sysctl ? "net.ipv4.ip_forward")))
# "lan" clients reach private networks and each other natively, "proxy" clients nothing but via.
(
let
@@ -914,10 +743,7 @@ let
assert !lib.hasInfix "10.67.0.0/24 oifname" rules;
true
)
(
assert !lib.hasInfix "masquerade" (awgRules awgProxyFixture);
true
)
(ok (!lib.hasInfix "masquerade" (awgRules awgProxyFixture)))
]
++ failing;
+117
View File
@@ -0,0 +1,117 @@
# The Python unit tests, as Nix checks. Every entry is the same runCommand: the test file, the
# interpreter (with the packages it imports) and the env it needs.
{ pkgs }:
let
scripts = ../../scripts;
proxyCtl = ../../pkgs/proxy-ctl;
mkPythonCheck =
name:
{
file,
drv ? name,
python ? pkgs.python3,
env ? { },
extraInputs ? [ ],
buildInputs ? [ ],
}:
pkgs.runCommand "${drv}-check"
{
nativeBuildInputs = [ python ] ++ extraInputs;
inherit buildInputs;
}
''
export PYTHONDONTWRITEBYTECODE=1
${pkgs.lib.concatStringsSep "\n" (
pkgs.lib.mapAttrsToList (variable: value: "export ${variable}=${value}") env
)}
python ${file}
touch "$out"
'';
withPath = path: { PYTHONPATH = "${path}:$PYTHONPATH"; };
singBox = {
SING_BOX = "${pkgs.sing-box}/bin/sing-box";
};
in
pkgs.lib.mapAttrs mkPythonCheck {
# The runtime helpers the module's start scripts call: share-link parsing, inbound and
# AmneziaWG rendering, subscription fetching.
build-outbound-parser = {
file = "${scripts}/test-build-outbound.py";
env = withPath scripts;
};
build-inbound-renderer = {
file = "${scripts}/test-build-inbound.py";
env = withPath scripts;
};
fetch-subscription-parser = {
file = "${scripts}/test-fetch-subscription.py";
env = withPath scripts;
};
warp-outbound-parser = {
file = "${scripts}/test-warp-outbound.py";
env = withPath scripts;
};
amneziawg-config-parser = {
file = "${scripts}/test-amneziawg-config.py";
env = withPath scripts;
};
awg-inbound-state = {
file = "${scripts}/test-awg-inbound.py";
env = withPath scripts;
};
# The NFQWS_OPT rewrites the zapret v1 package build applies.
patch-zapret-config = {
file = "${scripts}/test-patch-zapret-config.py";
env = withPath scripts;
};
# proxy_ctl.py's function-level tests: the probe verdict table and exit walk,
# autoProxy learn/queue, inbound stats and subscriptions, apps run.
proxy-ctl-unit = {
drv = "proxy-suite-proxy-ctl-unit";
file = "${proxyCtl}/test_proxy_ctl.py";
env = singBox;
};
# proxy-suitectl, nix-on-droid's service manager: real processes restarted, timed and stopped.
proxy-suite-supervisor-unit = {
file = "${proxyCtl}/test_proxy_supervisor.py";
env.HOME = "\"$TMPDIR\"";
};
# proxy_export: the running config made portable, and sing-box still accepts it.
proxy-export-unit = {
drv = "proxy-suite-proxy-export-unit";
file = "${proxyCtl}/test_proxy_export.py";
env = singBox // {
PYTHONPATH = "${proxyCtl}";
};
};
# proxy-tui driven headless: keys turn into the right proxy-ctl argv.
proxy-tui-unit = {
drv = "proxy-suite-proxy-tui-unit";
file = "${proxyCtl}/test_proxy_tui.py";
python = pkgs.python3.withPackages (ps: [ ps.textual ]);
env.PYTHONPATH = "${proxyCtl}";
};
# proxy_model: the status strip, tab loads and the tray menu tree, without a UI toolkit.
proxy-model-unit = {
drv = "proxy-suite-proxy-model-unit";
file = "${proxyCtl}/test_proxy_model.py";
env.PYTHONPATH = "${proxyCtl}";
};
# proxy_gui and proxy_sni import against GTK4/libadwaita, the D-Bus interfaces parse, and the
# tray menu serializes to dbusmenu's layout type. No display needed.
proxy-gui-smoke = {
drv = "proxy-suite-proxy-gui-smoke";
file = "${proxyCtl}/test_proxy_gui.py";
python = pkgs.python3.withPackages (ps: [ ps.pygobject3 ]);
extraInputs = [ pkgs.gobject-introspection ];
buildInputs = [
pkgs.gtk4
pkgs.libadwaita
];
env.PYTHONPATH = "${proxyCtl}";
};
}
+18 -91
View File
@@ -8,6 +8,22 @@
controlModuleSource,
}:
let
# Every proxy-ctl CLI check runs against the same disabled-feature defaults; only the
# files and the feature under test differ.
perAppRoutingOff = ''
PER_APP_ROUTING_ENABLED="0" \
PER_APP_ROUTING_PROXYCHAINS_ENABLED="0" \
PER_APP_ROUTING_TUN_ENABLED="0" \
PER_APP_ROUTING_TPROXY_ENABLED="0" \
PER_APP_ROUTING_ZAPRET_ENABLED="0" \
PER_APP_ROUTING_PROFILES_FILE="$PWD/profiles.json" \
PROXYCHAINS_CONFIG="$PWD/proxychains.conf" \
PROXYCHAINS_QUIET_ARG="" \
ROUTE_MODE_STATE_FILE="$PWD/route-mode" \
DEFAULT_ROUTE_MODE="blacklist" \
'';
in
{
no-secrets = pkgs.runCommand "proxy-suite-no-secrets-check" { } ''
repo_root=${../../.}
@@ -65,17 +81,7 @@
SUB_CACHE_DIR="$PWD/cache" \
CLASH_API="http://127.0.0.1:9090" \
SELECTION="first" \
PER_APP_ROUTING_ENABLED="0" \
PER_APP_ROUTING_PROXYCHAINS_ENABLED="0" \
PER_APP_ROUTING_TUN_ENABLED="0" \
PER_APP_ROUTING_TPROXY_ENABLED="0" \
PER_APP_ROUTING_ZAPRET_ENABLED="0" \
PER_APP_ROUTING_PROFILES_FILE="$PWD/profiles.json" \
PROXYCHAINS_CONFIG="$PWD/proxychains.conf" \
PROXYCHAINS_QUIET_ARG="" \
ROUTE_MODE_STATE_FILE="$PWD/route-mode" \
DEFAULT_ROUTE_MODE="blacklist" \
python3 "$proxy_ctl" proxy subs list > output
${perAppRoutingOff} python3 "$proxy_ctl" proxy subs list > output
# The old spelling still dispatches.
env SUB_TAGS_FILE="$PWD/tags.json" SUB_CACHE_DIR="$PWD/cache" \
python3 "$proxy_ctl" subscription list | cmp - output
@@ -137,17 +143,7 @@
USER_CONTROL_GROUP="proxy-suite" \
CLASH_API="http://127.0.0.1:1" \
SELECTION="urltest" \
PER_APP_ROUTING_ENABLED="0" \
PER_APP_ROUTING_PROXYCHAINS_ENABLED="0" \
PER_APP_ROUTING_TUN_ENABLED="0" \
PER_APP_ROUTING_TPROXY_ENABLED="0" \
PER_APP_ROUTING_ZAPRET_ENABLED="0" \
PER_APP_ROUTING_PROFILES_FILE="$PWD/profiles.json" \
PROXYCHAINS_CONFIG="$PWD/proxychains.conf" \
PROXYCHAINS_QUIET_ARG="" \
ROUTE_MODE_STATE_FILE="$PWD/route-mode" \
DEFAULT_ROUTE_MODE="blacklist" \
python3 "$proxy_ctl" "$@"
${perAppRoutingOff} python3 "$proxy_ctl" "$@"
}
# Listing works from the inventory alone, with no Clash API answering.
@@ -453,75 +449,6 @@
touch "$out"
'';
# proxy_ctl.py's function-level tests: the probe verdict table and exit walk,
# autoProxy learn/queue, inbound stats and subscriptions, apps run.
proxy-ctl-unit =
pkgs.runCommand "proxy-suite-proxy-ctl-unit-check" { nativeBuildInputs = [ pkgs.python3 ]; }
''
export SING_BOX=${pkgs.sing-box}/bin/sing-box
export PYTHONDONTWRITEBYTECODE=1
python ${../../pkgs/proxy-ctl}/test_proxy_ctl.py
touch "$out"
'';
# proxy-suitectl, nix-on-droid's service manager: real processes restarted, timed and stopped.
proxy-suite-supervisor-unit =
pkgs.runCommand "proxy-suite-supervisor-unit-check" { nativeBuildInputs = [ pkgs.python3 ]; }
''
export PYTHONDONTWRITEBYTECODE=1 HOME="$TMPDIR"
python ${../../pkgs/proxy-ctl}/test_proxy_supervisor.py
touch "$out"
'';
# proxy_export: the running config made portable, and sing-box still accepts it.
proxy-export-unit =
pkgs.runCommand "proxy-suite-proxy-export-unit-check" { nativeBuildInputs = [ pkgs.python3 ]; }
''
export SING_BOX=${pkgs.sing-box}/bin/sing-box
export PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=${../../pkgs/proxy-ctl}
python ${../../pkgs/proxy-ctl}/test_proxy_export.py
touch "$out"
'';
# proxy-tui driven headless: keys turn into the right proxy-ctl argv.
proxy-tui-unit =
pkgs.runCommand "proxy-suite-proxy-tui-unit-check"
{ nativeBuildInputs = [ (pkgs.python3.withPackages (ps: [ ps.textual ])) ]; }
''
export PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=${../../pkgs/proxy-ctl}
python ${../../pkgs/proxy-ctl}/test_proxy_tui.py
touch "$out"
'';
# proxy_model: the status strip, tab loads and the tray menu tree, without a UI toolkit.
proxy-model-unit =
pkgs.runCommand "proxy-suite-proxy-model-unit-check" { nativeBuildInputs = [ pkgs.python3 ]; }
''
export PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=${../../pkgs/proxy-ctl}
python ${../../pkgs/proxy-ctl}/test_proxy_model.py
touch "$out"
'';
# proxy_gui and proxy_sni import against GTK4/libadwaita, the D-Bus interfaces parse,
# and the tray menu serializes to dbusmenu's layout type. No display needed.
proxy-gui-smoke =
pkgs.runCommand "proxy-suite-proxy-gui-smoke-check"
{
nativeBuildInputs = [
(pkgs.python3.withPackages (ps: [ ps.pygobject3 ]))
pkgs.gobject-introspection
];
buildInputs = [
pkgs.gtk4
pkgs.libadwaita
];
}
''
export PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=${../../pkgs/proxy-ctl}
python ${../../pkgs/proxy-ctl}/test_proxy_gui.py
touch "$out"
'';
# autoProxy slowness routing: sampler and judge.
autoproxy-slowness =
pkgs.runCommand "proxy-suite-autoproxy-slowness-check" { nativeBuildInputs = [ pkgs.jq ]; }
+9 -11
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
baseModule,
@@ -9,6 +10,7 @@
}:
let
inherit (checkLib) ok startScript;
generated = import ./read-generated.nix;
routeModeFixture = evalProxySuite [
@@ -38,9 +40,7 @@ let
};
}
];
routeModeStartScript = generated.readDerivation (
routeModeFixture.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
routeModeStartScript = startScript routeModeFixture;
routeModeBackendJqFilter =
import ../../modules/proxy-suite/service/script-blocks/backend-jq-filter.nix
{
@@ -81,11 +81,9 @@ in
)
# proxy-ctl help/status exposes default plus the explicit route modes.
(
assert pkgs.lib.hasInfix "proxy mode [default|whitelist|blacklist|all-proxy|all-bypass]"
minimalProxyCtlScript;
true
)
(ok (
pkgs.lib.hasInfix "proxy mode [default|whitelist|blacklist|all-proxy|all-bypass]" minimalProxyCtlScript
))
# The socks start script includes every override branch and uses volatile state.
(
@@ -118,9 +116,9 @@ in
in
assert !(setterSvc.serviceConfig ? RuntimeDirectory);
assert pkgs.lib.hasInfix "/run/proxy-suite/route-mode" routeModeSetterScript;
assert pkgs.lib.hasInfix "default)" routeModeSetterScript;
assert pkgs.lib.hasInfix "all-proxy)" routeModeSetterScript;
assert pkgs.lib.hasInfix "all-bypass)" routeModeSetterScript;
# One case arm lists every mode the setter accepts.
assert pkgs.lib.hasInfix "default | whitelist | blacklist | all-proxy | all-bypass)"
routeModeSetterScript;
true
)
+28 -58
View File
@@ -1,6 +1,7 @@
# nixosModules.server as the installer writes it: once for an IP certificate, once for
# a domain.
{
checkLib,
pkgs,
system,
nixpkgs,
@@ -9,6 +10,7 @@
}:
let
inherit (checkLib) ok;
inherit (pkgs) lib;
serverModule = import ../../deploy/server-module.nix { inherit proxySuiteModule; };
@@ -66,14 +68,8 @@ let
in
{
assertions = [
(
assert failedAssertions ipServer == [ ];
true
)
(
assert failedAssertions domainServer == [ ];
true
)
(ok (failedAssertions ipServer == [ ]))
(ok (failedAssertions domainServer == [ ]))
(
assert
@@ -95,14 +91,8 @@ in
(listener ipSpec "vless-tls").tls.certificateFile == "/var/lib/acme/203.0.113.10/fullchain.pem";
true
)
(
assert (listener domainSpec "vless-ws").tls.keyFile == "/var/lib/acme/vpn.example.com/key.pem";
true
)
(
assert (listener ipSpec "vless-ws").transport.path == "/3f9a1c07b2e4";
true
)
(ok ((listener domainSpec "vless-ws").tls.keyFile == "/var/lib/acme/vpn.example.com/key.pem"))
(ok ((listener ipSpec "vless-ws").transport.path == "/3f9a1c07b2e4"))
(
assert
(lib.head (listener ipSpec "vless-tls").users).uuidFile == "/var/lib/proxy-suite-server/uuid";
@@ -110,28 +100,13 @@ in
)
# IP certificates exist only in the short-lived profile.
(
assert ipCert.profile == "shortlived" && domainCert.profile == null;
true
)
(
assert ipCert.group == "proxy-suite-daemon";
true
)
(
assert ipServer.config.services.proxy-suite.inbounds.serverAddress == "203.0.113.10";
true
)
(
assert domainServer.config.services.proxy-suite.inbounds.serverAddress == "vpn.example.com";
true
)
(ok (ipCert.profile == "shortlived" && domainCert.profile == null))
(ok (ipCert.group == "proxy-suite-daemon"))
(ok (ipServer.config.services.proxy-suite.inbounds.serverAddress == "203.0.113.10"))
(ok (domainServer.config.services.proxy-suite.inbounds.serverAddress == "vpn.example.com"))
# A /32 with a gateway outside it only works on-link.
(
assert (uplink ipServer).address == [ "203.0.113.10/32" ];
true
)
(ok ((uplink ipServer).address == [ "203.0.113.10/32" ]))
(
assert
(uplink ipServer).routes == [
@@ -142,31 +117,21 @@ in
];
true
)
(
assert (uplink domainServer).networkConfig.DHCP == "yes" && (uplink domainServer).address == [ ];
true
)
(ok ((uplink domainServer).networkConfig.DHCP == "yes" && (uplink domainServer).address == [ ]))
(
assert lib.all (p: builtins.elem p ipServer.config.networking.firewall.allowedTCPPorts) [
(ok (
lib.all (p: builtins.elem p ipServer.config.networking.firewall.allowedTCPPorts) [
80
443
8443
2053
22
];
true
)
(
assert ipServer.config.services.openssh.settings.PermitRootLogin == "no";
true
)
]
))
(ok (ipServer.config.services.openssh.settings.PermitRootLogin == "no"))
# onion.enable: every listener behind the onion service, and nothing opened for it.
(
assert failedAssertions onionServer == [ ];
true
)
(ok (failedAssertions onionServer == [ ]))
(
assert
lib.sort (a: b: a < b) onionSpec.onionListeners == [
@@ -181,11 +146,9 @@ in
!(ipServer.config.systemd.services ? proxy-suite-tor) && (ipSpec.onionListeners or [ ]) == [ ];
true
)
(
assert builtins.elem "proxy-suite-tor.service"
onionServer.config.systemd.services.proxy-suite-inbounds.after;
true
)
(ok (
builtins.elem "proxy-suite-tor.service" onionServer.config.systemd.services.proxy-suite-inbounds.after
))
(
assert
onionServer.config.networking.firewall.allowedTCPPorts
@@ -198,5 +161,12 @@ in
&& !(lib.hasInfix "--onion" ipServer.config.services.getty.helpLine);
true
)
# The console banner names the server and the admin account, interpolated: an escaped
# ''${...} used to reach the login screen verbatim.
(
assert lib.hasInfix "proxy-suite server 203.0.113.10." ipServer.config.services.getty.helpLine;
assert !(lib.hasInfix "\${" ipServer.config.services.getty.helpLine);
true
)
];
}
+101 -227
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
baseModule,
@@ -8,6 +9,7 @@
}:
let
inherit (checkLib) ok mkProxySuite startScript;
generated = import ./read-generated.nix;
testHostKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
@@ -22,29 +24,22 @@ let
builtins.unsafeDiscardStringContext "${pkgs.writeText "proxy-suite-core" (builtins.toJSON value)}";
# SingBox dials SSH natively: no unit, no local SOCKS listener.
sshNativeSingBox = evalProxySuite [
{
system.stateVersion = "26.05";
services.proxy-suite = {
enable = true;
sshProxy = {
enable = true;
server.user = "root";
server.host = "ssh.example.com";
asOutbound = true;
identityFile = "/run/secrets/ssh-key";
hostKey = [ testHostKey ];
};
proxy = {
enable = true;
backend = "sing-box";
};
};
}
];
sshNativeSingBoxStart = generated.readDerivation (
sshNativeSingBox.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
sshNativeSingBox = mkProxySuite {
enable = true;
sshProxy = {
enable = true;
server.user = "root";
server.host = "ssh.example.com";
asOutbound = true;
identityFile = "/run/secrets/ssh-key";
hostKey = [ testHostKey ];
};
proxy = {
enable = true;
backend = "sing-box";
};
};
sshNativeSingBoxStart = startScript sshNativeSingBox;
expectedNativeSingBoxOutbound = expectedOutboundFile {
type = "ssh";
tag = "ssh-proxy";
@@ -56,29 +51,22 @@ let
};
# hostKeyFile keys are injected at start, not baked into the JSON.
sshHostKeyFile = evalProxySuite [
{
system.stateVersion = "26.05";
services.proxy-suite = {
enable = true;
sshProxy = {
enable = true;
server.user = "root";
server.host = "ssh.example.com";
server.port = 2222;
asOutbound = true;
hostKeyFile = "/run/secrets/ssh-known-hosts";
};
proxy = {
enable = true;
backend = "sing-box";
};
};
}
];
sshHostKeyFileStart = generated.readDerivation (
sshHostKeyFile.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
sshHostKeyFile = mkProxySuite {
enable = true;
sshProxy = {
enable = true;
server.user = "root";
server.host = "ssh.example.com";
server.port = 2222;
asOutbound = true;
hostKeyFile = "/run/secrets/ssh-known-hosts";
};
proxy = {
enable = true;
backend = "sing-box";
};
};
sshHostKeyFileStart = startScript sshHostKeyFile;
# asOutbound = false: a standalone tunnel, so the OpenSSH unit exists even on SingBox.
sshStandalone = evalProxySuite [
@@ -114,38 +102,27 @@ let
];
standaloneService = sshStandalone.config.systemd.services."proxy-suite-ssh-proxy";
standaloneStartScript = generated.readDerivation standaloneService.serviceConfig.ExecStart;
sshStandaloneStart = generated.readDerivation (
sshStandalone.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
sshStandaloneStart = startScript sshStandalone;
unchanged = evalProxySuite [ baseModule ];
unchangedStart = generated.readDerivation (
unchanged.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
unchangedStart = startScript unchanged;
# XRay keeps the unit and proxies through its listener, domainStrategy on sockopt.
sshXray = evalProxySuite [
{
system.stateVersion = "26.05";
services.proxy-suite = {
enable = true;
sshProxy = {
enable = true;
server.user = "proxy";
server.host = "ssh.example.com";
asOutbound = true;
domainStrategy = "prefer_ipv4";
};
proxy = {
enable = true;
backend = "xray";
};
};
}
];
sshXrayStart = generated.readDerivation (
sshXray.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
sshXray = mkProxySuite {
enable = true;
sshProxy = {
enable = true;
server.user = "proxy";
server.host = "ssh.example.com";
asOutbound = true;
domainStrategy = "prefer_ipv4";
};
proxy = {
enable = true;
backend = "xray";
};
};
sshXrayStart = startScript sshXray;
xrayService = sshXray.config.systemd.services."proxy-suite-ssh-proxy";
xrayStartScript = generated.readDerivation xrayService.serviceConfig.ExecStart;
expectedXrayOutbound = expectedOutboundFile {
@@ -161,28 +138,21 @@ let
};
};
sshHybrid = evalProxySuite [
{
system.stateVersion = "26.05";
services.proxy-suite = {
enable = true;
sshProxy = {
enable = true;
server.user = "proxy";
server.host = "ssh.example.com";
asOutbound = true;
hostKey = [ testHostKey ];
};
proxy = {
enable = true;
backend = "hybrid";
};
};
}
];
sshHybridStart = generated.readDerivation (
sshHybrid.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
sshHybrid = mkProxySuite {
enable = true;
sshProxy = {
enable = true;
server.user = "proxy";
server.host = "ssh.example.com";
asOutbound = true;
hostKey = [ testHostKey ];
};
proxy = {
enable = true;
backend = "hybrid";
};
};
sshHybridStart = startScript sshHybrid;
expectedHybridOutbound = expectedOutboundFile {
type = "ssh";
tag = "ssh-proxy";
@@ -219,9 +189,7 @@ let
};
}
];
sshSelectorStart = generated.readDerivation (
sshSelector.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
sshSelectorStart = startScript sshSelector;
sshUrltest = evalProxySuite [
{
@@ -248,9 +216,7 @@ let
};
}
];
sshUrltestStart = generated.readDerivation (
sshUrltest.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
sshUrltestStart = startScript sshUrltest;
sshRouting = evalProxySuite [
{
@@ -339,15 +305,9 @@ let
];
assertions = [
(
assert sshNativeSingBox.config.services.proxy-suite.proxy.outbounds == [ ];
true
)
(ok (sshNativeSingBox.config.services.proxy-suite.proxy.outbounds == [ ]))
# No OpenSSH unit and no ordering against one: sing-box dials SSH in-process.
(
assert !(sshNativeSingBox.config.systemd.services ? "proxy-suite-ssh-proxy");
true
)
(ok (!(sshNativeSingBox.config.systemd.services ? "proxy-suite-ssh-proxy")))
(
assert
sshNativeSingBox.config.systemd.services."proxy-suite-socks".after == [
@@ -372,24 +332,12 @@ let
true
)
# The global local-resolve route rule is gone; the native outbound resolves.
(
assert !(pkgs.lib.hasInfix "\"resolve\"" sshNativeSingBoxStart);
true
)
(ok (!(pkgs.lib.hasInfix "\"resolve\"" sshNativeSingBoxStart)))
# Non-default port has to be looked up as "[host]:port" in known_hosts.
(
assert pkgs.lib.hasInfix "ssh-keygen -F '[ssh.example.com]:2222'" sshHostKeyFileStart;
true
)
(
assert pkgs.lib.hasInfix "'.host_key = \$hk'" sshHostKeyFileStart;
true
)
(
assert pkgs.lib.hasInfix "/run/secrets/ssh-known-hosts" sshHostKeyFileStart;
true
)
(ok (pkgs.lib.hasInfix "ssh-keygen -F '[ssh.example.com]:2222'" sshHostKeyFileStart))
(ok (pkgs.lib.hasInfix "'.host_key = \$hk'" sshHostKeyFileStart))
(ok (pkgs.lib.hasInfix "/run/secrets/ssh-known-hosts" sshHostKeyFileStart))
# The keys must not be baked into the store-resident outbound JSON.
(
assert
@@ -400,56 +348,21 @@ let
)
# Standalone tunnel: unit is created, but nothing is wired as an outbound.
(
assert sshStandalone.config.systemd.services ? "proxy-suite-ssh-proxy";
true
)
(
assert !(pkgs.lib.hasInfix "ssh-proxy" sshStandaloneStart);
true
)
(
assert standaloneService.serviceConfig.User == "proxy";
true
)
(
assert !(standaloneService.serviceConfig ? SocketMark);
true
)
(ok (sshStandalone.config.systemd.services ? "proxy-suite-ssh-proxy"))
(ok (!(pkgs.lib.hasInfix "ssh-proxy" sshStandaloneStart)))
(ok (standaloneService.serviceConfig.User == "proxy"))
(ok (!(standaloneService.serviceConfig ? SocketMark)))
# Hardening: a half-open tunnel must be detected and always restarted.
(
assert standaloneService.serviceConfig.Restart == "always";
true
)
(
assert standaloneService.serviceConfig.LimitNOFILE == 65536;
true
)
(
assert standaloneService.startLimitIntervalSec == 0;
true
)
(
assert pkgs.lib.hasInfix "ServerAliveInterval=15" standaloneStartScript;
true
)
(
assert pkgs.lib.hasInfix "ServerAliveCountMax=3" standaloneStartScript;
true
)
(
assert pkgs.lib.hasInfix "ConnectTimeout=10" standaloneStartScript;
true
)
(
assert pkgs.lib.hasInfix "IPQoS=throughput" standaloneStartScript;
true
)
(
assert pkgs.lib.hasInfix ''UserKnownHostsFile="$CREDENTIALS_DIRECTORY/known_hosts"''
standaloneStartScript;
true
)
(ok (standaloneService.serviceConfig.Restart == "always"))
(ok (standaloneService.serviceConfig.LimitNOFILE == 65536))
(ok (standaloneService.startLimitIntervalSec == 0))
(ok (pkgs.lib.hasInfix "ServerAliveInterval=15" standaloneStartScript))
(ok (pkgs.lib.hasInfix "ServerAliveCountMax=3" standaloneStartScript))
(ok (pkgs.lib.hasInfix "ConnectTimeout=10" standaloneStartScript))
(ok (pkgs.lib.hasInfix "IPQoS=throughput" standaloneStartScript))
(ok (
pkgs.lib.hasInfix ''UserKnownHostsFile="$CREDENTIALS_DIRECTORY/known_hosts"'' standaloneStartScript
))
# Secrets reach the unprivileged user as credentials.
(
assert
@@ -460,20 +373,11 @@ let
true
)
(
assert !(unchanged.config.systemd.services ? "proxy-suite-ssh-proxy");
true
)
(
assert !(pkgs.lib.hasInfix "ssh-proxy" unchangedStart);
true
)
(ok (!(unchanged.config.systemd.services ? "proxy-suite-ssh-proxy")))
(ok (!(pkgs.lib.hasInfix "ssh-proxy" unchangedStart)))
# XRay keeps the unit and orders the backend behind it.
(
assert sshXray.config.systemd.services ? "proxy-suite-ssh-proxy";
true
)
(ok (sshXray.config.systemd.services ? "proxy-suite-ssh-proxy"))
(
assert
sshXray.config.systemd.services."proxy-suite-socks".after == [
@@ -490,50 +394,20 @@ let
];
true
)
(
assert xrayService.serviceConfig.Restart == "always";
true
)
(
assert pkgs.lib.hasInfix "ServerAliveInterval=15" xrayStartScript;
true
)
(ok (xrayService.serviceConfig.Restart == "always"))
(ok (pkgs.lib.hasInfix "ServerAliveInterval=15" xrayStartScript))
# prefer_ipv4 maps onto XRay's "IPv4 first, fall back to IPv6".
(
assert pkgs.lib.hasInfix expectedXrayOutbound sshXrayStart;
true
)
(ok (pkgs.lib.hasInfix expectedXrayOutbound sshXrayStart))
# Hybrid routes the tunnel through sing-box, so it gets the native shape.
(
assert !(sshHybrid.config.systemd.services ? "proxy-suite-ssh-proxy");
true
)
(
assert pkgs.lib.hasInfix "_proxy_suite_add_sing_box_ob" sshHybridStart;
true
)
(
assert pkgs.lib.hasInfix expectedHybridOutbound sshHybridStart;
true
)
(ok (!(sshHybrid.config.systemd.services ? "proxy-suite-ssh-proxy")))
(ok (pkgs.lib.hasInfix "_proxy_suite_add_sing_box_ob" sshHybridStart))
(ok (pkgs.lib.hasInfix expectedHybridOutbound sshHybridStart))
(
assert pkgs.lib.hasInfix "selector" sshSelectorStart;
true
)
(
assert pkgs.lib.hasInfix "ssh-proxy" sshSelectorStart;
true
)
(
assert pkgs.lib.hasInfix "# outbound: ssh-proxy (OpenSSH SOCKS5 listener)" sshUrltestStart;
true
)
(
assert builtins.any (rule: (rule.outbound or null) == "ssh-proxy") (mkRoutingRules sshRouting);
true
)
(ok (pkgs.lib.hasInfix "selector" sshSelectorStart))
(ok (pkgs.lib.hasInfix "ssh-proxy" sshSelectorStart))
(ok (pkgs.lib.hasInfix "# outbound: ssh-proxy (OpenSSH SOCKS5 listener)" sshUrltestStart))
(ok (builtins.any (rule: (rule.outbound or null) == "ssh-proxy") (mkRoutingRules sshRouting)))
]
++ invalidAssertions;
in
+8 -20
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
mkProxyCtlDerived,
@@ -6,7 +7,9 @@
}:
let
inherit (checkLib) ok;
fixtures = import ./subscriptions-runtime/fixtures.nix {
inherit checkLib;
inherit
evalProxySuite
mkProxyCtlDerived
@@ -28,10 +31,7 @@ in
{
assertions = [
# Basic config is accepted.
(
assert subscriptionOnlyFixture.config.services.proxy-suite.proxy.subscriptions != [ ];
true
)
(ok (subscriptionOnlyFixture.config.services.proxy-suite.proxy.subscriptions != [ ]))
# Wrapper exposes tags through a JSON file, not shell word splitting.
(
@@ -42,14 +42,8 @@ in
)
# Update service and timer are created when subscriptions are configured.
(
assert subscriptionOnlyFixture.config.systemd.services ? "proxy-suite-subscription-update";
true
)
(
assert subscriptionOnlyFixture.config.systemd.timers ? "proxy-suite-subscription-update";
true
)
(ok (subscriptionOnlyFixture.config.systemd.services ? "proxy-suite-subscription-update"))
(ok (subscriptionOnlyFixture.config.systemd.timers ? "proxy-suite-subscription-update"))
# A oneshot left active would swallow every later timer run.
(
assert
@@ -176,14 +170,8 @@ in
# The update service and timer exist whenever the proxy does, because a
# subscription can be added at runtime after the rebuild.
(
assert minimal.config.systemd.services ? "proxy-suite-subscription-update";
true
)
(
assert minimal.config.systemd.timers ? "proxy-suite-subscription-update";
true
)
(ok (minimal.config.systemd.services ? "proxy-suite-subscription-update"))
(ok (minimal.config.systemd.timers ? "proxy-suite-subscription-update"))
# Runtime spool dirs are root-only unless userControl grants outbounds (see user-control.nix).
(
@@ -1,9 +1,11 @@
{
checkLib,
evalProxySuite,
mkProxyCtlDerived,
}:
let
inherit (checkLib) startScript unitScript;
generated = import ../read-generated.nix;
subscriptionOnlyFixture = evalProxySuite [
@@ -60,9 +62,7 @@ let
};
}
];
subscriptionWithStaticStartScript = generated.readDerivation (
subscriptionWithStaticFixture.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
subscriptionWithStaticStartScript = startScript subscriptionWithStaticFixture;
subscriptionFirstSelectionFixture = evalProxySuite [
{
@@ -83,9 +83,7 @@ let
};
}
];
subscriptionFirstSelectionStartScript = generated.readDerivation (
subscriptionFirstSelectionFixture.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
subscriptionFirstSelectionStartScript = startScript subscriptionFirstSelectionFixture;
subscriptionPerAppTunFixture = evalProxySuite [
{
@@ -109,9 +107,7 @@ let
};
}
];
subscriptionPerAppTunUpdateScript = generated.readDerivation (
subscriptionPerAppTunFixture.config.systemd.services."proxy-suite-subscription-update".serviceConfig.ExecStart
);
subscriptionPerAppTunUpdateScript = unitScript subscriptionPerAppTunFixture "proxy-suite-subscription-update";
in
{
inherit
+3 -4
View File
@@ -1,10 +1,12 @@
{
checkLib,
evalProxySuite,
mkBadFixtureRaw,
mkFailingAssertions,
}:
let
inherit (checkLib) ok;
proxyWithSubscriptions = subscriptions: {
system.stateVersion = "26.05";
services.proxy-suite = {
@@ -71,9 +73,6 @@ in
])
++ [
# urlFile form is accepted.
(
assert subscriptionUrlFileFixture.config.services.proxy-suite.proxy.subscriptions != [ ];
true
)
(ok (subscriptionUrlFileFixture.config.services.proxy-suite.proxy.subscriptions != [ ]))
];
}
+3
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
mkBadFixtureRaw,
@@ -9,6 +10,7 @@
let
runtimeChecks = import ./subscriptions-runtime.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -17,6 +19,7 @@ let
;
};
validationChecks = import ./subscriptions-validation.nix {
inherit checkLib;
inherit
evalProxySuite
mkBadFixtureRaw
+6 -12
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
baseModule,
@@ -13,7 +14,9 @@
}:
let
inherit (checkLib) ok;
fixtures = import ./tg-ws-proxy/fixtures.nix {
inherit checkLib;
inherit
evalProxySuite
baseModule
@@ -38,18 +41,9 @@ let
in
{
assertions = [
(
assert tgSecretFile.config.services.proxy-suite.tgWsProxy.listener.address == "127.0.0.1";
true
)
(
assert minimal.config.services.proxy-suite.tgWsProxy.listener.address == "127.0.0.1";
true
)
(
assert minimal.config.services.proxy-suite.tgWsProxy.dcIps == { };
true
)
(ok (tgSecretFile.config.services.proxy-suite.tgWsProxy.listener.address == "127.0.0.1"))
(ok (minimal.config.services.proxy-suite.tgWsProxy.listener.address == "127.0.0.1"))
(ok (minimal.config.services.proxy-suite.tgWsProxy.dcIps == { }))
# Upstream runtime flags are exposed as typed module options.
(
+3 -3
View File
@@ -1,4 +1,5 @@
{
checkLib,
evalProxySuite,
baseModule,
mkRoutingRules,
@@ -8,6 +9,7 @@
}:
let
inherit (checkLib) unitScript;
generated = import ../read-generated.nix;
tgSecretFile = evalProxySuite [
@@ -47,9 +49,7 @@ let
};
}
];
tgAllOptionsStartScript = generated.readDerivation (
tgAllOptions.config.systemd.services."proxy-suite-tg-ws-proxy".serviceConfig.ExecStart
);
tgAllOptionsStartScript = unitScript tgAllOptions "proxy-suite-tg-ws-proxy";
tgWithGlobalTun = evalProxySuite [
baseModule
+33 -47
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
mkBadProxySuiteFixture,
@@ -12,6 +13,7 @@
}:
let
inherit (checkLib) ok mkProxySuite;
generated = import ./read-generated.nix;
inherit (pkgs) lib;
inherit (lib) hasInfix;
@@ -108,32 +110,27 @@ let
viaProxyStart = torStartOf viaProxy;
viaProxyTor = (services viaProxy).proxy-suite-tor;
onion = evalProxySuite [
{
system.stateVersion = "26.05";
services.proxy-suite = {
onion = mkProxySuite {
enable = true;
tor = {
enable = true;
onionService = {
enable = true;
tor = {
enable = true;
onionService = {
enable = true;
secretKeyFile = "/run/secrets/hs_ed25519_secret_key";
};
};
inbounds = {
enable = true;
serverAddress = "vpn.example.com";
routing.via = "direct";
listeners.plain = listener;
listeners.shared = listener // {
port = 10444;
address = "127.0.0.1";
sharePort = 443;
};
};
secretKeyFile = "/run/secrets/hs_ed25519_secret_key";
};
}
];
};
inbounds = {
enable = true;
serverAddress = "vpn.example.com";
routing.via = "direct";
listeners.plain = listener;
listeners.shared = listener // {
port = 10444;
address = "127.0.0.1";
sharePort = 443;
};
};
};
# An exit node: its clients' .onion names still reach Tor, through the local proxy.
exitInbounds = {
inbounds = {
@@ -326,8 +323,8 @@ in
!(lib.any (r: r.ruleTag or "" == "inbound-tor-onion") (mkInboundsConfig onion).routing.rules);
true
)
(
assert lib.all (f: failedAssertions f == [ ]) [
(ok (
lib.all (f: failedAssertions f == [ ]) [
singBox
xray
hybrid
@@ -335,25 +332,17 @@ in
bridges
viaProxy
onion
];
true
)
]
))
# Every backend dials Tor's SOCKS listener as the "tor" outbound.
(
assert hasInfix ''{"server":"127.0.0.1","server_port":18530,"tag":"tor","type":"socks"}''
singBoxStart;
true
)
(
assert hasInfix ''{"protocol":"socks","settings":{"address":"127.0.0.1","port":18530},"tag":"tor"}''
xrayStart;
true
)
(
assert hasInfix ''"tag":"tor","type":"socks"'' hybridStart;
true
)
(ok (
hasInfix ''{"server":"127.0.0.1","server_port":18530,"tag":"tor","type":"socks"}'' singBoxStart
))
(ok (
hasInfix ''{"protocol":"socks","settings":{"address":"127.0.0.1","port":18530},"tag":"tor"}'' xrayStart
))
(ok (hasInfix ''"tag":"tor","type":"socks"'' hybridStart))
# Only rules and detours reach it: never selected, tested, or used as an autoProxy exit.
(
assert
@@ -522,10 +511,7 @@ in
&& builtins.elem "proxy-suite-tor.service" onionInbounds.wants;
true
)
(
assert !(onion.config.systemd.services ? proxy-suite-socks);
true
)
(ok (!(onion.config.systemd.services ? proxy-suite-socks)))
]
++ invalidAssertions;
}
+6 -5
View File
@@ -1,10 +1,12 @@
{
checkLib,
pkgs,
evalProxySuite,
baseModule,
}:
let
inherit (checkLib) ok;
inherit (pkgs.lib) hasInfix;
mkFixture =
@@ -136,11 +138,10 @@ in
)
# -- userControl: scopes without enable is refused, not silently ignored --
(
assert builtins.any (
(ok (
builtins.any (
a: !a.assertion && hasInfix "userControl.scopes is set" a.message
) scopesWithoutEnableFixture.config.assertions;
true
)
) scopesWithoutEnableFixture.config.assertions
))
];
}
+11 -14
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
mkBadProxySuiteFixture,
@@ -6,6 +7,7 @@
}:
let
inherit (checkLib) mkProxySuite;
generated = import ./read-generated.nix;
inherit (pkgs.lib) hasInfix escapeShellArg;
@@ -67,20 +69,15 @@ let
autoRegister = registerOf auto;
generatorRegister = registerOf generator;
amneziaWg = evalProxySuite [
{
system.stateVersion = "26.05";
services.proxy-suite = {
enable = true;
amneziaWg.enable = true;
warp = {
enable = true;
configFile = profile;
asAmneziaWg = true;
};
};
}
];
amneziaWg = mkProxySuite {
enable = true;
amneziaWg.enable = true;
warp = {
enable = true;
configFile = profile;
asAmneziaWg = true;
};
};
invalidAssertions = mkFailingAssertions mkBadProxySuiteFixture [
# Enabled but used for nothing.
+2
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
mkTProxyConfig,
@@ -9,6 +10,7 @@
let
fixtures = import ./xray-backend-features/fixtures.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
+11 -16
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
mkTProxyConfig,
@@ -7,6 +8,7 @@
}:
let
inherit (checkLib) mkProxySuite startScript;
generated = import ../read-generated.nix;
rawOutboundJson =
(import ../../../modules/proxy-suite/service/script-blocks/outbounds.nix {
@@ -75,23 +77,16 @@ let
};
}
];
xraySubscriptionStartScript = generated.readDerivation (
xraySubscriptionFixture.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
xraySubscriptionStartScript = startScript xraySubscriptionFixture;
xrayRawStreamFixture = evalProxySuite [
{
system.stateVersion = "26.05";
services.proxy-suite = {
enable = true;
proxy = {
enable = true;
backend = "xray";
outbounds = [ xrayRawStreamDefinition ];
};
};
}
];
xrayRawStreamFixture = mkProxySuite {
enable = true;
proxy = {
enable = true;
backend = "xray";
outbounds = [ xrayRawStreamDefinition ];
};
};
xrayRawStreamOutbound =
rawOutboundJson (builtins.head xrayRawStreamFixture.config.services.proxy-suite.proxy.outbounds)
"proxy"
+3
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
mkTProxyConfig,
@@ -10,6 +11,7 @@
let
fixtures = import ./xray-backend-runtime/fixtures.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -100,6 +102,7 @@ let
;
};
tunChecks = import ./xray-backend-runtime/tun.nix {
inherit checkLib;
inherit
pkgs
checkConstants
+5 -9
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
mkTProxyConfig,
@@ -8,6 +9,7 @@
}:
let
inherit (checkLib) startScript unitScript;
generated = import ../read-generated.nix;
xrayModule = {
@@ -49,18 +51,12 @@ let
xrayTproxyConfig = mkTProxyConfig xrayFixture;
xrayTunConfig = mkTunConfig xrayFixture;
xrayPerAppTunConfig = mkPerAppTunConfig xrayFixture;
xrayStartScript = generated.readDerivation (
xrayFixture.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart
);
xrayTunStartScript = generated.readDerivation (
xrayFixture.config.systemd.services."proxy-suite-tun".serviceConfig.ExecStart
);
xrayStartScript = startScript xrayFixture;
xrayTunStartScript = unitScript xrayFixture "proxy-suite-tun";
xrayTunUpScript = generated.readDerivation (
xrayFixture.config.systemd.services."proxy-suite-tun".serviceConfig.ExecStartPost
);
xrayPerAppTunStartScript = generated.readDerivation (
xrayFixture.config.systemd.services."proxy-suite-per-app-tun".serviceConfig.ExecStart
);
xrayPerAppTunStartScript = unitScript xrayFixture "proxy-suite-per-app-tun";
xrayPerAppTunUpScript = generated.readDerivation (
xrayFixture.config.systemd.services."proxy-suite-per-app-tun".serviceConfig.ExecStartPost
);
+1
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
checkConstants,
xrayTunConfig,
+3
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
mkTProxyConfig,
@@ -13,6 +14,7 @@
let
runtimeChecks = import ./xray-backend-runtime.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -24,6 +26,7 @@ let
;
};
featureChecks = import ./xray-backend-features.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
+3
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
mkTProxyConfig,
@@ -13,6 +14,7 @@
let
xrayChecks = import ./xray-backend.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
@@ -27,6 +29,7 @@ let
;
};
hybridChecks = import ./hybrid-backend.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite
+1
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
baseModule,
+2
View File
@@ -1,4 +1,5 @@
{
checkLib,
pkgs,
evalProxySuite,
baseModule,
@@ -40,6 +41,7 @@ let
;
zapretHostlistRoutingChecks = import ./zapret-hostlist-routing.nix {
inherit checkLib;
inherit
pkgs
evalProxySuite