Compare commits

..

9 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
DHR60 8f5cbad988 Xray precore for custom config (#9754)
* Xray precore for custom config

* Fix

* Custom Pre

---------

Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com>
2026-07-15 17:23:21 +08:00
2dust 1ab9757498 Revert "fix: 在窗口初始化前设置保存的尺寸,消除启动时偏右下偏移 (#9498)"
This reverts commit 8147b39723.
https://github.com/2dust/v2rayN/issues/9740
2026-07-14 17:27:30 +08:00
13 changed files with 85 additions and 56 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,
},
};
}
+2 -1
View File
@@ -1511,7 +1511,8 @@ public static class ConfigHandler
else if (node.ConfigType == EConfigType.Custom
&& node.PreSocksPort is > 0 and <= 65535)
{
var preCoreType = config.TunModeItem.EnableTun ? ECoreType.sing_box : ECoreType.Xray;
var customPreCoreType = AppManager.Instance.GetCoreType(null, EConfigType.Custom);
var preCoreType = (enableLegacyProtect && config.TunModeItem.EnableTun) ? ECoreType.sing_box : customPreCoreType;
itemSocks = new ProfileItem()
{
CoreType = preCoreType,
+1 -1
View File
@@ -663,7 +663,7 @@ public sealed class AppManager
return Global.SsSecuritiesInSingbox;
}
public ECoreType GetCoreType(ProfileItem profileItem, EConfigType eConfigType)
public ECoreType GetCoreType(ProfileItem? profileItem, EConfigType eConfigType)
{
if (profileItem?.CoreType != null)
{
+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();
}
}
+12 -14
View File
@@ -4,7 +4,6 @@ public class WindowBase<TViewModel> : ReactiveWindow<TViewModel> where TViewMode
{
public WindowBase()
{
Initialized += OnWindowInitialized;
Loaded += OnLoaded;
Loaded += (s, e) =>
{
@@ -20,7 +19,7 @@ public class WindowBase<TViewModel> : ReactiveWindow<TViewModel> where TViewMode
throw new NotImplementedException();
}
private void OnWindowInitialized(object? sender, EventArgs e)
protected virtual void OnLoaded(object? sender, RoutedEventArgs e)
{
try
{
@@ -30,23 +29,22 @@ public class WindowBase<TViewModel> : ReactiveWindow<TViewModel> where TViewMode
return;
}
if (sizeItem.Width > 0 && !Width.Equals(sizeItem.Width))
{
Width = sizeItem.Width;
}
var screen = Screens.ScreenFromWindow(this) ?? Screens.Primary;
var scaling = screen.Scaling > 0 ? screen.Scaling : 1.0;
var workingArea = screen.WorkingArea;
if (sizeItem.Height > 0 && !Height.Equals(sizeItem.Height))
{
Height = sizeItem.Height;
}
var width = Math.Min(sizeItem.Width, workingArea.Width / scaling);
var height = Math.Min(sizeItem.Height, workingArea.Height / scaling);
var x = workingArea.X + ((workingArea.Width - (width * scaling)) / 2);
var y = workingArea.Y + ((workingArea.Height - (height * scaling)) / 2);
Width = width;
Height = height;
Position = new PixelPoint((int)x, (int)y);
}
catch { }
}
protected virtual void OnLoaded(object? sender, RoutedEventArgs e)
{
}
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
@@ -1114,7 +1114,7 @@
Grid.Column="0"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="Custom" />
Text="Custom Pre" />
<ComboBox
x:Name="cmbCoreType2"
Grid.Row="2"
+1 -1
View File
@@ -1388,7 +1388,7 @@
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="Custom" />
Text="Custom Pre" />
<ComboBox
x:Name="cmbCoreType2"
Grid.Row="2"