Compare commits

..

7 Commits

Author SHA1 Message Date
JieXu 5dd5b25869 Update Directory.Packages.props (#9766) 2026-07-16 11:48:57 +08:00
2dust fafdb4a0b6 up 7.24.0 2026-07-16 11:42:28 +08:00
2dust 223642dd67 Fix
https://github.com/2dust/v2rayN/issues/9765
2026-07-16 11:39:47 +08:00
Miheichev Aleksandr Sergeevich 165e0bf9e9 chore(deps): update NuGet dependencies (#9745)
- Downloader 5.9.0 -> 5.9.4
- NLog 6.1.3 -> 6.1.4
- Repobot.SQLite.Unofficial 3.53.3 -> 3.53.3.8
- sqlite-net-e 1.11.0 -> 1.11.285
- YamlDotNet 18.0.0 -> 18.1.0

sqlite-net-e and Repobot.SQLite.Unofficial are bumped together: the newer
sqlite-net-e moves to SQLitePCLRaw.config.e_sqlite3 3.0.3.

SkiaSharp.NativeAssets.Linux intentionally stays at 3.119.4 to match the
managed SkiaSharp resolved through Avalonia.Skia 12.1.0; bumping it alone
to 4.x would compile but break rendering at runtime on Linux. It should
follow Avalonia when Avalonia itself moves to SkiaSharp 4.
ReactiveUI.Avalonia stays at 12.0.3: the numerically higher 14.x line
targets Avalonia 11 / ReactiveUI 19 and would be an effective downgrade
for the Avalonia 12 stack.
2026-07-15 19:12:56 +08:00
DHR60 e615314582 Xray tun route only (#9759) 2026-07-15 19:12:34 +08:00
DHR60 ca9978b625 Fix (#9758) 2026-07-15 18:12:55 +08:00
DHR60 74ab7ad097 Add ProtectCoreTypeList (#9756)
* Add ProtectCoreTypeList

* Add process path restrictions
2026-07-15 17:32:07 +08:00
8 changed files with 68 additions and 38 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<Version>7.23.4</Version>
<Version>7.24.0</Version>
</PropertyGroup>
<PropertyGroup>
+5 -5
View File
@@ -14,7 +14,7 @@
<PackageVersion Include="IPNetwork2" Version="4.3.0" />
<PackageVersion Include="ReactiveUI.Avalonia" Version="12.0.3" />
<PackageVersion Include="CliWrap" Version="3.10.2" />
<PackageVersion Include="Downloader" Version="5.9.0" />
<PackageVersion Include="Downloader" Version="5.9.4" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.7.0" />
<PackageVersion Include="H.NotifyIcon.Wpf" Version="2.4.1" />
<PackageVersion Include="MaterialDesignThemes" Version="5.3.2" />
@@ -25,15 +25,15 @@
<PackageVersion Include="Semi.Avalonia" Version="12.1.0" />
<PackageVersion Include="Semi.Avalonia.AvaloniaEdit" Version="12.0.0" />
<PackageVersion Include="Semi.Avalonia.DataGrid" Version="12.1.0" />
<PackageVersion Include="NLog" Version="6.1.3" />
<PackageVersion Include="sqlite-net-e" Version="1.11.0" />
<PackageVersion Include="NLog" Version="6.1.4" />
<PackageVersion Include="sqlite-net-e" Version="1.11.285" />
<PackageVersion Include="Repobot.SQLite.Unofficial" Version="3.53.3" />
<PackageVersion Include="TaskScheduler" Version="2.12.2" />
<PackageVersion Include="WebDav.Client" Version="2.9.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageVersion Include="xunit.v3" Version="3.2.2" />
<PackageVersion Include="YamlDotNet" Version="18.0.0" />
<PackageVersion Include="YamlDotNet" Version="18.1.0" />
<PackageVersion Include="ZXing.Net.Bindings.SkiaSharp" Version="0.16.22" />
<PackageVersion Include="SkiaSharp.NativeAssets.Linux" Version="3.119.4" />
</ItemGroup>
</Project>
</Project>
@@ -193,12 +193,16 @@ public class CoreConfigContextBuilder
if (preSocksItem != null)
{
var preSocksResult = await Build(nodeContext.AppConfig, preSocksItem);
var protectCoreTypeList = new HashSet<ECoreType>(nodeContext.ProtectCoreTypeList) { nodeContext.RunCoreType };
return preSocksResult with
{
Context = preSocksResult.Context with
{
ProtectDomainList =
[.. nodeContext.ProtectDomainList ?? [], .. preSocksResult.Context.ProtectDomainList ?? []],
ProtectCoreTypeList = protectCoreTypeList,
},
};
}
+12 -1
View File
@@ -34,7 +34,18 @@ public class CoreAdminManager
StringBuilder sb = new();
sb.AppendLine("#!/bin/bash");
var cmdLine = $"{fileName.AppendQuotes()} {string.Format(coreInfo.Arguments, Utils.GetBinConfigPath(configPath).AppendQuotes())}";
sb.AppendLine($"exec sudo -S -- {cmdLine}");
// Passing environment variables to the sudo command, here it only xray or sing-box.
if (coreInfo.Environment.Count > 0)
{
var envArgs = string.Join(" ", coreInfo.Environment.Where(kv => kv.Value.IsNotEmpty()).Select(kv => $"{kv.Key}={kv.Value.AppendQuotes()}"));
sb.AppendLine($"exec sudo -S -- env {envArgs} {cmdLine}");
}
else
{
sb.AppendLine($"exec sudo -S -- {cmdLine}");
}
var shFilePath = await FileUtils.CreateLinuxShellFile("run_as_sudo.sh", sb.ToString(), true);
var procService = new ProcessService(
@@ -17,6 +17,8 @@ public record CoreConfigContext
// TUN Compatibility
public bool IsTunEnabled { get; init; } = false;
public HashSet<string> ProtectDomainList { get; init; } = [];
// Typically, it is the core of the outbound chain
public HashSet<ECoreType> ProtectCoreTypeList { get; init; } = [];
public bool IsWindows { get; init; }
public bool IsMacOS { get; init; }
@@ -34,18 +34,18 @@ public partial class CoreConfigSingboxService
_coreConfig.route.rules.AddRange(tunRules);
}
var (lstDnsExe, lstDirectExe) = BuildRoutingDirectExe();
var lstDirectExe = BuildRoutingDirectExe();
_coreConfig.route.rules.Add(new()
{
port = [53],
action = "hijack-dns",
process_name = lstDnsExe
process_path = lstDirectExe
});
_coreConfig.route.rules.Add(new()
{
outbound = Global.DirectTag,
process_name = lstDirectExe
process_path = lstDirectExe
});
// ICMP Routing
@@ -256,34 +256,38 @@ public partial class CoreConfigSingboxService
}
}
private static (List<string> lstDnsExe, List<string> lstDirectExe) BuildRoutingDirectExe()
private List<string> BuildRoutingDirectExe()
{
var dnsExeSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
var directExeSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
var coreInfoResult = CoreInfoManager.Instance.GetCoreInfo();
var allCoreInfo = CoreInfoManager.Instance.GetCoreInfo();
foreach (var coreConfig in coreInfoResult)
foreach (var coreConfig in allCoreInfo)
{
if (!context.ProtectCoreTypeList.Contains(coreConfig.CoreType))
{
continue;
}
if (coreConfig.CoreType == ECoreType.v2rayN)
{
continue;
}
if (coreConfig.CoreExes == null)
{
continue;
}
foreach (var baseExeName in coreConfig.CoreExes)
{
if (coreConfig.CoreType != ECoreType.sing_box)
//directExeSet.Add(Utils.GetExeName(baseExeName));
var exePath = CoreInfoManager.Instance.GetCoreExecFile(coreConfig, out _);
if (!exePath.IsNullOrEmpty())
{
dnsExeSet.Add(Utils.GetExeName(baseExeName));
directExeSet.Add(exePath);
}
directExeSet.Add(Utils.GetExeName(baseExeName));
}
}
var lstDnsExe = new List<string>(dnsExeSet);
var lstDirectExe = new List<string>(directExeSet);
return (lstDnsExe, lstDirectExe);
return directExeSet.ToList();
}
private void GenRoutingUserRule(RulesItem? item)
@@ -74,6 +74,7 @@ public partial class CoreConfigV2rayService
tunInbound.settings.autoOutboundsInterface = bindInterface;
}
tunInbound.sniffing = inbound.sniffing;
tunInbound.sniffing.routeOnly = true;
if (_config.TunModeItem.RouteExcludeAddress is { Count: > 0 })
{
@@ -13,11 +13,11 @@ public partial class CoreConfigV2rayService
{
_coreConfig.routing.rules.AddRange(tunRules);
}
var (lstDnsExe, lstDirectExe) = BuildRoutingDirectExe();
var lstDirectExe = BuildRoutingDirectExe();
_coreConfig.routing.rules.Add(new()
{
port = "53",
process = lstDnsExe,
process = lstDirectExe,
outboundTag = Global.DnsOutboundTag,
});
_coreConfig.routing.rules.Add(new()
@@ -232,36 +232,44 @@ public partial class CoreConfigV2rayService
return finalRule;
}
private static (List<string> lstDnsExe, List<string> lstDirectExe) BuildRoutingDirectExe()
private List<string> BuildRoutingDirectExe()
{
var dnsExeSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
var directExeSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
var coreInfoResult = CoreInfoManager.Instance.GetCoreInfo();
var allCoreInfo = CoreInfoManager.Instance.GetCoreInfo();
foreach (var coreConfig in coreInfoResult)
foreach (var coreConfig in allCoreInfo)
{
if (!context.ProtectCoreTypeList.Contains(coreConfig.CoreType))
{
continue;
}
if (coreConfig.CoreType == ECoreType.v2rayN)
{
continue;
}
if (coreConfig.CoreExes == null)
{
continue;
}
if (coreConfig.CoreType == ECoreType.Xray)
{
directExeSet.Add("xray/");
continue;
}
foreach (var baseExeName in coreConfig.CoreExes)
{
if (coreConfig.CoreType != ECoreType.Xray)
//directExeSet.Add(Utils.GetExeName(baseExeName));
var exePath = CoreInfoManager.Instance.GetCoreExecFile(coreConfig, out _);
if (!exePath.IsNullOrEmpty())
{
dnsExeSet.Add(Utils.GetExeName(baseExeName));
directExeSet.Add(exePath);
}
directExeSet.Add(Utils.GetExeName(baseExeName));
}
}
directExeSet.Add("xray/");
//directExeSet.Add("xray/");
directExeSet.Add("self/");
var lstDnsExe = new List<string>(dnsExeSet);
var lstDirectExe = new List<string>(directExeSet);
return (lstDnsExe, lstDirectExe);
return directExeSet.ToList();
}
}