mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-18 18:35:00 +03:00
Compare commits
7 Commits
8f5cbad988
...
7.24.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 5dd5b25869 | |||
| fafdb4a0b6 | |||
| 223642dd67 | |||
| 165e0bf9e9 | |||
| e615314582 | |||
| ca9978b625 | |||
| 74ab7ad097 |
@@ -1,7 +1,7 @@
|
|||||||
<Project>
|
<Project>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>7.23.4</Version>
|
<Version>7.24.0</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<PackageVersion Include="IPNetwork2" Version="4.3.0" />
|
<PackageVersion Include="IPNetwork2" Version="4.3.0" />
|
||||||
<PackageVersion Include="ReactiveUI.Avalonia" Version="12.0.3" />
|
<PackageVersion Include="ReactiveUI.Avalonia" Version="12.0.3" />
|
||||||
<PackageVersion Include="CliWrap" Version="3.10.2" />
|
<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="Microsoft.NET.Test.Sdk" Version="18.7.0" />
|
||||||
<PackageVersion Include="H.NotifyIcon.Wpf" Version="2.4.1" />
|
<PackageVersion Include="H.NotifyIcon.Wpf" Version="2.4.1" />
|
||||||
<PackageVersion Include="MaterialDesignThemes" Version="5.3.2" />
|
<PackageVersion Include="MaterialDesignThemes" Version="5.3.2" />
|
||||||
@@ -25,15 +25,15 @@
|
|||||||
<PackageVersion Include="Semi.Avalonia" Version="12.1.0" />
|
<PackageVersion Include="Semi.Avalonia" Version="12.1.0" />
|
||||||
<PackageVersion Include="Semi.Avalonia.AvaloniaEdit" Version="12.0.0" />
|
<PackageVersion Include="Semi.Avalonia.AvaloniaEdit" Version="12.0.0" />
|
||||||
<PackageVersion Include="Semi.Avalonia.DataGrid" Version="12.1.0" />
|
<PackageVersion Include="Semi.Avalonia.DataGrid" Version="12.1.0" />
|
||||||
<PackageVersion Include="NLog" Version="6.1.3" />
|
<PackageVersion Include="NLog" Version="6.1.4" />
|
||||||
<PackageVersion Include="sqlite-net-e" Version="1.11.0" />
|
<PackageVersion Include="sqlite-net-e" Version="1.11.285" />
|
||||||
<PackageVersion Include="Repobot.SQLite.Unofficial" Version="3.53.3" />
|
<PackageVersion Include="Repobot.SQLite.Unofficial" Version="3.53.3" />
|
||||||
<PackageVersion Include="TaskScheduler" Version="2.12.2" />
|
<PackageVersion Include="TaskScheduler" Version="2.12.2" />
|
||||||
<PackageVersion Include="WebDav.Client" Version="2.9.0" />
|
<PackageVersion Include="WebDav.Client" Version="2.9.0" />
|
||||||
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
|
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
|
||||||
<PackageVersion Include="xunit.v3" Version="3.2.2" />
|
<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="ZXing.Net.Bindings.SkiaSharp" Version="0.16.22" />
|
||||||
<PackageVersion Include="SkiaSharp.NativeAssets.Linux" Version="3.119.4" />
|
<PackageVersion Include="SkiaSharp.NativeAssets.Linux" Version="3.119.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -193,12 +193,16 @@ public class CoreConfigContextBuilder
|
|||||||
if (preSocksItem != null)
|
if (preSocksItem != null)
|
||||||
{
|
{
|
||||||
var preSocksResult = await Build(nodeContext.AppConfig, preSocksItem);
|
var preSocksResult = await Build(nodeContext.AppConfig, preSocksItem);
|
||||||
|
|
||||||
|
var protectCoreTypeList = new HashSet<ECoreType>(nodeContext.ProtectCoreTypeList) { nodeContext.RunCoreType };
|
||||||
|
|
||||||
return preSocksResult with
|
return preSocksResult with
|
||||||
{
|
{
|
||||||
Context = preSocksResult.Context with
|
Context = preSocksResult.Context with
|
||||||
{
|
{
|
||||||
ProtectDomainList =
|
ProtectDomainList =
|
||||||
[.. nodeContext.ProtectDomainList ?? [], .. preSocksResult.Context.ProtectDomainList ?? []],
|
[.. nodeContext.ProtectDomainList ?? [], .. preSocksResult.Context.ProtectDomainList ?? []],
|
||||||
|
ProtectCoreTypeList = protectCoreTypeList,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,18 @@ public class CoreAdminManager
|
|||||||
StringBuilder sb = new();
|
StringBuilder sb = new();
|
||||||
sb.AppendLine("#!/bin/bash");
|
sb.AppendLine("#!/bin/bash");
|
||||||
var cmdLine = $"{fileName.AppendQuotes()} {string.Format(coreInfo.Arguments, Utils.GetBinConfigPath(configPath).AppendQuotes())}";
|
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 shFilePath = await FileUtils.CreateLinuxShellFile("run_as_sudo.sh", sb.ToString(), true);
|
||||||
|
|
||||||
var procService = new ProcessService(
|
var procService = new ProcessService(
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ public record CoreConfigContext
|
|||||||
// TUN Compatibility
|
// TUN Compatibility
|
||||||
public bool IsTunEnabled { get; init; } = false;
|
public bool IsTunEnabled { get; init; } = false;
|
||||||
public HashSet<string> ProtectDomainList { get; init; } = [];
|
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 IsWindows { get; init; }
|
||||||
public bool IsMacOS { get; init; }
|
public bool IsMacOS { get; init; }
|
||||||
|
|||||||
@@ -34,18 +34,18 @@ public partial class CoreConfigSingboxService
|
|||||||
_coreConfig.route.rules.AddRange(tunRules);
|
_coreConfig.route.rules.AddRange(tunRules);
|
||||||
}
|
}
|
||||||
|
|
||||||
var (lstDnsExe, lstDirectExe) = BuildRoutingDirectExe();
|
var lstDirectExe = BuildRoutingDirectExe();
|
||||||
_coreConfig.route.rules.Add(new()
|
_coreConfig.route.rules.Add(new()
|
||||||
{
|
{
|
||||||
port = [53],
|
port = [53],
|
||||||
action = "hijack-dns",
|
action = "hijack-dns",
|
||||||
process_name = lstDnsExe
|
process_path = lstDirectExe
|
||||||
});
|
});
|
||||||
|
|
||||||
_coreConfig.route.rules.Add(new()
|
_coreConfig.route.rules.Add(new()
|
||||||
{
|
{
|
||||||
outbound = Global.DirectTag,
|
outbound = Global.DirectTag,
|
||||||
process_name = lstDirectExe
|
process_path = lstDirectExe
|
||||||
});
|
});
|
||||||
|
|
||||||
// ICMP Routing
|
// 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 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)
|
if (coreConfig.CoreType == ECoreType.v2rayN)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (coreConfig.CoreExes == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
foreach (var baseExeName in coreConfig.CoreExes)
|
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);
|
return directExeSet.ToList();
|
||||||
var lstDirectExe = new List<string>(directExeSet);
|
|
||||||
|
|
||||||
return (lstDnsExe, lstDirectExe);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenRoutingUserRule(RulesItem? item)
|
private void GenRoutingUserRule(RulesItem? item)
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ public partial class CoreConfigV2rayService
|
|||||||
tunInbound.settings.autoOutboundsInterface = bindInterface;
|
tunInbound.settings.autoOutboundsInterface = bindInterface;
|
||||||
}
|
}
|
||||||
tunInbound.sniffing = inbound.sniffing;
|
tunInbound.sniffing = inbound.sniffing;
|
||||||
|
tunInbound.sniffing.routeOnly = true;
|
||||||
|
|
||||||
if (_config.TunModeItem.RouteExcludeAddress is { Count: > 0 })
|
if (_config.TunModeItem.RouteExcludeAddress is { Count: > 0 })
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ public partial class CoreConfigV2rayService
|
|||||||
{
|
{
|
||||||
_coreConfig.routing.rules.AddRange(tunRules);
|
_coreConfig.routing.rules.AddRange(tunRules);
|
||||||
}
|
}
|
||||||
var (lstDnsExe, lstDirectExe) = BuildRoutingDirectExe();
|
var lstDirectExe = BuildRoutingDirectExe();
|
||||||
_coreConfig.routing.rules.Add(new()
|
_coreConfig.routing.rules.Add(new()
|
||||||
{
|
{
|
||||||
port = "53",
|
port = "53",
|
||||||
process = lstDnsExe,
|
process = lstDirectExe,
|
||||||
outboundTag = Global.DnsOutboundTag,
|
outboundTag = Global.DnsOutboundTag,
|
||||||
});
|
});
|
||||||
_coreConfig.routing.rules.Add(new()
|
_coreConfig.routing.rules.Add(new()
|
||||||
@@ -232,36 +232,44 @@ public partial class CoreConfigV2rayService
|
|||||||
return finalRule;
|
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 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)
|
if (coreConfig.CoreType == ECoreType.v2rayN)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (coreConfig.CoreExes == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (coreConfig.CoreType == ECoreType.Xray)
|
||||||
|
{
|
||||||
|
directExeSet.Add("xray/");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
foreach (var baseExeName in coreConfig.CoreExes)
|
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/");
|
directExeSet.Add("self/");
|
||||||
|
|
||||||
var lstDnsExe = new List<string>(dnsExeSet);
|
return directExeSet.ToList();
|
||||||
var lstDirectExe = new List<string>(directExeSet);
|
|
||||||
|
|
||||||
return (lstDnsExe, lstDirectExe);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user