fix: tun not working

This commit is contained in:
FUFSoB committed 2026-05-18 18:25:08 +05:00
1 parent 86e229ff4c
commit 110e33bc27
2 files changed
+17 -5

No files matched your search

+11 -2
View File
@@ -138,7 +138,12 @@ let
rules = rules.routingRules;
final = if singBoxCfg.proxyByDefault then "proxy" else "direct";
}
// lib.optionalAttrs (enableTun && tunAutoRoute) { auto_detect_interface = true; };
// lib.optionalAttrs (enableTun && tunAutoRoute) {
# sing-box recommends this with auto_route to keep its own outbound
# connections pinned to the host's default NIC instead of looping back
# into the TUN interface.
auto_detect_interface = true;
};
}
// lib.optionalAttrs enableClashApi clashApiBlock;
@@ -156,7 +161,11 @@ let
tunAutoRoute = true;
tunAutoRedirect = true;
tunStrictRoute = true;
forceLocalDnsViaProxy = true;
# Keep the bootstrap resolver on the direct path. Sending the "local" DNS
# transport through outbound tag "proxy" causes a resolver loop in global
# TUN mode because outbound hostname resolution and urltest probe lookups
# recurse back into the same proxy path.
forceLocalDnsViaProxy = false;
enableClashApi = false;
};
+6 -3
View File
@@ -1459,6 +1459,7 @@ let
in
assert inbound.iproute2_table_index == 2022;
assert inbound.iproute2_rule_index == 9000;
assert tunDefaultConfig.route.auto_detect_interface == true;
true
)
(
@@ -1470,7 +1471,8 @@ let
assert pkgs.lib.hasInfix ''delete table inet sing-box'' tunCleanupScript;
assert pkgs.lib.hasInfix ''rule del table 2022'' tunCleanupScript;
assert pkgs.lib.hasInfix ''route flush table 2022'' tunCleanupScript;
assert pkgs.lib.hasInfix "link del dev 'singtun0'" tunCleanupScript;
assert pkgs.lib.hasInfix "link del dev" tunCleanupScript;
assert pkgs.lib.hasInfix "singtun0" tunCleanupScript;
true
)
(
@@ -1571,7 +1573,7 @@ let
let
localDns = dnsServerByTag tunDefaultConfig "local";
in
assert localDns.detour == "proxy";
assert !(localDns ? detour);
true
)
(
@@ -2068,7 +2070,8 @@ let
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 "link del dev 'psperapptun0'" 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
)