fix: overall tun/tproxy improvements
This commit is contained in:
29 files changed
+445
-149
No files matched your search
@@ -5,6 +5,8 @@
|
||||
mkBadFixture,
|
||||
mkFailingAssertions,
|
||||
mkTunConfig,
|
||||
mkTProxyConfig,
|
||||
mkTProxyNftRules,
|
||||
dnsServerByTag,
|
||||
checkConstants,
|
||||
}:
|
||||
@@ -17,6 +19,8 @@ let
|
||||
mkBadFixture
|
||||
mkFailingAssertions
|
||||
mkTunConfig
|
||||
mkTProxyConfig
|
||||
mkTProxyNftRules
|
||||
;
|
||||
};
|
||||
|
||||
@@ -26,6 +30,15 @@ let
|
||||
tproxyManualFixture
|
||||
tproxyManualStartScript
|
||||
tproxyManualStopScript
|
||||
tproxyManualConfig
|
||||
tproxyManualNftRules
|
||||
tproxyIPv4OnlyStartScript
|
||||
tproxyIPv4OnlyConfig
|
||||
tproxyIPv4OnlyNftRules
|
||||
ipv4OnlyTunConfig
|
||||
ipv4OnlyPerAppTunUpScript
|
||||
xrayIPv4OnlyTunConfig
|
||||
xrayIPv4OnlyTunUpScript
|
||||
tproxyWithFirewall
|
||||
tunAutostartFixture
|
||||
tunCleanupScript
|
||||
@@ -56,6 +69,42 @@ in
|
||||
assert pkgs.lib.hasInfix "rule del fwmark 1 table 100" tproxyManualStartScript;
|
||||
assert pkgs.lib.hasInfix "route replace local default dev lo table 100" tproxyManualStartScript;
|
||||
assert pkgs.lib.hasInfix "set +e" tproxyManualStopScript;
|
||||
true
|
||||
)
|
||||
# IPv6 goes through the same port on ::1; without it IPv6 is left alone.
|
||||
(
|
||||
let
|
||||
tproxyTags = config: map (inbound: inbound.tag) (builtins.filter (inbound: inbound.type == "tproxy") config.inbounds);
|
||||
in
|
||||
assert pkgs.lib.hasInfix "delete table inet singbox" tproxyManualStartScript;
|
||||
assert pkgs.lib.hasInfix "-6 route replace local default dev lo table 100" tproxyManualStartScript;
|
||||
assert pkgs.lib.hasInfix "-6 rule add fwmark 1 table 100" tproxyManualStartScript;
|
||||
assert pkgs.lib.hasInfix "-6 rule del fwmark 1 table 100" tproxyManualStopScript;
|
||||
assert pkgs.lib.hasInfix "table inet singbox" tproxyManualNftRules;
|
||||
assert pkgs.lib.hasInfix "meta l4proto { tcp, udp } tproxy ip to 127.0.0.1:1085 meta mark set 1" tproxyManualNftRules;
|
||||
assert pkgs.lib.hasInfix "meta l4proto { tcp, udp } tproxy ip6 to [::1]:1085 meta mark set 1" tproxyManualNftRules;
|
||||
assert tproxyTags tproxyManualConfig == [ "tproxy-in" "tproxy-in6" ];
|
||||
assert !(pkgs.lib.hasInfix "-6 rule add" tproxyIPv4OnlyStartScript);
|
||||
assert pkgs.lib.hasInfix "-6 rule del fwmark 1 table 100" tproxyIPv4OnlyStartScript;
|
||||
assert !(pkgs.lib.hasInfix "tproxy ip6" tproxyIPv4OnlyNftRules);
|
||||
assert pkgs.lib.hasInfix "meta nfproto ipv4 meta l4proto { tcp, udp } meta mark set 1" tproxyIPv4OnlyNftRules;
|
||||
assert tproxyTags tproxyIPv4OnlyConfig == [ "tproxy-in" ];
|
||||
true
|
||||
)
|
||||
# proxy.ipv6 gives the TUNs an IPv6 address: sing-box's strict_route then rejects neither
|
||||
# family. Off, they stay IPv4-only and wrapped apps' IPv6 is unreachable.
|
||||
(
|
||||
let
|
||||
tunAddress = config: (builtins.head (builtins.filter (inbound: inbound.type or "" == "tun") config.inbounds)).address;
|
||||
xrayGateway = config: (builtins.head (builtins.filter (inbound: inbound.protocol or "" == "tun") config.inbounds)).settings.gateway;
|
||||
in
|
||||
assert tunAddress tunDefaultConfig == [ "172.19.0.1/30" checkConstants.globalTunIPv6Address ];
|
||||
assert tunAddress ipv4OnlyTunConfig == [ "172.19.0.1/30" ];
|
||||
assert pkgs.lib.hasInfix "-6 route replace unreachable default table 101" ipv4OnlyPerAppTunUpScript;
|
||||
assert !(pkgs.lib.hasInfix "-6 addr replace" ipv4OnlyPerAppTunUpScript);
|
||||
assert xrayGateway xrayIPv4OnlyTunConfig == [ "172.19.0.1/30" ];
|
||||
assert !(pkgs.lib.hasInfix "-6 addr replace" xrayIPv4OnlyTunUpScript);
|
||||
assert !(pkgs.lib.hasInfix "-6 route replace" xrayIPv4OnlyTunUpScript);
|
||||
assert pkgs.lib.hasInfix "rule del fwmark 1 table 100" tproxyManualStopScript;
|
||||
true
|
||||
)
|
||||
@@ -82,8 +131,6 @@ in
|
||||
assert pkgs.lib.hasInfix "delete table inet sing-box" tunCleanupScript;
|
||||
assert pkgs.lib.hasInfix "rule del table ${toString checkConstants.tunAutoRouteTableIndex}"
|
||||
tunCleanupScript;
|
||||
assert pkgs.lib.hasInfix "rule del pref ${toString checkConstants.xrayTunPerAppTproxyRulePriority}"
|
||||
tunCleanupScript;
|
||||
assert pkgs.lib.hasInfix "rule del pref ${toString checkConstants.xrayTunPerAppTunRulePriority}"
|
||||
tunCleanupScript;
|
||||
assert pkgs.lib.hasInfix "route flush table ${toString checkConstants.tunAutoRouteTableIndex}"
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
mkBadFixture,
|
||||
mkFailingAssertions,
|
||||
mkTunConfig,
|
||||
mkTProxyConfig,
|
||||
mkTProxyNftRules,
|
||||
}:
|
||||
|
||||
let
|
||||
@@ -40,6 +42,48 @@ let
|
||||
tproxyManualFixture.config.systemd.services."proxy-suite-tproxy".serviceConfig;
|
||||
tproxyManualStartScript = generated.readDerivation tproxyManualServiceConfig.ExecStart;
|
||||
tproxyManualStopScript = generated.readDerivation tproxyManualServiceConfig.ExecStop;
|
||||
tproxyManualConfig = mkTProxyConfig tproxyManualFixture;
|
||||
tproxyManualNftRules = mkTProxyNftRules tproxyManualFixture;
|
||||
|
||||
tproxyIPv4OnlyFixture = evalProxySuite [
|
||||
baseModule
|
||||
{
|
||||
networking.enableIPv6 = false;
|
||||
services.proxy-suite.proxy = {
|
||||
tproxy.enable = true;
|
||||
tun.enable = true;
|
||||
};
|
||||
services.proxy-suite.perAppRouting = {
|
||||
enable = true;
|
||||
tun.enable = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
tproxyIPv4OnlyStartScript = generated.readDerivation
|
||||
tproxyIPv4OnlyFixture.config.systemd.services."proxy-suite-tproxy".serviceConfig.ExecStart;
|
||||
tproxyIPv4OnlyConfig = mkTProxyConfig tproxyIPv4OnlyFixture;
|
||||
tproxyIPv4OnlyNftRules = mkTProxyNftRules tproxyIPv4OnlyFixture;
|
||||
ipv4OnlyTunConfig = mkTunConfig tproxyIPv4OnlyFixture;
|
||||
ipv4OnlyPerAppTunUpScript = generated.readDerivation
|
||||
tproxyIPv4OnlyFixture.config.systemd.services."proxy-suite-per-app-tun".serviceConfig.ExecStartPost;
|
||||
|
||||
# XRay's TUN configures IPv6 itself: with it off, its up script must not touch IPv6 addresses.
|
||||
xrayIPv4OnlyFixture = evalProxySuite [
|
||||
baseModule
|
||||
(
|
||||
{ lib, ... }:
|
||||
{
|
||||
networking.enableIPv6 = false;
|
||||
services.proxy-suite.proxy = {
|
||||
backend = lib.mkForce "xray";
|
||||
tun.enable = true;
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
xrayIPv4OnlyTunConfig = mkTunConfig xrayIPv4OnlyFixture;
|
||||
xrayIPv4OnlyTunUpScript = generated.readDerivation
|
||||
xrayIPv4OnlyFixture.config.systemd.services."proxy-suite-tun".serviceConfig.ExecStartPost;
|
||||
|
||||
tproxyAutostartFixture = evalProxySuite [
|
||||
baseModule
|
||||
@@ -101,6 +145,15 @@ in
|
||||
tproxyManualFixture
|
||||
tproxyManualStartScript
|
||||
tproxyManualStopScript
|
||||
tproxyManualConfig
|
||||
tproxyManualNftRules
|
||||
tproxyIPv4OnlyStartScript
|
||||
tproxyIPv4OnlyConfig
|
||||
tproxyIPv4OnlyNftRules
|
||||
ipv4OnlyTunConfig
|
||||
ipv4OnlyPerAppTunUpScript
|
||||
xrayIPv4OnlyTunConfig
|
||||
xrayIPv4OnlyTunUpScript
|
||||
tproxyWithFirewall
|
||||
tunAutostartFixture
|
||||
tunCleanupScript
|
||||
|
||||
@@ -197,6 +197,8 @@ let
|
||||
mkBadFixture
|
||||
mkFailingAssertions
|
||||
mkTunConfig
|
||||
mkTProxyConfig
|
||||
mkTProxyNftRules
|
||||
dnsServerByTag
|
||||
checkConstants
|
||||
;
|
||||
|
||||
@@ -31,6 +31,12 @@ let
|
||||
perAppRoutingTproxyUserStartScript = generated.readDerivation (
|
||||
(mkPerAppUserRules perAppRoutingTproxyFixture).perAppTproxyUserRuleStart
|
||||
);
|
||||
perAppRoutingTproxyNftRules = generated.readDerivation
|
||||
(import ../../modules/proxy-suite/nftables.nix {
|
||||
inherit (pkgs) lib;
|
||||
inherit pkgs;
|
||||
cfg = perAppRoutingTproxyFixture.config.services.proxy-suite;
|
||||
}).perAppTproxyRulesFile;
|
||||
in
|
||||
{
|
||||
assertions = [
|
||||
@@ -61,14 +67,33 @@ in
|
||||
# -- perAppRouting: app TProxy helper installs socket cgroup mark rules --
|
||||
(
|
||||
assert pkgs.lib.hasInfix "socket cgroupv2" perAppRoutingTproxyUserStartScript;
|
||||
assert pkgs.lib.hasInfix "add rule inet proxy_suite_per_app_tproxy output" perAppRoutingTproxyUserStartScript;
|
||||
assert pkgs.lib.hasInfix "meta mark set" perAppRoutingTproxyUserStartScript;
|
||||
assert pkgs.lib.hasInfix "ct mark set" perAppRoutingTproxyUserStartScript;
|
||||
true
|
||||
)
|
||||
|
||||
# -- perAppRouting: forged UDP replies to app flows skip the mark, in both chains, before
|
||||
# the ct mark is copied; otherwise the tproxy listener takes them back --
|
||||
(
|
||||
let
|
||||
inherit (pkgs.lib) hasInfix splitString;
|
||||
guardedBeforeMark = chain: hasInfix "ct direction reply return" (builtins.head (splitString "ct mark 17 meta mark set 17" chain));
|
||||
chains = splitString "chain output" perAppRoutingTproxyNftRules;
|
||||
in
|
||||
assert guardedBeforeMark (builtins.elemAt chains 0);
|
||||
assert guardedBeforeMark (builtins.elemAt chains 1);
|
||||
# This host's own addresses are not tproxied.
|
||||
assert hasInfix "fib daddr type local return" (builtins.elemAt chains 0);
|
||||
true
|
||||
)
|
||||
|
||||
# -- perAppRouting: app TProxy startup installs nftables and loopback policy route --
|
||||
(
|
||||
assert pkgs.lib.hasInfix "proxy_suite_per_app_tproxy" perAppRoutingTproxyStartScript;
|
||||
assert pkgs.lib.hasInfix "delete table inet proxy_suite_per_app_tproxy" perAppRoutingTproxyStartScript;
|
||||
assert pkgs.lib.hasInfix "-6 route replace local default dev lo table 102" perAppRoutingTproxyStartScript;
|
||||
assert pkgs.lib.hasInfix "-6 rule add fwmark 17 table 102" perAppRoutingTproxyStartScript;
|
||||
assert pkgs.lib.hasInfix "-6 rule del fwmark 17 table 102" perAppRoutingTproxyStopScript;
|
||||
assert pkgs.lib.hasInfix "rule del fwmark 17 table 102" perAppRoutingTproxyStartScript;
|
||||
assert pkgs.lib.hasInfix "route replace local default dev lo table 102"
|
||||
perAppRoutingTproxyStartScript;
|
||||
|
||||
@@ -38,6 +38,12 @@ let
|
||||
perAppRoutingTunUserStartScript = generated.readDerivation (
|
||||
(mkPerAppUserRules perAppRoutingTunFixture).perAppTunUserRuleStart
|
||||
);
|
||||
perAppRoutingTunNftRules = generated.readDerivation
|
||||
(import ../../modules/proxy-suite/nftables.nix {
|
||||
inherit (pkgs) lib;
|
||||
inherit pkgs;
|
||||
cfg = perAppRoutingTunFixture.config.services.proxy-suite;
|
||||
}).perAppTunChainFile;
|
||||
|
||||
perAppRoutingTunWithTproxyFixture = evalProxySuite [
|
||||
baseModule
|
||||
@@ -92,7 +98,7 @@ in
|
||||
);
|
||||
in
|
||||
assert inbound.interface_name == "psperapptun0";
|
||||
assert inbound.address == [ "172.20.0.1/30" ];
|
||||
assert inbound.address == [ "172.20.0.1/30" "fd66:20::1/64" ];
|
||||
assert inbound.auto_route == false;
|
||||
assert inbound.auto_redirect == false;
|
||||
assert inbound.strict_route == false;
|
||||
@@ -139,15 +145,26 @@ in
|
||||
assert perAppRoutingTunFixture.config.systemd.services ? "proxy-suite-per-app-tun-user@";
|
||||
assert perAppRoutingTunFixture.config.systemd.user.services ? "proxy-suite-per-app-tun-anchor";
|
||||
assert perAppRoutingTunServiceConfig.ExecStartPre == perAppRoutingTunServiceConfig.ExecStopPost;
|
||||
assert !(pkgs.lib.hasInfix "-6 addr replace" perAppRoutingTunUpScript);
|
||||
assert !(pkgs.lib.hasInfix "-6 route replace" perAppRoutingTunUpScript);
|
||||
assert !(pkgs.lib.hasInfix "-6 rule add" perAppRoutingTunUpScript);
|
||||
# With proxy.ipv6, wrapped apps' IPv6 goes through the app TUN too.
|
||||
assert pkgs.lib.hasInfix ''-6 addr replace "$tun6_cidr" dev psperapptun0'' perAppRoutingTunUpScript;
|
||||
assert pkgs.lib.hasInfix "-6 route replace default dev psperapptun0 table 101" perAppRoutingTunUpScript;
|
||||
assert !(pkgs.lib.hasInfix "unreachable" perAppRoutingTunUpScript);
|
||||
assert pkgs.lib.hasInfix "-6 rule add fwmark 16 table 101" perAppRoutingTunUpScript;
|
||||
assert pkgs.lib.hasInfix "-6 route flush table 101" perAppRoutingTunCleanupScript;
|
||||
assert pkgs.lib.hasInfix "link del dev" perAppRoutingTunCleanupScript;
|
||||
assert pkgs.lib.hasInfix "psperapptun0" perAppRoutingTunCleanupScript;
|
||||
assert pkgs.lib.hasInfix "rule del fwmark 16 table 101" perAppRoutingTunCleanupScript;
|
||||
true
|
||||
)
|
||||
|
||||
# -- 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"
|
||||
(builtins.head (pkgs.lib.splitString "ct mark 16 meta mark set 16" perAppRoutingTunNftRules));
|
||||
true
|
||||
)
|
||||
|
||||
# -- perAppRouting: app TUN enables nftables --
|
||||
(
|
||||
assert perAppRoutingTunFixture.config.networking.nftables.enable;
|
||||
|
||||
@@ -42,7 +42,9 @@ let
|
||||
xrayJqFilterRuntimeCheck =
|
||||
pkgs.runCommand "proxy-suite-xray-jq-filter-runtime-check" { nativeBuildInputs = [ pkgs.jq ]; }
|
||||
''
|
||||
OBS='[{"protocol":"freedom","tag":"proxy-suite-ob-primary"}]'
|
||||
OBS='[{"protocol":"freedom","tag":"proxy-suite-ob-primary"},
|
||||
{"protocol":"vless","tag":"proxy-suite-ob-edge","settings":{"vnext":[{"address":"edge.example.com","port":443}]}},
|
||||
{"protocol":"trojan","tag":"proxy-suite-ob-ip","settings":{"servers":[{"address":"203.0.113.1","port":443}]}}]'
|
||||
|
||||
check_runtime() {
|
||||
local name="$1"
|
||||
@@ -72,6 +74,9 @@ let
|
||||
and .dns.servers[0].tag == "fakedns"
|
||||
and ([.routing.rules[] | select((.ruleTag? // "") == "dns-hijack")] | length) == 1
|
||||
and ([.routing.rules[] | select((.ruleTag? // "") == "dns-upstream-direct")] | length) == 1
|
||||
and ([.routing.rules[] | select((.ruleTag? // "") == "dns-upstream-remote")] | length) == 1
|
||||
and ([.dns.servers[] | select(.domains?)] == [.dns.servers[] | select(.tag == "local" and (has("domains") | not))
|
||||
| . + {domains: ["full:edge.example.com"], skipFallback: true}])
|
||||
and ([.outbounds[] | select(.streamSettings.sockopt.interface?)] | length) == 0
|
||||
and ([.outbounds[] | select(.protocol == "freedom" or .tag == "proxy-suite-ob-primary") | .streamSettings.sockopt.domainStrategy] | all(. == "UseIPv4v6"))
|
||||
and ([.outbounds[] | select(.protocol == "dns") | .streamSettings.sockopt.domainStrategy?] | all(. == null))
|
||||
|
||||
@@ -36,6 +36,14 @@
|
||||
assert tproxyInbound.protocol == "tunnel";
|
||||
assert tproxyInbound.settings.followRedirect == true;
|
||||
assert tproxyInbound.streamSettings.sockopt.tproxy == "tproxy";
|
||||
assert builtins.any (
|
||||
inbound: inbound.tag == "tproxy-in6" && inbound.listen == "::1"
|
||||
) xrayTproxyConfig.inbounds;
|
||||
# Apps' DNS through TProxy is answered by XRay, as sing-box's hijack-dns.
|
||||
assert builtins.any (
|
||||
rule: (rule.ruleTag or "") == "dns-hijack" && rule.inboundTag == [ "tproxy-in" "tproxy-in6" ]
|
||||
) xrayTproxyConfig.routing.rules;
|
||||
assert builtins.any (outbound: outbound.tag == "dns-out") xrayTproxyConfig.outbounds;
|
||||
assert specificRule.outboundTag == "proxy-suite-ob-primary";
|
||||
assert specificRule.ruleTag == "custom-proxy-domain";
|
||||
assert balancer.tag == "proxy";
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
!(pkgs.lib.hasInfix ''select(.protocol == "socks" and .tag == "mixed-in") | .settings.users'' xrayBackendJqFilter);
|
||||
assert pkgs.lib.hasInfix "xray_preserved_rules" xrayBackendJqFilter;
|
||||
assert pkgs.lib.hasInfix "dns-upstream-direct" xrayBackendJqFilter;
|
||||
assert pkgs.lib.hasInfix "dns-upstream-remote" xrayBackendJqFilter;
|
||||
assert pkgs.lib.hasInfix "xray_pin_server_names" xrayBackendJqFilter;
|
||||
assert pkgs.lib.hasInfix "xray_dns_server_order" xrayBackendJqFilter;
|
||||
assert pkgs.lib.hasInfix "dns-hijack" xrayBackendJqFilter;
|
||||
assert pkgs.lib.hasInfix "del(.routing.balancers)" xrayBackendJqFilter;
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
tunHasDnsHijackRule = builtins.any (
|
||||
rule: (rule ? ruleTag) && rule.ruleTag == "dns-hijack"
|
||||
) xrayTunConfig.routing.rules;
|
||||
tunHasDnsUpstreamRule = builtins.any (
|
||||
rule: (rule ? ruleTag) && rule.ruleTag == "dns-upstream-direct"
|
||||
tunDnsUpstreamRules = builtins.filter (
|
||||
rule: builtins.elem (rule.ruleTag or "") [ "dns-upstream-direct" "dns-upstream-remote" ]
|
||||
) xrayTunConfig.routing.rules;
|
||||
in
|
||||
assert tunInbound.protocol == "tun";
|
||||
@@ -38,7 +38,7 @@
|
||||
assert
|
||||
tunInbound.settings.gateway == [
|
||||
"172.19.0.1/30"
|
||||
checkConstants.xrayGlobalTunIPv6Address
|
||||
checkConstants.globalTunIPv6Address
|
||||
];
|
||||
assert tunInbound.sniffing.destOverride == [ "fakedns" ];
|
||||
assert tunInbound.sniffing.metadataOnly == false;
|
||||
@@ -46,9 +46,9 @@
|
||||
assert tunHasFinalRuleTag;
|
||||
assert tunHasDirectGeositeRule;
|
||||
assert tunHasDnsHijackRule;
|
||||
assert tunHasDnsUpstreamRule;
|
||||
# Servers route by their own tags: local direct, remote through the proxy.
|
||||
assert map (rule: rule.inboundTag) tunDnsUpstreamRules == [ [ "local" ] [ "remote" ] ];
|
||||
assert xrayTunConfig.dns.queryStrategy == "UseIP";
|
||||
assert xrayTunConfig.dns.tag == "dns-in";
|
||||
assert (builtins.head xrayTunConfig.dns.servers).address == "fakedns";
|
||||
assert (builtins.head xrayTunConfig.dns.servers).tag == "fakedns";
|
||||
assert (builtins.elemAt xrayTunConfig.dns.servers 1).tag == "remote";
|
||||
@@ -69,7 +69,7 @@
|
||||
assert pkgs.lib.hasInfix ''-f "$BACKEND_JQ_FILTER"'' xrayTunStartScript;
|
||||
assert pkgs.lib.hasInfix "xray_tun_dns_runtime" xrayTunStartScript;
|
||||
assert pkgs.lib.hasInfix ''tun_route_prefix="$(cidr_network "$tun_cidr")"'' xrayTunUpScript;
|
||||
assert pkgs.lib.hasInfix checkConstants.xrayGlobalTunIPv6Address xrayTunUpScript;
|
||||
assert pkgs.lib.hasInfix checkConstants.globalTunIPv6Address xrayTunUpScript;
|
||||
assert pkgs.lib.hasInfix ''addr replace "$tun_cidr" dev singtun0'' xrayTunUpScript;
|
||||
assert pkgs.lib.hasInfix ''-6 addr replace "$tun6_cidr" dev singtun0'' xrayTunUpScript;
|
||||
assert pkgs.lib.hasInfix
|
||||
@@ -84,9 +84,6 @@
|
||||
assert pkgs.lib.hasInfix
|
||||
"-6 route replace default dev singtun0 table ${toString checkConstants.tunAutoRouteTableIndex}"
|
||||
xrayTunUpScript;
|
||||
assert pkgs.lib.hasInfix
|
||||
"rule add pref ${toString checkConstants.xrayTunPerAppTproxyRulePriority} fwmark 17 table 102"
|
||||
xrayTunUpScript;
|
||||
assert pkgs.lib.hasInfix
|
||||
"rule add pref ${toString checkConstants.xrayTunPerAppTunRulePriority} fwmark 16 table 101"
|
||||
xrayTunUpScript;
|
||||
@@ -120,7 +117,6 @@
|
||||
) [
|
||||
checkConstants.xrayTunMarkBypassRulePriority
|
||||
checkConstants.xrayTunServiceUserRulePriority
|
||||
checkConstants.xrayTunPerAppTproxyRulePriority
|
||||
checkConstants.xrayTunPerAppTunRulePriority
|
||||
checkConstants.xrayTunDnsRulePriority
|
||||
checkConstants.xrayTunMainRulePriority
|
||||
|
||||
@@ -23,13 +23,12 @@
|
||||
assert
|
||||
perAppTunInbound.settings.gateway == [
|
||||
"172.20.0.1/30"
|
||||
checkConstants.xrayPerAppTunIPv6Address
|
||||
checkConstants.perAppTunIPv6Address
|
||||
];
|
||||
assert perAppTunInbound.sniffing.destOverride == [ "fakedns" ];
|
||||
assert perAppTunInbound.sniffing.metadataOnly == false;
|
||||
assert xrayPerAppTunConfig.routing.domainStrategy == "IPIfNonMatch";
|
||||
assert (builtins.head xrayPerAppTunConfig.dns.servers).address == "fakedns";
|
||||
assert xrayPerAppTunConfig.dns.tag == "dns-in";
|
||||
assert builtins.length xrayPerAppTunConfig.fakedns == 2;
|
||||
assert perAppTunDirectOutbound.streamSettings.sockopt.mark == 2;
|
||||
assert pkgs.lib.hasInfix "XRAY_SINGLE_PROXY_TAG=" xrayPerAppTunStartScript;
|
||||
@@ -38,7 +37,7 @@
|
||||
assert pkgs.lib.hasInfix "--routing-mark 2" xrayPerAppTunStartScript;
|
||||
assert pkgs.lib.hasInfix "xray_tun_dns_runtime" xrayPerAppTunStartScript;
|
||||
assert pkgs.lib.hasInfix ''tun_route_prefix="$(cidr_network "$tun_cidr")"'' xrayPerAppTunUpScript;
|
||||
assert pkgs.lib.hasInfix checkConstants.xrayPerAppTunIPv6Address xrayPerAppTunUpScript;
|
||||
assert pkgs.lib.hasInfix checkConstants.perAppTunIPv6Address xrayPerAppTunUpScript;
|
||||
assert !(pkgs.lib.hasInfix "uplink_addr" xrayPerAppTunUpScript);
|
||||
assert pkgs.lib.hasInfix ''addr replace "$tun_cidr" dev psperapptun0'' xrayPerAppTunUpScript;
|
||||
assert pkgs.lib.hasInfix ''-6 addr replace "$tun6_cidr" dev psperapptun0'' xrayPerAppTunUpScript;
|
||||
|
||||
Reference in new issue
Block a user