diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/v2rayN/Global.cs index 007629f6..81858e25 100644 --- a/v2rayN/v2rayN/Global.cs +++ b/v2rayN/v2rayN/Global.cs @@ -39,6 +39,7 @@ namespace v2rayN public const string V2raySampleHttpresponseFileName = "v2rayN.Sample.SampleHttpresponse"; public const string V2raySampleInbound = "v2rayN.Sample.SampleInbound"; public const string V2raySampleOutbound = "v2rayN.Sample.SampleOutbound"; + public const string SingboxSampleOutbound = "v2rayN.Sample.SingboxSampleOutbound"; public const string CustomRoutingFileName = "v2rayN.Sample.custom_routing_"; public const string TunSingboxDNSFileName = "v2rayN.Sample.tun_singbox_dns"; public const string TunSingboxInboundFileName = "v2rayN.Sample.tun_singbox_inbound"; diff --git a/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs b/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs index 4c396d11..7c012342 100644 --- a/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs +++ b/v2rayN/v2rayN/Handler/CoreConfigSingbox.cs @@ -180,6 +180,10 @@ namespace v2rayN.Handler tunInbound.mtu = _config.tunModeItem.mtu; tunInbound.strict_route = _config.tunModeItem.strictRoute; tunInbound.stack = _config.tunModeItem.stack; + if (_config.tunModeItem.enableIPv6Address == false) + { + tunInbound.inet6_address = null; + } singboxConfig.inbounds.Add(tunInbound); } @@ -450,7 +454,7 @@ namespace v2rayN.Handler //current proxy var outbound = singboxConfig.outbounds[0]; - var txtOutbound = Utils.GetEmbedText(Global.V2raySampleOutbound); + var txtOutbound = Utils.GetEmbedText(Global.SingboxSampleOutbound); //Previous proxy var prevNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.prevProfile!); diff --git a/v2rayN/v2rayN/Mode/ConfigItems.cs b/v2rayN/v2rayN/Mode/ConfigItems.cs index ef83051b..57068635 100644 --- a/v2rayN/v2rayN/Mode/ConfigItems.cs +++ b/v2rayN/v2rayN/Mode/ConfigItems.cs @@ -164,6 +164,7 @@ namespace v2rayN.Mode public string stack { get; set; } public int mtu { get; set; } public bool enableExInbound { get; set; } + public bool enableIPv6Address { get; set; } = true; } [Serializable] diff --git a/v2rayN/v2rayN/Mode/SingboxConfig.cs b/v2rayN/v2rayN/Mode/SingboxConfig.cs index 8dfd8efd..aa0b6b68 100644 --- a/v2rayN/v2rayN/Mode/SingboxConfig.cs +++ b/v2rayN/v2rayN/Mode/SingboxConfig.cs @@ -72,7 +72,7 @@ public string? domain_strategy { get; set; } public string interface_name { get; set; } public string inet4_address { get; set; } - public string inet6_address { get; set; } + public string? inet6_address { get; set; } public int? mtu { get; set; } public bool? auto_route { get; set; } public bool? strict_route { get; set; } diff --git a/v2rayN/v2rayN/Resx/ResUI.Designer.cs b/v2rayN/v2rayN/Resx/ResUI.Designer.cs index 4d7adae7..40c35dfe 100644 --- a/v2rayN/v2rayN/Resx/ResUI.Designer.cs +++ b/v2rayN/v2rayN/Resx/ResUI.Designer.cs @@ -2554,6 +2554,15 @@ namespace v2rayN.Resx { } } + /// + /// 查找类似 Enable additional Inbound 的本地化字符串。 + /// + public static string TbSettingsEnableExInbound { + get { + return ResourceManager.GetString("TbSettingsEnableExInbound", resourceCulture); + } + } + /// /// 查找类似 Enable hardware acceleration(Require restart) 的本地化字符串。 /// @@ -2563,6 +2572,15 @@ namespace v2rayN.Resx { } } + /// + /// 查找类似 Enable IPv6 Address 的本地化字符串。 + /// + public static string TbSettingsEnableIPv6Address { + get { + return ResourceManager.GetString("TbSettingsEnableIPv6Address", resourceCulture); + } + } + /// /// 查找类似 Exception 的本地化字符串。 /// diff --git a/v2rayN/v2rayN/Resx/ResUI.resx b/v2rayN/v2rayN/Resx/ResUI.resx index 0756f3f5..06e2ea02 100644 --- a/v2rayN/v2rayN/Resx/ResUI.resx +++ b/v2rayN/v2rayN/Resx/ResUI.resx @@ -1162,4 +1162,10 @@ Please make sure the remarks exists and is unique + + Enable additional Inbound + + + Enable IPv6 Address + \ No newline at end of file diff --git a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx index 25a7e3f0..5fbeefcc 100644 --- a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx @@ -1159,4 +1159,10 @@ 请确保别名存在并唯一 + + 启用额外监听端口 + + + 启用IPv6 + \ No newline at end of file diff --git a/v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx b/v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx index f68bd3f0..858e1b71 100644 --- a/v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx @@ -1147,4 +1147,10 @@ 請確保別名存在並且唯一 + + 啟用額外監聽端口 + + + 啟用IPv6 + \ No newline at end of file diff --git a/v2rayN/v2rayN/Sample/SingboxSampleOutbound b/v2rayN/v2rayN/Sample/SingboxSampleOutbound new file mode 100644 index 00000000..9c87194f --- /dev/null +++ b/v2rayN/v2rayN/Sample/SingboxSampleOutbound @@ -0,0 +1,6 @@ +{ + "type": "vless", + "tag": "proxy", + "server": "", + "server_port": 443 +} \ No newline at end of file diff --git a/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs b/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs index afb33fdb..8a49279f 100644 --- a/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs +++ b/v2rayN/v2rayN/ViewModels/OptionSettingViewModel.cs @@ -83,6 +83,8 @@ namespace v2rayN.ViewModels [Reactive] public bool TunStrictRoute { get; set; } [Reactive] public string TunStack { get; set; } [Reactive] public int TunMtu { get; set; } + [Reactive] public bool TunEnableExInbound { get; set; } + [Reactive] public bool TunEnableIPv6Address { get; set; } #endregion Tun mode @@ -174,6 +176,8 @@ namespace v2rayN.ViewModels TunStrictRoute = _config.tunModeItem.strictRoute; TunStack = _config.tunModeItem.stack; TunMtu = _config.tunModeItem.mtu; + TunEnableExInbound = _config.tunModeItem.enableExInbound; + TunEnableIPv6Address = _config.tunModeItem.enableIPv6Address; #endregion Tun mode @@ -319,6 +323,8 @@ namespace v2rayN.ViewModels _config.tunModeItem.strictRoute = TunStrictRoute; _config.tunModeItem.stack = TunStack; _config.tunModeItem.mtu = TunMtu; + _config.tunModeItem.enableExInbound = TunEnableExInbound; + _config.tunModeItem.enableIPv6Address = TunEnableIPv6Address; //coreType SaveCoreType(); diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml index 7aa5ec35..b94b7a86 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml @@ -805,6 +805,8 @@ + + @@ -857,6 +859,34 @@ Margin="{StaticResource SettingItemMargin}" HorizontalAlignment="Left" Style="{StaticResource DefComboBox}" /> + + + + + + diff --git a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs index fb445ebe..45ff0e28 100644 --- a/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/OptionSettingWindow.xaml.cs @@ -186,6 +186,8 @@ namespace v2rayN.Views this.Bind(ViewModel, vm => vm.TunStrictRoute, v => v.togStrictRoute.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.TunStack, v => v.cmbStack.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.TunMtu, v => v.cmbMtu.Text).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.TunEnableExInbound, v => v.togEnableExInbound.IsChecked).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.TunEnableIPv6Address, v => v.togEnableIPv6Address.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.CoreType1, v => v.cmbCoreType1.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.CoreType2, v => v.cmbCoreType2.Text).DisposeWith(disposables); diff --git a/v2rayN/v2rayN/v2rayN.csproj b/v2rayN/v2rayN/v2rayN.csproj index 87a56ca3..0106c0bc 100644 --- a/v2rayN/v2rayN/v2rayN.csproj +++ b/v2rayN/v2rayN/v2rayN.csproj @@ -11,7 +11,8 @@ v2rayN.ico Copyright © 2017-2023 (GPLv3) 6.31 - + + @@ -30,6 +31,7 @@ + Never