fix: behavior and docs fixes

This commit is contained in:
FUFSoB committed 2026-09-26 18:35:32 +05:00
1 parent e4458dcae8
commit 2255e1f9f0
42 files changed
+320 -161

No files matched your search

+6 -8
View File
@@ -74,18 +74,15 @@ in
assert pkgs.lib.hasInfix "/bin/sing-box run -c" hybridStartScript;
assert pkgs.lib.hasInfix "/bin/xray run -c" hybridStartScript;
assert pkgs.lib.hasInfix "xray-sidecar.json" hybridStartScript;
assert pkgs.lib.hasInfix
"XRAY_SIDECAR_NEXT_PORT=${toString checkConstants.xraySidecarBasePorts.socks}"
assert pkgs.lib.hasInfix "XRAY_SIDECAR_PORT=${toString checkConstants.xraySidecarPorts.socks}"
hybridStartScript;
assert pkgs.lib.hasInfix "XRAY_SIDECAR_DNS_PORT=${toString checkConstants.xrayDnsBridgePorts.socks}"
hybridStartScript;
assert pkgs.lib.hasInfix
"XRAY_SIDECAR_NEXT_PORT=${toString checkConstants.xraySidecarBasePorts.tun}"
assert pkgs.lib.hasInfix "XRAY_SIDECAR_PORT=${toString checkConstants.xraySidecarPorts.tun}"
hybridTunStartScript;
assert pkgs.lib.hasInfix "XRAY_SIDECAR_DNS_PORT=${toString checkConstants.xrayDnsBridgePorts.tun}"
hybridTunStartScript;
assert pkgs.lib.hasInfix
"XRAY_SIDECAR_NEXT_PORT=${toString checkConstants.xraySidecarBasePorts.perAppTun}"
assert pkgs.lib.hasInfix "XRAY_SIDECAR_PORT=${toString checkConstants.xraySidecarPorts.perAppTun}"
hybridPerAppTunStartScript;
assert pkgs.lib.hasInfix
"XRAY_SIDECAR_DNS_PORT=${toString checkConstants.xrayDnsBridgePorts.perAppTun}"
@@ -94,9 +91,10 @@ in
assert pkgs.lib.hasInfix "--backend xray" hybridStartScript;
assert pkgs.lib.hasInfix "_proxy_suite_add_xray_sidecar_ob" hybridStartScript;
assert pkgs.lib.hasInfix "hybrid XRay json sidecar" hybridXrayRawStartScript;
assert pkgs.lib.hasInfix ''{type: "socks", tag: $tag, server: "127.0.0.1"''
assert pkgs.lib.hasInfix ''{type: "vless", tag: $tag, server: "127.0.0.1"''
hybridXrayRawStartScript;
assert pkgs.lib.hasInfix "udp: true" hybridXrayRawStartScript;
assert pkgs.lib.hasInfix ''packet_encoding: "xudp"'' hybridXrayRawStartScript;
assert pkgs.lib.hasInfix "user: [$tag]" hybridXrayRawStartScript;
assert pkgs.lib.hasInfix "{routing_mark: 2}" hybridXrayRawStartScript;
assert pkgs.lib.hasInfix "sing_box_preserved_rules" hybridBackendJqFilter;
assert pkgs.lib.hasInfix "xray-dns-in" hybridBackendJqFilter;
+2 -1
View File
@@ -45,7 +45,8 @@ in
assertions = [
# -- perAppRouting: createDefaultProfiles injects curated tproxy profile when backend is enabled --
(
assert builtins.length perAppRoutingTproxyProfiles == 2;
# proxychains is off, so no proxychains profile.
assert builtins.length perAppRoutingTproxyProfiles == 1;
assert builtins.any (
profile: profile.name == "tproxy" && profile.route == "tproxy"
) perAppRoutingTproxyProfiles;
+2 -1
View File
@@ -73,7 +73,8 @@ in
assertions = [
# -- perAppRouting: createDefaultProfiles injects curated tun profile when backend is enabled --
(
assert builtins.length perAppRoutingTunProfiles == 2;
# proxychains is off, so no proxychains profile.
assert builtins.length perAppRoutingTunProfiles == 1;
assert builtins.any (
profile: profile.name == "tun" && profile.route == "tun"
) perAppRoutingTunProfiles;
@@ -38,16 +38,6 @@
{ services.proxy-suite.perAppRouting.profiles = [ { name = "oops"; } ]; }
]
# default proxychains profile still requires proxychains.enable.
[
{
services.proxy-suite.perAppRouting = {
enable = true;
createDefaultProfiles = true;
};
}
]
# route=tun requires perAppRouting.tun.enable.
[
{
@@ -154,6 +144,19 @@
}
]
# perAppRouting.zapret requires zapret.enable (global.enable = false keeps it per-app).
[
{
services.proxy-suite = {
zapret.enable = false;
perAppRouting = {
enable = true;
zapret.enable = true;
};
};
}
]
# profile names must be unique.
[
{
+4 -1
View File
@@ -44,7 +44,10 @@ let
baseModule
{
services.proxy-suite = {
zapret.enable = false;
zapret = {
enable = true;
global.enable = false;
};
perAppRouting = {
enable = true;
createDefaultProfiles = true;
+2 -1
View File
@@ -116,7 +116,8 @@ pkgs.testers.runNixOSTest {
with subtest("the rendered config carries both listeners"):
cfg = "/run/proxy-suite-inbounds/config.json"
server.succeed(f"test $(jq -r '.inbounds | length' {cfg}) = 2")
# Plus api-in, the stats API's socket.
server.succeed(f"jq -e '[.inbounds[].tag] | sort == [\"api-in\", \"ss-in\", \"vless-in\"]' {cfg}")
server.succeed(f"jq -e '.inbounds[] | select(.tag == \"vless-in\" and .port == 8443)' {cfg}")
server.succeed(f"jq -e '.inbounds[] | select(.tag == \"ss-in\" and .port == 8388)' {cfg}")
# Credentials live only in the runtime config, never in the store.
+6
View File
@@ -30,6 +30,7 @@ let
inherit (fixtures)
zapretHostlistRules
zapretHostlistBase
zapretPerAppOnlyRules
invalidHostlistAssertions
;
@@ -66,6 +67,11 @@ in
assert !(hasDirectIP zapretHostlistRules "1.1.1.0/24");
true
)
(
assert !(hasDirectDomain zapretPerAppOnlyRules "youtube.com");
assert !(hasDirectDomain zapretPerAppOnlyRules "example.com");
true
)
]
++ invalidHostlistAssertions;
}
@@ -76,6 +76,24 @@ let
zapretHostlistRules = mkRoutingRules zapretHostlistRulesFixture;
zapretHostlistBase = mkZapretBase zapretHostlistRulesFixture;
# directSync belongs to the system-wide instance: per-app zapret alone leaves routing alone.
zapretPerAppOnlyRules = mkRoutingRules (evalProxySuite [
baseModule
{
services.proxy-suite = {
zapret = {
enable = true;
global.enable = false;
zapret-discord-youtube.domains = [ "example.com" ];
};
perAppRouting = {
enable = true;
zapret.enable = true;
};
};
}
]);
invalidHostlistAssertions = mkFailingAssertions mkBadFixture [
[
{
@@ -158,6 +176,7 @@ in
inherit
zapretHostlistRules
zapretHostlistBase
zapretPerAppOnlyRules
invalidHostlistAssertions
;
}