mirror of
https://github.com/2dust/v2rayN.git
synced 2026-07-31 04:12:04 +03:00
修复 sing-box TUN 模式下 relay 出站的 mux 问题 (#9018)
* Fix sing-box selector generation for dynamic group tags * 修复 TUN 模式下 DNS 失败及 Windows 提权重启后 TUN 状态丢失 * 按上游意见回滚 TUN 提权时保留启用状态的改动
This commit is contained in:
@@ -46,7 +46,7 @@ public static class ProcUtils
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void RebootAsAdmin(bool blAdmin = true)
|
||||
public static bool RebootAsAdmin(bool blAdmin = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -58,11 +58,12 @@ public static class ProcUtils
|
||||
FileName = Utils.GetExePath().AppendQuotes(),
|
||||
Verb = blAdmin ? "runas" : null,
|
||||
};
|
||||
_ = Process.Start(startInfo);
|
||||
return Process.Start(startInfo) != null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.SaveLog(_tag, ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,6 +345,14 @@ public partial class CoreConfigSingboxService
|
||||
{
|
||||
try
|
||||
{
|
||||
// The synthetic TUN relay outbound talks to the local Xray shadowsocks relay.
|
||||
// Xray cannot terminate sing-box h2mux, so muxing here turns local relay traffic
|
||||
// into sp.mux.sing-box.arpa pseudo-destinations and breaks DNS over TUN.
|
||||
if (IsTunRelayProxyOutbound())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var muxEnabled = _node.MuxEnabled ?? _config.CoreBasicItem.MuxEnabled;
|
||||
if (muxEnabled && _config.Mux4SboxItem.Protocol.IsNotEmpty())
|
||||
{
|
||||
@@ -364,6 +372,21 @@ public partial class CoreConfigSingboxService
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsTunRelayProxyOutbound()
|
||||
{
|
||||
if (!context.IsTunEnabled
|
||||
|| _node.ConfigType != EConfigType.Shadowsocks
|
||||
|| _node.Address != Global.Loopback
|
||||
|| _node.Port != context.ProxyRelaySsPort
|
||||
|| _node.Password != Global.None)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var protocolExtra = _node.GetProtocolExtra();
|
||||
return protocolExtra.SsMethod == Global.None;
|
||||
}
|
||||
|
||||
private void FillOutboundTls(Outbound4Sbox outbound)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -490,6 +490,7 @@ public class StatusBarViewModel : MyReactiveObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await ConfigHandler.SaveConfig(_config);
|
||||
AppEvents.ReloadRequested.Publish();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user