diff --git a/v2rayN/ServiceLib/Enums/EInboundProtocol.cs b/v2rayN/ServiceLib/Enums/EInboundProtocol.cs index 2d7c3034..6da9d1da 100644 --- a/v2rayN/ServiceLib/Enums/EInboundProtocol.cs +++ b/v2rayN/ServiceLib/Enums/EInboundProtocol.cs @@ -4,6 +4,7 @@ { socks = 0, socks2, + socks3, pac, api, api2, diff --git a/v2rayN/ServiceLib/Global.cs b/v2rayN/ServiceLib/Global.cs index 7436effb..299791ee 100644 --- a/v2rayN/ServiceLib/Global.cs +++ b/v2rayN/ServiceLib/Global.cs @@ -200,7 +200,7 @@ public static readonly List Languages = new() { "zh-Hans", "zh-Hant", "en", "fa-Ir", "ru", "hu" }; public static readonly List Alpns = new() { "h3", "h2", "http/1.1", "h3,h2", "h2,http/1.1", "h3,h2,http/1.1", "" }; public static readonly List LogLevels = new() { "debug", "info", "warning", "error", "none" }; - public static readonly List InboundTags = new() { "socks", "socks2" }; + public static readonly List InboundTags = new() { "socks", "socks2", "socks3" }; public static readonly List RuleProtocols = new() { "http", "tls", "bittorrent" }; public static readonly List RuleNetworks = new() { "", "tcp", "udp", "tcp,udp" }; public static readonly List destOverrideProtocols = ["http", "tls", "quic", "fakedns", "fakedns+others"]; diff --git a/v2rayN/ServiceLib/Models/ConfigItems.cs b/v2rayN/ServiceLib/Models/ConfigItems.cs index dff71a45..9465277e 100644 --- a/v2rayN/ServiceLib/Models/ConfigItems.cs +++ b/v2rayN/ServiceLib/Models/ConfigItems.cs @@ -24,21 +24,16 @@ public class InItem { public int LocalPort { get; set; } - public string Protocol { get; set; } - public bool UdpEnabled { get; set; } - public bool SniffingEnabled { get; set; } = true; public List? DestOverride { get; set; } = ["http", "tls"]; public bool RouteOnly { get; set; } public bool AllowLANConn { get; set; } - public bool NewPort4LAN { get; set; } - public string User { get; set; } - public string Pass { get; set; } + public bool SecondLocalPortEnabled { get; set; } } [Serializable] diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs index 9a91739c..f0bd6dde 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs +++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs @@ -2599,6 +2599,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 socks: local port, socks2: second local port, socks3: LAN port 的本地化字符串。 + /// + public static string TbRoutingInboundTagTips { + get { + return ResourceManager.GetString("TbRoutingInboundTagTips", resourceCulture); + } + } + /// /// 查找类似 Domain 的本地化字符串。 /// @@ -2914,6 +2923,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Sniffing type 的本地化字符串。 + /// + public static string TbSettingsDestOverride { + get { + return ResourceManager.GetString("TbSettingsDestOverride", resourceCulture); + } + } + /// /// 查找类似 Outbound DNS address 的本地化字符串。 /// @@ -3301,6 +3319,15 @@ namespace ServiceLib.Resx { } } + /// + /// 查找类似 Enable second mixed port 的本地化字符串。 + /// + public static string TbSettingsSecondLocalPortEnabled { + get { + return ResourceManager.GetString("TbSettingsSecondLocalPortEnabled", resourceCulture); + } + } + /// /// 查找类似 Set Win10 UWP Loopback 的本地化字符串。 /// @@ -3329,7 +3356,7 @@ namespace ServiceLib.Resx { } /// - /// 查找类似 Pac port = +2; Xray API port = +3; mihomo API port = +4; 的本地化字符串。 + /// 查找类似 Pac port = +3; Xray API port = +4; mihomo API port = +5; 的本地化字符串。 /// public static string TbSettingsSocksPortTip { get { diff --git a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx index 75110f2d..8b3cc257 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx @@ -1244,7 +1244,7 @@ فایل TTF/TTC فونت را در دایرکتوری guiFonts کپی کنید، تنظیمات را مجددا راه اندازی کنید - پورت Pac = +2; پورت Xray API = +3; پورت mihomo API = +4; + پورت Pac = +3; پورت Xray API = +4; پورت mihomo API = +5; این را با امتیازات ادمین تنظیم کنید، پس از راه اندازی، امتیازات مدیر را دریافت کنید @@ -1390,4 +1390,13 @@ استثنا:از سرور پروکسی برای آدرس ها، با کاما (،) استفاده نکنید - + + Sniffing type + + + Enable second mixed port + + + socks: local port, socks2: second local port, socks3: LAN port + + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.hu.resx b/v2rayN/ServiceLib/Resx/ResUI.hu.resx index 3417fafb..cee28544 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.hu.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.hu.resx @@ -109,7 +109,7 @@ text/microsoft-resx -2.0 + 2.0 System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -992,7 +992,7 @@ Kérlek, másold a betűtípus TTF/TTC fájlt a guiFonts könyvtárba, indítsd újra a beállításokat - Pac port = +2; Xray API port = +3; mihomo API port = +4; + Pac port = +3; Xray API port = +4; mihomo API port = +5; Állítsd be ezt admin jogokkal, indítás után szerezd meg az admin jogokat @@ -1390,4 +1390,13 @@ Kivétel. Ne használj proxy szervert a címeknél, évezz pontosvesszőt (,) - \ No newline at end of file + + Sniffing type + + + Enable second mixed port + + + socks: local port, socks2: second local port, socks3: LAN port + + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx index 6de29b69..d657b941 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.resx @@ -992,7 +992,7 @@ Copy the font TTF/TTC file to the directory guiFonts, restart the settings - Pac port = +2; Xray API port = +3; mihomo API port = +4; + Pac port = +3; Xray API port = +4; mihomo API port = +5; Set this with admin privileges, get admin privileges after startup @@ -1390,4 +1390,13 @@ Exception. Do not use proxy server for addresses,with a comma (,) + + Sniffing type + + + Enable second mixed port + + + socks: local port, socks2: second local port, socks3: LAN port + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx index eadd3978..2e795617 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.ru.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.ru.resx @@ -1310,7 +1310,7 @@ Move up and down - Pac port = +2; Xray API port = +3; mihomo API port = +4; + Pac port = +3; Xray API port = +4; mihomo API port = +5; Install the font to the system and restart the settings @@ -1390,4 +1390,13 @@ Exception. Do not use proxy server for addresses,with a comma (,) + + Sniffing type + + + Enable second mixed port + + + socks: local port, socks2: second local port, socks3: LAN port + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx index baa35950..93878d73 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx @@ -992,7 +992,7 @@ 拷贝字体TTF/TTC文件到目录guiFonts,重启设置 - Pac端口= +2;Xray API端口= +3;mihomo API端口= +4; + Pac端口= +3;Xray API端口= +4;mihomo API端口= +5; 以管理员权限设置此项,在启动后获得管理员权限 @@ -1387,4 +1387,13 @@ 例外. 对于下列地址不使用代理配置文件:使用逗号(,)分隔 + + 流量探测类型 + + + 开启第二个本地监听端口 + + + socks:本地端口,socks2:第二个本地端口,socks3:局域网端口 + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx index fe1b435c..df522429 100644 --- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx +++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx @@ -992,7 +992,7 @@ 複製字型TTF/TTC檔案到目錄guiFonts,重啟設定 - Pac連接埠= +2;Xray API連接埠= +3;mihomo API連接埠= +4; + Pac連接埠= +3;Xray API連接埠= +4;mihomo API連接埠= +5; 以管理員權限設定此項,在啟動後獲得管理員權限 @@ -1387,4 +1387,13 @@ 例外. 對於下列位址不使用代理設定檔:使用逗號(,)分隔 + + 流量探測類型 + + + 開啟第二個本機監聽埠 + + + socks:本地端口,socks2:第二個本地端口,socks3:區域網路端口 + \ No newline at end of file diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs index f878e4b2..b1a907d2 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs @@ -507,11 +507,17 @@ namespace ServiceLib.Services.CoreConfig inbound.domain_strategy = routing.DomainStrategy4Singbox; } + if (_config.Inbound.First().SecondLocalPortEnabled) + { + var inbound2 = GetInbound(inbound, EInboundProtocol.socks2, true); + singboxConfig.inbounds.Add(inbound2); + } + if (_config.Inbound.First().AllowLANConn) { if (_config.Inbound.First().NewPort4LAN) { - var inbound3 = GetInbound(inbound, EInboundProtocol.socks2, true); + var inbound3 = GetInbound(inbound, EInboundProtocol.socks3, true); inbound3.listen = listen; singboxConfig.inbounds.Add(inbound3); diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs index 1db2c7d6..e54eebc1 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigV2rayService.cs @@ -394,11 +394,17 @@ namespace ServiceLib.Services.CoreConfig var inbound = GetInbound(_config.Inbound.First(), EInboundProtocol.socks, true); v2rayConfig.inbounds.Add(inbound); + if (_config.Inbound.First().SecondLocalPortEnabled) + { + var inbound2 = GetInbound(_config.Inbound.First(), EInboundProtocol.socks2, true); + v2rayConfig.inbounds.Add(inbound2); + } + if (_config.Inbound.First().AllowLANConn) { if (_config.Inbound.First().NewPort4LAN) { - var inbound3 = GetInbound(_config.Inbound.First(), EInboundProtocol.socks2, true); + var inbound3 = GetInbound(_config.Inbound.First(), EInboundProtocol.socks3, true); inbound3.listen = listen; v2rayConfig.inbounds.Add(inbound3); diff --git a/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs index 8e61b36a..68ce870c 100644 --- a/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/OptionSettingViewModel.cs @@ -9,6 +9,7 @@ namespace ServiceLib.ViewModels #region Core [Reactive] public int localPort { get; set; } + [Reactive] public bool SecondLocalPortEnabled { get; set; } [Reactive] public bool udpEnabled { get; set; } [Reactive] public bool sniffingEnabled { get; set; } public IList destOverride { get; set; } @@ -125,6 +126,7 @@ namespace ServiceLib.ViewModels var inbound = _config.Inbound.First(); localPort = inbound.LocalPort; + SecondLocalPortEnabled = inbound.SecondLocalPortEnabled; udpEnabled = inbound.UdpEnabled; sniffingEnabled = inbound.SniffingEnabled; routeOnly = inbound.RouteOnly; @@ -288,6 +290,7 @@ namespace ServiceLib.ViewModels //Core _config.Inbound.First().LocalPort = localPort; + _config.Inbound.First().SecondLocalPortEnabled = SecondLocalPortEnabled; _config.Inbound.First().UdpEnabled = udpEnabled; _config.Inbound.First().SniffingEnabled = sniffingEnabled; _config.Inbound.First().DestOverride = destOverride?.ToList(); diff --git a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs index f66a15c3..2a5e13a9 100644 --- a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs @@ -459,7 +459,7 @@ namespace ServiceLib.ViewModels if (_config.Inbound.First().NewPort4LAN) { StringBuilder sb2 = new(); - sb2.Append($"[{EInboundProtocol.mixed}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks2)}]"); + sb2.Append($"[{EInboundProtocol.mixed}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks3)}]"); InboundLanDisplay = $"{ResUI.LabLAN}:{sb2}"; } else diff --git a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml index 779e61e0..b240ed4b 100644 --- a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml @@ -37,33 +37,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - + HorizontalAlignment="Left" + Classes="Margin8" /> + + + @@ -321,19 +317,19 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - + { - this.Bind(ViewModel, vm => vm.localPort, v => v.txtlocalPort.Text).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.localPort, v => v.txtlocalPort.Text).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.SecondLocalPortEnabled, v => v.togSecondLocalPortEnabled.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.udpEnabled, v => v.togudpEnabled.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.sniffingEnabled, v => v.togsniffingEnabled.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.routeOnly, v => v.togrouteOnly.IsChecked).DisposeWith(disposables); diff --git a/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml b/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml index d77f048b..daeaad15 100644 --- a/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml @@ -119,6 +119,13 @@ Classes="Margin8" SelectionMode="Multiple" Theme="{DynamicResource PureCardRadioGroupListBox}" /> + + + + + @@ -94,7 +97,21 @@ TextWrapping="Wrap" /> + + + - - - - + Margin="{StaticResource Margin8}" + HorizontalAlignment="Left" /> + + + @@ -356,7 +380,7 @@ { this.Bind(ViewModel, vm => vm.localPort, v => v.txtlocalPort.Text).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.SecondLocalPortEnabled, v => v.togSecondLocalPortEnabled.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.udpEnabled, v => v.togudpEnabled.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.sniffingEnabled, v => v.togsniffingEnabled.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.routeOnly, v => v.togrouteOnly.IsChecked).DisposeWith(disposables); diff --git a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml index cd419d16..1c67ceaa 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml +++ b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml @@ -1,11 +1,11 @@  +