mirror of
https://github.com/2dust/v2rayN.git
synced 2026-09-28 17:58:06 +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:
@@ -20,6 +20,7 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||
[Reactive] public bool defAllowInsecure { get; set; }
|
||||
[Reactive] public string defFingerprint { get; set; }
|
||||
[Reactive] public string defUserAgent { get; set; }
|
||||
[Reactive] public string sendThrough { get; set; }
|
||||
[Reactive] public string mux4SboxProtocol { get; set; }
|
||||
[Reactive] public bool enableCacheFile4Sbox { get; set; }
|
||||
[Reactive] public int? hyUpMbps { get; set; }
|
||||
@@ -154,6 +155,7 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||
defAllowInsecure = _config.CoreBasicItem.DefAllowInsecure;
|
||||
defFingerprint = _config.CoreBasicItem.DefFingerprint;
|
||||
defUserAgent = _config.CoreBasicItem.DefUserAgent;
|
||||
sendThrough = _config.CoreBasicItem.SendThrough;
|
||||
mux4SboxProtocol = _config.Mux4SboxItem.Protocol;
|
||||
enableCacheFile4Sbox = _config.CoreBasicItem.EnableCacheFile4Sbox;
|
||||
hyUpMbps = _config.HysteriaItem.UpMbps;
|
||||
@@ -297,6 +299,12 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||
NoticeManager.Instance.Enqueue(ResUI.FillLocalListeningPort);
|
||||
return;
|
||||
}
|
||||
var sendThroughValue = sendThrough?.TrimEx();
|
||||
if (sendThroughValue.IsNotEmpty() && !Utils.IsIpv4(sendThroughValue))
|
||||
{
|
||||
NoticeManager.Instance.Enqueue(ResUI.FillCorrectSendThroughIPv4);
|
||||
return;
|
||||
}
|
||||
var needReboot = EnableStatistics != _config.GuiItem.EnableStatistics
|
||||
|| DisplayRealTimeSpeed != _config.GuiItem.DisplayRealTimeSpeed
|
||||
|| EnableDragDropSort != _config.UiItem.EnableDragDropSort
|
||||
@@ -336,6 +344,7 @@ public class OptionSettingViewModel : MyReactiveObject
|
||||
_config.CoreBasicItem.DefAllowInsecure = defAllowInsecure;
|
||||
_config.CoreBasicItem.DefFingerprint = defFingerprint;
|
||||
_config.CoreBasicItem.DefUserAgent = defUserAgent;
|
||||
_config.CoreBasicItem.SendThrough = sendThrough?.TrimEx();
|
||||
_config.Mux4SboxItem.Protocol = mux4SboxProtocol;
|
||||
_config.CoreBasicItem.EnableCacheFile4Sbox = enableCacheFile4Sbox;
|
||||
_config.HysteriaItem.UpMbps = hyUpMbps ?? 0;
|
||||
|
||||
Reference in New Issue
Block a user