mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-15 17:55:00 +03:00
feat(send-through): 支持配置本地出站地址 (#8946)
* feat(send-through): 支持配置本地出站地址 为 Xray 增加 SendThrough 配置项,允许指定本机 IPv4 作为出站源地址。 - 在核心设置页新增 SendThrough 输入框及中英文提示文案 - 保存配置时校验并持久化本机 IPv4 地址 - 生成 Xray 配置时为所有 outbound 写入 sendThrough 字段 影响说明: - 仅对 Xray 生效,留空时不设置该字段 * fix(send-through): limit sendThrough to remote egress outbounds
This commit is contained in:
@@ -522,6 +522,23 @@ public class Utils
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsIpv4(string? ip)
|
||||
{
|
||||
if (ip.IsNullOrEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ip = ip.Trim();
|
||||
if (!IPAddress.TryParse(ip, out var address))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return address.AddressFamily == AddressFamily.InterNetwork
|
||||
&& ip.Count(c => c == '.') == 3;
|
||||
}
|
||||
|
||||
public static bool IsIpAddress(string? ip)
|
||||
{
|
||||
if (ip.IsNullOrEmpty())
|
||||
|
||||
Reference in New Issue
Block a user