fix: different xray fixes

This commit is contained in:
FUFSoB committed 2026-06-18 12:53:35 +05:00
1 parent 759bde8b29
commit ce86e5669b
7 files changed
+156 -21

No files matched your search

+6 -12
View File
@@ -155,23 +155,17 @@ let
xrayDnsAddress =
upstream:
let
base =
if upstream.type == "tls" then
"tls://${upstream.address}"
else
upstream.address;
in
if upstream.port == 53 && upstream.type != "tls" then
base
if upstream.type == "tcp" then
"tcp://${upstream.address}"
else
"${base}:${toString upstream.port}";
upstream.address;
mkXrayDnsServer =
tag: upstream:
{
address = xrayDnsAddress upstream;
inherit tag;
port = upstream.port;
queryStrategy = "UseIP";
};
@@ -291,8 +285,8 @@ let
else
{
servers = [
(xrayDnsAddress proxyCfg.dns.remote)
(xrayDnsAddress proxyCfg.dns.local)
(mkXrayDnsServer "remote" proxyCfg.dns.remote)
(mkXrayDnsServer "local" proxyCfg.dns.local)
];
};
xrayTunOutbounds = lib.optionals enableTunFakeDns [
@@ -68,6 +68,9 @@ let
(mkAssertion (
!(xrayEnabled && proxyCfg.selection == "selector")
) "proxy-suite: proxy.selection = \"selector\" is only available with proxy.singBox.enable = true")
(mkAssertion (
!(xrayEnabled && (proxyCfg.dns.local.type == "tls" || proxyCfg.dns.remote.type == "tls"))
) "proxy-suite: proxy.dns.*.type = \"tls\" is not supported with proxy.xray.enable = true; use udp/tcp DNS for XRay")
(requireEnabled globalTun.enable proxyEnabled
"proxy-suite: proxy.tun.enable requires proxy.enable = true"
)
+7 -3
View File
@@ -119,8 +119,12 @@ let
{ streamSettings.sockopt.mark = routingMark; }
else
{ routing_mark = routingMark; };
taggedRaw = backendRaw // { inherit tag; };
in
backendRaw // { inherit tag; } // markAttrs;
if xrayEnabled then
lib.recursiveUpdate taggedRaw markAttrs
else
taggedRaw // markAttrs;
mkOutboundBlock =
ob: routingMark: tag:
@@ -406,7 +410,7 @@ let
| if $xray_loglevel == "" then . else .log.loglevel = $xray_loglevel end
| if $auth_enabled then
(.inbounds[] | select(.protocol == "socks" and .tag == "mixed-in") | .settings.auth) = "password"
| (.inbounds[] | select(.protocol == "socks" and .tag == "mixed-in") | .settings.users) = [{user:$user,pass:$password}]
| (.inbounds[] | select(.protocol == "socks" and .tag == "mixed-in") | .settings.accounts) = [{user:$user,pass:$password}]
else . end
| if $xray_tun_dns_runtime then
.dns.servers = xray_dns_server_order($dns_final)
@@ -480,7 +484,7 @@ let
fi
''}
${lib.optionalString xrayTunEgressBinding ''
XRAY_TUN_BIND_INTERFACE="$(${pkgs.iproute2}/bin/ip -4 route get 1.1.1.1 2>/dev/null | ${pkgs.gawk}/bin/awk '
XRAY_TUN_BIND_INTERFACE="$(${pkgs.iproute2}/bin/ip -4 route get 1.1.1.1 mark ${toString globalTproxy.proxyMark} 2>/dev/null | ${pkgs.gawk}/bin/awk '
/dev/ {
for (i = 1; i <= NF; i++) {
if ($i == "dev" && i + 1 <= NF) {