mirror of
https://github.com/2dust/v2rayN.git
synced 2026-04-16 04:25:45 +00:00
Compare commits
No commits in common. "0db611b7a9da1ab78a0f9d4566d04c07493d8b4a" and "6c8f22ab86cfcce43e01d9d1d466c19d8838321d" have entirely different histories.
0db611b7a9
...
6c8f22ab86
16 changed files with 67 additions and 123 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<Version>7.20.3</Version>
|
||||
<Version>7.20.2</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@
|
|||
<PackageVersion Include="TaskScheduler" Version="2.12.2" />
|
||||
<PackageVersion Include="WebDav.Client" Version="2.9.0" />
|
||||
<PackageVersion Include="xunit" Version="2.9.3" />
|
||||
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
|
||||
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||
<PackageVersion Include="YamlDotNet" Version="16.3.0" />
|
||||
<PackageVersion Include="ZXing.Net.Bindings.SkiaSharp" Version="0.16.14" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -103,8 +103,8 @@ public class CoreConfigV2rayServiceTests
|
|||
AllProxiesMap = allProxiesMap ?? new(),
|
||||
SimpleDnsItem = new SimpleDNSItem(),
|
||||
IsTunEnabled = isTunEnabled,
|
||||
TunProtectSocksPort = tunProtectSsPort,
|
||||
ProxyRelaySocksPort = proxyRelaySsPort,
|
||||
TunProtectSsPort = tunProtectSsPort,
|
||||
ProxyRelaySsPort = proxyRelaySsPort,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
36
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
36
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
|
|
@ -4014,6 +4014,24 @@ namespace ServiceLib.Resx {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Local outbound address (SendThrough) 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsSendThrough {
|
||||
get {
|
||||
return ResourceManager.GetString("TbSettingsSendThrough", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Only applies to Xray. Fill in a local IPv4 address; leave empty to disable. 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsSendThroughTip {
|
||||
get {
|
||||
return ResourceManager.GetString("TbSettingsSendThroughTip", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Enable Log 的本地化字符串。
|
||||
/// </summary>
|
||||
|
|
@ -4158,24 +4176,6 @@ namespace ServiceLib.Resx {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Local outbound address (SendThrough) 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsSendThrough {
|
||||
get {
|
||||
return ResourceManager.GetString("TbSettingsSendThrough", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 For multi-interface environments, enter the local machine's IPv4 address 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsSendThroughTip {
|
||||
get {
|
||||
return ResourceManager.GetString("TbSettingsSendThroughTip", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Set Win10 UWP Loopback 的本地化字符串。
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -1698,7 +1698,4 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
|||
<data name="TbLegacyProtect" xml:space="preserve">
|
||||
<value>Legacy TUN Protect</value>
|
||||
</data>
|
||||
<data name="TbSettingsSendThroughTip" xml:space="preserve">
|
||||
<value>For multi-interface environments, enter the local machine's IPv4 address</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
@ -1695,7 +1695,4 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
|||
<data name="TbLegacyProtect" xml:space="preserve">
|
||||
<value>Legacy TUN Protect</value>
|
||||
</data>
|
||||
<data name="TbSettingsSendThroughTip" xml:space="preserve">
|
||||
<value>For multi-interface environments, enter the local machine's IPv4 address</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
@ -1698,7 +1698,4 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
|||
<data name="TbLegacyProtect" xml:space="preserve">
|
||||
<value>Legacy TUN Protect</value>
|
||||
</data>
|
||||
<data name="TbSettingsSendThroughTip" xml:space="preserve">
|
||||
<value>For multi-interface environments, enter the local machine's IPv4 address</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
@ -1324,7 +1324,7 @@
|
|||
<value>Local outbound address (SendThrough)</value>
|
||||
</data>
|
||||
<data name="TbSettingsSendThroughTip" xml:space="preserve">
|
||||
<value>For multi-interface environments, enter the local machine's IPv4 address</value>
|
||||
<value>Only applies to Xray. Fill in a local IPv4 address; leave empty to disable.</value>
|
||||
</data>
|
||||
<data name="FillCorrectSendThroughIPv4" xml:space="preserve">
|
||||
<value>Please fill in the correct IPv4 address for SendThrough.</value>
|
||||
|
|
@ -1707,4 +1707,4 @@ The "Get Certificate" action may fail if a self-signed certificate is used or if
|
|||
<data name="TbLegacyProtect" xml:space="preserve">
|
||||
<value>Legacy TUN Protect</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
|
|
|
|||
|
|
@ -1698,7 +1698,4 @@
|
|||
<data name="TbLegacyProtect" xml:space="preserve">
|
||||
<value>Устаревшая защита TUN (Legacy Protect)</value>
|
||||
</data>
|
||||
<data name="TbSettingsSendThroughTip" xml:space="preserve">
|
||||
<value>For multi-interface environments, enter the local machine's IPv4 address</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
|
|
|
|||
|
|
@ -1321,7 +1321,7 @@
|
|||
<value>本地出站地址 (SendThrough)</value>
|
||||
</data>
|
||||
<data name="TbSettingsSendThroughTip" xml:space="preserve">
|
||||
<value>用于多网口环境,请填写本机 IPv4 地址</value>
|
||||
<value>仅对 Xray 生效,填写本机 IPv4;留空则不设置。</value>
|
||||
</data>
|
||||
<data name="FillCorrectSendThroughIPv4" xml:space="preserve">
|
||||
<value>请填写正确的 SendThrough IPv4 地址。</value>
|
||||
|
|
@ -1704,4 +1704,4 @@
|
|||
<data name="TbLegacyProtect" xml:space="preserve">
|
||||
<value>旧版 TUN 保护</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
||||
|
|
|
|||
|
|
@ -1695,7 +1695,4 @@
|
|||
<data name="TbLegacyProtect" xml:space="preserve">
|
||||
<value>Legacy TUN Protect</value>
|
||||
</data>
|
||||
<data name="TbSettingsSendThroughTip" xml:space="preserve">
|
||||
<value>For multi-interface environments, enter the local machine's IPv4 address</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
@ -57,8 +57,6 @@ public partial class CoreConfigSingboxService(CoreConfigContext context)
|
|||
|
||||
ConvertGeo2Ruleset();
|
||||
|
||||
ApplyOutboundSendThrough();
|
||||
|
||||
ret.Msg = string.Format(ResUI.SuccessfulConfiguration, "");
|
||||
ret.Success = true;
|
||||
|
||||
|
|
@ -223,7 +221,6 @@ public partial class CoreConfigSingboxService(CoreConfigContext context)
|
|||
_coreConfig.route.rules.Add(rule);
|
||||
}
|
||||
|
||||
ApplyOutboundSendThrough();
|
||||
ret.Success = true;
|
||||
ret.Data = JsonUtils.Serialize(_coreConfig);
|
||||
return ret;
|
||||
|
|
@ -282,7 +279,6 @@ public partial class CoreConfigSingboxService(CoreConfigContext context)
|
|||
listen_port = port,
|
||||
type = EInboundProtocol.mixed.ToString(),
|
||||
});
|
||||
ApplyOutboundSendThrough();
|
||||
|
||||
ret.Msg = string.Format(ResUI.SuccessfulConfiguration, "");
|
||||
ret.Success = true;
|
||||
|
|
|
|||
|
|
@ -58,40 +58,4 @@ public partial class CoreConfigSingboxService
|
|||
|
||||
return JsonUtils.Serialize(fullConfigTemplateNode);
|
||||
}
|
||||
|
||||
private void ApplyOutboundSendThrough()
|
||||
{
|
||||
var sendThrough = _config.CoreBasicItem.SendThrough?.TrimEx();
|
||||
foreach (var outbound in _coreConfig.outbounds ?? [])
|
||||
{
|
||||
outbound.inet4_bind_address = ShouldApplySendThrough(outbound, sendThrough) ? sendThrough : null;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool ShouldApplySendThrough(Outbound4Sbox outbound, string? sendThrough)
|
||||
{
|
||||
if (sendThrough.IsNullOrEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (outbound.type is "direct" or "block" or "dns" or "selector" or "urltest")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!outbound.detour.IsNullOrEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var outboundAddress = outbound.server ?? string.Empty;
|
||||
|
||||
if (outboundAddress.Equals("localhost", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return !IPAddress.TryParse(outboundAddress, out var address) || !IPAddress.IsLoopback(address);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -407,4 +407,43 @@ public partial class CoreConfigV2rayService(CoreConfigContext context)
|
|||
}
|
||||
|
||||
#endregion public gen function
|
||||
|
||||
private void ApplyOutboundSendThrough()
|
||||
{
|
||||
var sendThrough = _config.CoreBasicItem.SendThrough?.TrimEx();
|
||||
foreach (var outbound in _coreConfig.outbounds ?? [])
|
||||
{
|
||||
outbound.sendThrough = ShouldApplySendThrough(outbound, sendThrough) ? sendThrough : null;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool ShouldApplySendThrough(Outbounds4Ray outbound, string? sendThrough)
|
||||
{
|
||||
if (sendThrough.IsNullOrEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (outbound.protocol is "freedom" or "blackhole" or "dns" or "loopback")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (outbound.streamSettings?.sockopt?.dialerProxy.IsNullOrEmpty() == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var outboundAddress = outbound.settings?.servers?.FirstOrDefault()?.address
|
||||
?? outbound.settings?.vnext?.FirstOrDefault()?.address
|
||||
?? outbound.settings?.address?.ToString()
|
||||
?? string.Empty;
|
||||
|
||||
if (outboundAddress.Equals("localhost", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return !IPAddress.TryParse(outboundAddress, out var address) || !IPAddress.IsLoopback(address);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,43 +127,4 @@ public partial class CoreConfigV2rayService
|
|||
|
||||
return JsonUtils.Serialize(fullConfigTemplateNode);
|
||||
}
|
||||
|
||||
private void ApplyOutboundSendThrough()
|
||||
{
|
||||
var sendThrough = _config.CoreBasicItem.SendThrough?.TrimEx();
|
||||
foreach (var outbound in _coreConfig.outbounds ?? [])
|
||||
{
|
||||
outbound.sendThrough = ShouldApplySendThrough(outbound, sendThrough) ? sendThrough : null;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool ShouldApplySendThrough(Outbounds4Ray outbound, string? sendThrough)
|
||||
{
|
||||
if (sendThrough.IsNullOrEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (outbound.protocol is "freedom" or "blackhole" or "dns" or "loopback")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (outbound.streamSettings?.sockopt?.dialerProxy.IsNullOrEmpty() == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var outboundAddress = outbound.settings?.servers?.FirstOrDefault()?.address
|
||||
?? outbound.settings?.vnext?.FirstOrDefault()?.address
|
||||
?? outbound.settings?.address?.ToString()
|
||||
?? string.Empty;
|
||||
|
||||
if (outboundAddress.Equals("localhost", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return !IPAddress.TryParse(outboundAddress, out var address) || !IPAddress.IsLoopback(address);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
</Folder>
|
||||
<Project Path="AmazTool/AmazTool.csproj" />
|
||||
<Project Path="GlobalHotKeys/src/GlobalHotKeys/GlobalHotKeys.csproj" />
|
||||
<Project Path="ServiceLib.Tests/ServiceLib.Tests.csproj" />
|
||||
<Project Path="ServiceLib/ServiceLib.csproj" />
|
||||
<Project Path="v2rayN.Desktop/v2rayN.Desktop.csproj" />
|
||||
<Project Path="v2rayN/v2rayN.csproj" />
|
||||
|
|
|
|||
Loading…
Reference in a new issue